summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rwxr-xr-xbuild.sh4
-rwxr-xr-xsrc/pal/tools/gen-buildsys-clang.sh18
3 files changed, 23 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e44374131..09f33018f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> -o <OBJECT> -c <SOURCE>")
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+ set(CLR_CMAKE_PLATFORM_UNIX 1)
+ set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
+ set(CLR_CMAKE_PLATFORM_FREEBSD 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+
if(WIN32)
enable_language(ASM_MASM)
else()
diff --git a/build.sh b/build.sh
index f1d6d83626..57bc5786d4 100755
--- a/build.sh
+++ b/build.sh
@@ -99,6 +99,10 @@ case $OSName in
__BuildOS=mac
;;
+ FreeBSD)
+ __BuildOS=freebsd
+ ;;
+
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
__BuildOS=linux
diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh
index 321248ce1c..0bfb051d60 100755
--- a/src/pal/tools/gen-buildsys-clang.sh
+++ b/src/pal/tools/gen-buildsys-clang.sh
@@ -30,8 +30,10 @@ OS=`uname`
# This can be a little complicated, because the common use-case of Ubuntu with
# llvm-3.5 installed uses a rather unusual llvm installation with the version
# number postfixed (i.e. llvm-ar-3.5), so we check for that first.
+# On FreeBSD the version number is appended without point and dash (i.e.
+# llvm-ar35).
# Additionally, OSX doesn't use the llvm- prefix.
-if [ $OS = "Linux" ]; then
+if [ $OS = "Linux" -o $OS = "FreeBSD" ]; then
llvm_prefix="llvm-"
elif [ $OS = "Darwin" ]; then
llvm_prefix=""
@@ -40,11 +42,17 @@ else
exit 1
fi
-desired_llvm_version=3.5
+desired_llvm_major_version=3
+desired_llvm_minor_version=5
+if [ $OS = "FreeBSD" ]; then
+ desired_llvm_version="$desired_llvm_major_version$desired_llvm_minor_version"
+else
+ desired_llvm_version="-$desired_llvm_major_version.$desired_llvm_minor_version"
+fi
locate_llvm_exec() {
- if which "$llvm_prefix$1-$desired_llvm_version" > /dev/null 2>&1
+ if which "$llvm_prefix$1$desired_llvm_version" > /dev/null 2>&1
then
- echo "$(which $llvm_prefix$1-$desired_llvm_version)"
+ echo "$(which $llvm_prefix$1$desired_llvm_version)"
elif which "$1" > /dev/null 2>&1
then
echo "$(which $1)"
@@ -60,7 +68,7 @@ llvm_nm="$(locate_llvm_exec nm)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-nm"; exit 1; }
llvm_ranlib="$(locate_llvm_exec ranlib)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-ranlib"; exit 1; }
-if [ $OS = "Linux" ]; then
+if [ $OS = "Linux" -o $OS = "FreeBSD" ]; then
llvm_objdump="$(locate_llvm_exec objdump)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-objdump"; exit 1; }
fi