summaryrefslogtreecommitdiff
path: root/4-build-gcc-stage-1.sh
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2022-06-18 19:35:55 +0300
committerOxore <oxore@protonmail.com>2022-06-18 19:35:55 +0300
commit5cddfc7214117a2a8e5c4a11429a33dde50edd19 (patch)
treec67bd4ac20c3ae30e8186c957261fb6fde19ffc9 /4-build-gcc-stage-1.sh
parentb875d19191f659f88b8c43a7f08bf6df740b07c7 (diff)
Finally a working compiler with newlib
Diffstat (limited to '4-build-gcc-stage-1.sh')
-rw-r--r--4-build-gcc-stage-1.sh42
1 files changed, 32 insertions, 10 deletions
diff --git a/4-build-gcc-stage-1.sh b/4-build-gcc-stage-1.sh
index a944a94..cdcfe95 100644
--- a/4-build-gcc-stage-1.sh
+++ b/4-build-gcc-stage-1.sh
@@ -1,17 +1,39 @@
#!/bin/sh
-set -e
source ./common
-export PATH="$prefix_dir/bin:${PATH:+:${PATH}}"
-mkdir -p build/gcc-$gcc_ver-stage-1
-cd build/gcc-$gcc_ver-stage-1
+ln -Tsfrv unpacked/mpc-$mpc_ver unpacked/gcc-$gcc_ver/mpc
+ln -Tsfrv unpacked/mpfr-$mpfr_ver unpacked/gcc-$gcc_ver/mpfr
+ln -Tsfrv unpacked/isl-$isl_ver unpacked/gcc-$gcc_ver/isl
+mkdir -p build/gcc-$gcc_ver
+cd build/gcc-$gcc_ver
echo "Configuring gcc-${gcc_ver} (stage 1)"
-../../unpacked/gcc-$gcc_ver/configure --prefix=$prefix_dir --target=$target --disable-multilib --enable-languages=c,c++ >configure.log 2>&1
-if [ ! $? ]; then less configure.log; exit; fi
+# See https://gist.githubusercontent.com/lirenlin/a40d4b510799fa31acba/raw/0b6d0bc74b21661f6cbbcfbda86b3fea25b5ce77/build-gcc.md
+../../unpacked/gcc-$gcc_ver/configure \
+ --prefix=$prefix_dir \
+ --target=$target \
+ --with-newlib \
+ --with-gnu-as \
+ --with-gnu-ld \
+ --enable-lto \
+ --enable-linker-build-id \
+ --disable-libmudflap \
+ --disable-libgomp \
+ --disable-libssp \
+ --disable-libstdcxx-pch \
+ --enable-multiarch \
+ --disable-multilib \
+ --enable-languages=c,c++ \
+ --with-headers=../../unpacked/newlib-$newlib_ver/newlib/libc/include \
+ --disable-shared \
+ >configure-stage-1.log 2>&1
+ret=$?
+if [ $ret -ne 0 ]; then less configure-stage-1.log; exit 1; fi
echo "Building gcc-$gcc_ver (stage 1)"
-make -j$jobs all-gcc >build.log 2>&1
-if [ ! $? ]; then less build.log; exit; fi
+make -j$jobs all >build-stage-1.log 2>&1
+ret=$?
+if [ $ret -ne 0 ]; then less build-stage-1.log; exit 1; fi
echo "Installing gcc-$gcc_ver (stage 1)"
-make install-gcc >install.log 2>&1
-if [ ! $? ]; then less install.log; exit; fi
+make install >install-stage-1.log 2>&1
+ret=$?
+if [ $ret -ne 0 ]; then less install-stage-1.log; exit 1; fi
echo "Done with gcc-$gcc_ver (stage 1)"