summaryrefslogtreecommitdiff
path: root/Meta/build-root-filesystem.sh
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-07-31 15:54:48 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-08 10:55:36 +0200
commit15e217ea68f5f83f953ff6c41a7c2529704f1f11 (patch)
tree3b6729696b01fa96ae0c9f9135d50343f813e627 /Meta/build-root-filesystem.sh
parent5d617be462d7ec01eb845cf34914bbdbf796201c (diff)
downloadserenity-15e217ea68f5f83f953ff6c41a7c2529704f1f11.zip
Toolchain: Add LLVM patch and script for building it
This contains all the bits and pieces necessary to build a Clang binary that will correctly compile SerenityOS. I had some trouble with getting LLVM building with a single command, so for now, I decided to build each LLVM component in a separate command invocation. In the future, we can also make the main llvm build step architecture-independent, but that would come with extra work to make library and include paths work. The binutils build invocation and related boilerplate is duplicated because we only use `objdump` from GNU binutils in the Clang toolchain, so most features can be disabled.
Diffstat (limited to 'Meta/build-root-filesystem.sh')
-rwxr-xr-xMeta/build-root-filesystem.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/Meta/build-root-filesystem.sh b/Meta/build-root-filesystem.sh
index 64006129de..bdd571f69c 100755
--- a/Meta/build-root-filesystem.sh
+++ b/Meta/build-root-filesystem.sh
@@ -45,7 +45,18 @@ else
chown -R 0:0 mnt/
fi
SERENITY_ARCH="${SERENITY_ARCH:-i686}"
-$CP "$SERENITY_SOURCE_DIR"/Toolchain/Local/"$SERENITY_ARCH"/"$SERENITY_ARCH"-pc-serenity/lib/libgcc_s.so mnt/usr/lib/
+LLVM_VERSION="${LLVM_VERSION:-12.0.1}"
+
+if [ "$USE_CLANG_TOOLCHAIN" = "ON" ]; then
+ TOOLCHAIN_DIR="$SERENITY_SOURCE_DIR"/Toolchain/Local/clang/"$SERENITY_ARCH"
+ mkdir -p mnt/usr/lib/clang/"$LLVM_VERSION"/lib/serenity
+ $CP "$TOOLCHAIN_DIR"/lib/clang/"$LLVM_VERSION"/lib/serenity/* mnt/usr/lib/clang/"$LLVM_VERSION"/lib/serenity
+ $CP "$TOOLCHAIN_DIR"/lib/libunwind* mnt/usr/lib
+ $CP "$TOOLCHAIN_DIR"/lib/libc++* mnt/usr/lib
+else
+ $CP "$SERENITY_SOURCE_DIR"/Toolchain/Local/"$SERENITY_ARCH"/"$SERENITY_ARCH"-pc-serenity/lib/libgcc_s.so mnt/usr/lib
+fi
+
# If umask was 027 or similar when the repo was cloned,
# file permissions in Base/ are too restrictive. Restore
# the permissions needed in the image.