summaryrefslogtreecommitdiff
path: root/Toolchain
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-05-06 18:40:06 +0300
committerAndreas Kling <kling@serenityos.org>2020-05-14 20:15:18 +0200
commit450a2a0f9ce2443bc06445ee018c9860d8cd5fc8 (patch)
treec124a612ef259b764855af5e33c39e0d09ad4df2 /Toolchain
parent49727ffee424d8c0038ce18b91b0bf0ff33b1a4d (diff)
downloadserenity-450a2a0f9ce2443bc06445ee018c9860d8cd5fc8.zip
Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
Diffstat (limited to 'Toolchain')
-rwxr-xr-xToolchain/BuildIt.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh
index 17d4f34484..24a7ce9658 100755
--- a/Toolchain/BuildIt.sh
+++ b/Toolchain/BuildIt.sh
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -e
+shopt -s globstar
# This file will need to be run in bash, for now.
@@ -12,7 +13,8 @@ echo "$DIR"
ARCH=${ARCH:-"i686"}
TARGET="$ARCH-pc-serenity"
PREFIX="$DIR/Local"
-SYSROOT="$DIR/../Root"
+BUILD=$(realpath "$DIR/../Build")
+SYSROOT="$BUILD/Root"
MAKE="make"
MD5SUM="md5sum"
@@ -225,8 +227,18 @@ pushd "$DIR/Build/"
"$MAKE" install-gcc install-target-libgcc || exit 1
echo "XXX serenity libc and libm"
- ( cd "$DIR/../Libraries/LibC/" && "$MAKE" clean && "$MAKE" EXTRA_LIBC_DEFINES="-DBUILDING_SERENITY_TOOLCHAIN" && "$MAKE" install )
- ( cd "$DIR/../Libraries/LibM/" && "$MAKE" clean && "$MAKE" && "$MAKE" install )
+ mkdir -p "$BUILD"
+ pushd "$BUILD"
+ CXXFLAGS="-DBUILDING_SERENITY_TOOLCHAIN" cmake ..
+ "$MAKE" LibC
+ install -D Libraries/LibC/libc.a Libraries/LibM/libm.a Root/usr/lib/
+ SRC_ROOT=$(realpath "$DIR"/..)
+ for header in "$SRC_ROOT"/Libraries/Lib{C,M}/**/*.h; do
+ target=$(echo "$header" | sed -e "s@$SRC_ROOT/Libraries/LibC@@" -e "s@$SRC_ROOT/Libraries/LibM@@")
+ install -D "$header" "Root/usr/include/$target"
+ done
+ unset SRC_ROOT
+ popd
echo "XXX build libstdc++"
"$MAKE" all-target-libstdc++-v3 || exit 1
@@ -236,6 +248,7 @@ pushd "$DIR/Build/"
if [ "$(uname -s)" = "OpenBSD" ]; then
cd "$DIR/Local/libexec/gcc/i686-pc-serenity/$GCC_VERSION" && ln -sf liblto_plugin.so.0.0 liblto_plugin.so
fi
+
popd
popd