summaryrefslogtreecommitdiff
path: root/scripts/0300-build-bootstrap-gcc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/0300-build-bootstrap-gcc.sh')
-rwxr-xr-xscripts/0300-build-bootstrap-gcc.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/0300-build-bootstrap-gcc.sh b/scripts/0300-build-bootstrap-gcc.sh
new file mode 100755
index 0000000..0e54b3b
--- /dev/null
+++ b/scripts/0300-build-bootstrap-gcc.sh
@@ -0,0 +1,31 @@
+#!/bin/env bash
+
+set -e
+
+mkdir -p /toolchain/gcc/.bootstrap-build && cd /toolchain/gcc
+
+tar xf /downloads/gcc-$GCC_VERSION.tar.xz
+
+cd gcc-$GCC_VERSION
+
+for PATCH in $(ls /patches/gcc-$GCC_VERSION-$TARGET/*.patch); do
+ patch -p0 -i $PATCH
+done
+
+cd /toolchain/gcc/.bootstrap-build
+
+CFLAGS=${CFLAGS/-Werror=format-security/}
+CXXFLAGS=${CXXFLAGS/-Werror=format-security/}
+PATH=/opt/bootstrap/bin:/opt/toolchain/bin:$PATH
+
+../gcc-$GCC_VERSION/configure \
+ --enable-languages=c,c++ \
+ --prefix=/opt/bootstrap \
+ --target=$TARGET \
+ --without-headers
+
+make -j$(nproc) all-gcc
+make install-gcc
+
+make -j$(nproc) all-target-libgcc
+make install-target-libgcc