From b4790010a8889e617fa60295f91080e1e0546d01 Mon Sep 17 00:00:00 2001 From: Laurent Cimon Date: Sat, 17 Oct 2020 16:25:13 -0400 Subject: [PATCH] Build: Modify various parts to allow the build to succeed on FreeBSD --- AK/Random.h | 4 ++-- Meta/build-image-qemu.sh | 2 +- Meta/build-root-filesystem.sh | 7 ++++--- Toolchain/BuildIt.sh | 2 ++ Toolchain/BuildIt_x86_64.sh | 2 ++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/AK/Random.h b/AK/Random.h index 3383870902..eff727ec88 100644 --- a/AK/Random.h +++ b/AK/Random.h @@ -33,7 +33,7 @@ # include #endif -#if defined(__linux__) +#if defined(__unix__) # include #endif @@ -47,7 +47,7 @@ inline void fill_with_random(void* buffer, size_t length) { #if defined(__serenity__) arc4random_buf(buffer, length); -#elif defined(__linux__) or defined(__APPLE__) +#elif defined(__unix__) or defined(__APPLE__) int rc = getentropy(buffer, length); (void)rc; #endif diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh index 82f391610d..a6acf8d9cb 100755 --- a/Meta/build-image-qemu.sh +++ b/Meta/build-image-qemu.sh @@ -54,7 +54,7 @@ if [ "$(uname -s)" = "Darwin" ]; then elif [ "$(uname -s)" = "OpenBSD" ]; then mount -t ext2fs "/dev/${VND}i" mnt/ || die "could not mount filesystem" elif [ "$(uname -s)" = "FreeBSD" ]; then - fuse-ext2 -o rw+ "/dev/${MD}" mnt/ || die "could not mount filesystem" + fuse-ext2 -o rw+,direct_io "/dev/${MD}" mnt/ || die "could not mount filesystem" else if ! mount _disk_image mnt/ ; then if command -v genext2fs 1>/dev/null ; then diff --git a/Meta/build-root-filesystem.sh b/Meta/build-root-filesystem.sh index a66a13e1b4..e2a9addfe8 100755 --- a/Meta/build-root-filesystem.sh +++ b/Meta/build-root-filesystem.sh @@ -12,10 +12,11 @@ window_gid=13 CP="cp" -# cp on macOS does not support the -d option. +# cp on macOS and BSD systems do not support the -d option. # gcp comes with coreutils, which is already a dependency. -if [ "$(uname -s)" = "Darwin" ]; then - CP=gcp +OS="$(uname -s)" +if [ "$OS" = "Darwin" ] || echo "$OS" | grep -qe 'BSD$'; then + CP="gcp" fi die() { diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh index 8b15051a8c..2847027184 100755 --- a/Toolchain/BuildIt.sh +++ b/Toolchain/BuildIt.sh @@ -42,6 +42,8 @@ elif [ "$(uname -s)" = "FreeBSD" ]; then MAKE=gmake MD5SUM="md5 -q" NPROC="sysctl -n hw.ncpu" + export with_gmp=/usr/local + export with_mpfr=/usr/local fi git_patch= diff --git a/Toolchain/BuildIt_x86_64.sh b/Toolchain/BuildIt_x86_64.sh index abdf22ce3a..71b1be56b5 100755 --- a/Toolchain/BuildIt_x86_64.sh +++ b/Toolchain/BuildIt_x86_64.sh @@ -28,6 +28,8 @@ elif [ "$(uname -s)" = "FreeBSD" ]; then MAKE=gmake MD5SUM="md5 -q" NPROC="sysctl -n hw.ncpu" + export with_gmp=/usr/local + export with_mpfr=/usr/local fi echo PREFIX is "$PREFIX"