Port to FreeBSD.
--
Change-Id: I4e65cc583e758d2f7e45209ffcb37f6a871e2ed7
Reviewed-on: https://bazel-review.git.corp.google.com/#/c/1840
MOS_MIGRATED_REVID=101462155
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 1715316..1dbc287 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -68,8 +68,13 @@
ZIPOPTS="$ZIPOPTS"
# TODO: CC target architecture needs to match JAVA_HOME.
-CC=${CC:-gcc}
-CXX=${CXX:-g++}
+if [ "${PLATFORM}" = "freebsd" ]; then
+ CC=${CC:-clang}
+ CXX=${CXX:-clang++}
+else
+ CC=${CC:-gcc}
+ CXX=${CXX:-g++}
+fi
CXXSTD="c++0x"
unset JAVA_TOOL_OPTIONS
@@ -101,6 +106,18 @@
fi
;;
+freebsd)
+ LDFLAGS="-lprocstat -lz -lrt $LDFLAGS"
+ JNILIB="libunix.so"
+ MD5SUM="md5sum"
+ # JAVA_HOME must point to a Java installation.
+ JAVA_HOME="${JAVA_HOME:-/usr/local/openjdk8}"
+ # Note: the linux protoc binary works on freebsd using linux emulation.
+ # We choose the 32-bit version for maximum compatiblity since 64-bit
+ # linux binaries are only supported in FreeBSD-11.
+ PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_32.exe}
+ ;;
+
darwin)
JNILIB="libunix.dylib"
MD5SUM="md5"