summaryrefslogtreecommitdiff
path: root/tools/build-toolchain.sh
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-11-15 13:32:41 -0500
committerIan Moffett <ian@osmora.org>2025-11-15 13:32:41 -0500
commitfa3c60da8207b724d292b7a44633872c6bfec4c8 (patch)
tree195af6554fe5ead88cda54a8361963666c923251 /tools/build-toolchain.sh
initial commit
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'tools/build-toolchain.sh')
-rw-r--r--tools/build-toolchain.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/build-toolchain.sh b/tools/build-toolchain.sh
new file mode 100644
index 0000000..580aafc
--- /dev/null
+++ b/tools/build-toolchain.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+TARGET=x86_64-pc-osmora
+MAKE=make
+
+# Don't build again if the lock exists
+if [[ -f cc/.lock ]]
+then
+ echo "cc/.lock exists, skipping toolchain build"
+ exit 1
+fi
+
+# Build binutils and patch gcc
+cd cc/toolchain/
+bash build.sh
+
+# Prep the build directory
+cd ../
+mkdir -p gcc
+cd gcc/
+
+# Configure gcc
+../toolchain/gcc-patched/configure --target=$TARGET \
+ --prefix=$(pwd) --with-sysroot=$(pwd)/../../root/ \
+ --disable-nls --enable-languages=c --disable-multilib
+
+# Build gcc
+$MAKE all-gcc
+$MAKE install-gcc
+
+# Lock the directory
+cd ../
+touch .lock