mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 04:13:11 +00:00
Toolchain: Add support for Clang on MacOS
This commit adds Darwin as a possible host for building the toolchain with Clang.
This commit is contained in:
parent
044c70fb46
commit
913511249b
|
@ -16,6 +16,8 @@ MD5SUM="md5sum"
|
||||||
REALPATH="realpath"
|
REALPATH="realpath"
|
||||||
MAKE="make"
|
MAKE="make"
|
||||||
NPROC="nproc"
|
NPROC="nproc"
|
||||||
|
INSTALL="install"
|
||||||
|
SED="sed"
|
||||||
|
|
||||||
SYSTEM_NAME="$(uname -s)"
|
SYSTEM_NAME="$(uname -s)"
|
||||||
|
|
||||||
|
@ -31,6 +33,13 @@ elif [ "$SYSTEM_NAME" = "FreeBSD" ]; then
|
||||||
MD5SUM="md5 -q"
|
MD5SUM="md5 -q"
|
||||||
MAKE="gmake"
|
MAKE="gmake"
|
||||||
NPROC="sysctl -n hw.ncpu"
|
NPROC="sysctl -n hw.ncpu"
|
||||||
|
elif [ "$SYSTEM_NAME" = "Darwin" ]; then
|
||||||
|
MD5SUM="md5 -q"
|
||||||
|
MAKE="make"
|
||||||
|
NPROC="sysctl -n hw.ncpu"
|
||||||
|
REALPATH="grealpath" # GNU coreutils
|
||||||
|
INSTALL="ginstall" # GNU coreutils
|
||||||
|
SED="gsed" # GNU sed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$MAKEJOBS" ]; then
|
if [ -z "$MAKEJOBS" ]; then
|
||||||
|
@ -81,7 +90,7 @@ BINUTILS_BASE_URL="https://ftp.gnu.org/gnu/binutils"
|
||||||
buildstep() {
|
buildstep() {
|
||||||
NAME=$1
|
NAME=$1
|
||||||
shift
|
shift
|
||||||
"$@" 2>&1 | sed $'s|^|\e[34m['"${NAME}"$']\e[39m |'
|
"$@" 2>&1 | "$SED" $'s|^|\e[34m['"${NAME}"$']\e[39m |'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildstep_ninja() {
|
buildstep_ninja() {
|
||||||
|
@ -250,8 +259,8 @@ for arch in $ARCHS; do
|
||||||
pushd "$BUILD/${arch}clang"
|
pushd "$BUILD/${arch}clang"
|
||||||
mkdir -p Root/usr/include/
|
mkdir -p Root/usr/include/
|
||||||
for header in $FILES; do
|
for header in $FILES; do
|
||||||
target=$(echo "$header" | sed -e "s@$SRC_ROOT/Userland/Libraries/LibC@@" -e "s@$SRC_ROOT/Userland/Libraries/LibM@@" -e "s@$SRC_ROOT/Userland/Libraries/LibPthread@@" -e "s@$SRC_ROOT/Userland/Libraries/LibDl@@" -e "s@$SRC_ROOT/Kernel/@Kernel/@")
|
target=$(echo "$header" | "$SED" -e "s@$SRC_ROOT/Userland/Libraries/LibC@@" -e "s@$SRC_ROOT/Userland/Libraries/LibM@@" -e "s@$SRC_ROOT/Userland/Libraries/LibPthread@@" -e "s@$SRC_ROOT/Userland/Libraries/LibDl@@" -e "s@$SRC_ROOT/Kernel/@Kernel/@")
|
||||||
buildstep "system_headers" install -D "$header" "Root/usr/include/$target"
|
buildstep "system_headers" "$INSTALL" -D "$header" "Root/usr/include/$target"
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
@ -299,7 +308,7 @@ pushd "$DIR/Build/clang"
|
||||||
mkdir -p binutils
|
mkdir -p binutils
|
||||||
pushd binutils
|
pushd binutils
|
||||||
buildstep "binutils/configure" "$DIR/Tarballs/$BINUTILS_NAME/configure" --prefix="$PREFIX" \
|
buildstep "binutils/configure" "$DIR/Tarballs/$BINUTILS_NAME/configure" --prefix="$PREFIX" \
|
||||||
--enable-targets="$(echo "$ARCHS" | sed -E "s@(\S)(\s|$)@\1-pc-serenity,@g")" \
|
--enable-targets="$(echo "$ARCHS" | "$SED" -E "s@(\S)(\s|$)@\1-pc-serenity,@g")" \
|
||||||
--program-prefix="gnu-" \
|
--program-prefix="gnu-" \
|
||||||
--disable-nls \
|
--disable-nls \
|
||||||
--disable-gas \
|
--disable-gas \
|
||||||
|
|
|
@ -11,6 +11,10 @@ set(LLVM_ENABLE_RUNTIMES "libcxx;libcxxabi;libunwind" CACHE STRING "")
|
||||||
set(CMAKE_SYSTEM_NAME SerenityOS CACHE STRING "")
|
set(CMAKE_SYSTEM_NAME SerenityOS CACHE STRING "")
|
||||||
set(target_triple ${SERENITY_TOOLCHAIN_ARCH}-pc-serenity)
|
set(target_triple ${SERENITY_TOOLCHAIN_ARCH}-pc-serenity)
|
||||||
|
|
||||||
|
IF(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
|
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
|
||||||
set(LLVM_ENABLE_BINDINGS OFF CACHE BOOL "")
|
set(LLVM_ENABLE_BINDINGS OFF CACHE BOOL "")
|
||||||
set(LLVM_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
|
set(LLVM_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
|
||||||
|
|
Loading…
Reference in a new issue