diff options
| author | Oxore <oxore@protonmail.com> | 2022-06-18 19:35:55 +0300 |
|---|---|---|
| committer | Oxore <oxore@protonmail.com> | 2022-06-18 19:35:55 +0300 |
| commit | 5cddfc7214117a2a8e5c4a11429a33dde50edd19 (patch) | |
| tree | c67bd4ac20c3ae30e8186c957261fb6fde19ffc9 | |
| parent | b875d19191f659f88b8c43a7f08bf6df740b07c7 (diff) | |
Finally a working compiler with newlib
| -rw-r--r-- | 3-build-binutils.sh | 10 | ||||
| -rw-r--r-- | 4-build-gcc-stage-1.sh | 42 | ||||
| -rw-r--r-- | 5-build-newlib.sh | 10 | ||||
| -rw-r--r-- | 6-build-gcc-stage-2.sh | 17 | ||||
| -rw-r--r-- | common | 2 |
5 files changed, 45 insertions, 36 deletions
diff --git a/3-build-binutils.sh b/3-build-binutils.sh index 191f3e9..f3f6610 100644 --- a/3-build-binutils.sh +++ b/3-build-binutils.sh @@ -1,16 +1,18 @@ #!/bin/sh -set -e source ./common mkdir -p build/binutils-$binutils_ver cd build/binutils-$binutils_ver echo "Configuring binutils-${binutils_ver}" ../../unpacked/binutils-$binutils_ver/configure --prefix=$prefix_dir --target=$target --disable-multilib >configure.log 2>&1 -if [ ! $? ]; then less configure.log; exit; fi +ret=$? +if [ $ret -ne 0 ]; then less configure.log; exit 1; fi echo "Building binutils-$binutils_ver" make -j$jobs >build.log 2>&1 -if [ ! $? ]; then less build.log; exit; fi +ret=$? +if [ $ret -ne 0 ]; then less build.log; exit 1; fi echo "Installing binutils-$binutils_ver" make install >install.log 2>&1 -if [ ! $? ]; then less install.log; exit; fi +ret=$? +if [ $ret -ne 0 ]; then less install.log; exit 1; fi echo Done with binutils-$binutils_ver 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)" diff --git a/5-build-newlib.sh b/5-build-newlib.sh index 5c4429b..ddbc704 100644 --- a/5-build-newlib.sh +++ b/5-build-newlib.sh @@ -1,5 +1,4 @@ #!/bin/sh -set -e source ./common export PATH="$prefix_dir/bin:${PATH:+:${PATH}}" @@ -7,11 +6,14 @@ mkdir -p build/newlib-$newlib_ver cd build/newlib-$newlib_ver echo "Configuring newlib-${newlib_ver}" ../../unpacked/newlib-$newlib_ver/configure --prefix=$prefix_dir --target=$target >configure.log 2>&1 -if [ ! $? ]; then less configure.log; exit; fi +ret=$? +if [ $ret -ne 0 ]; then less configure.log; exit 1; fi echo "Building newlib-$newlib_ver" make -j$jobs >build.log 2>&1 -if [ ! $? ]; then less build.log; exit; fi +ret=$? +if [ $ret -ne 0 ]; then less build.log; exit 1; fi echo "Installing newlib-$newlib_ver" make install >install.log 2>&1 -if [ ! $? ]; then less install.log; exit; fi +ret=$? +if [ $ret -ne 0 ]; then less install.log; exit 1; fi echo "Done with newlib-$newlib_ver" diff --git a/6-build-gcc-stage-2.sh b/6-build-gcc-stage-2.sh deleted file mode 100644 index 3c39d46..0000000 --- a/6-build-gcc-stage-2.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -set -e -source ./common -export PATH="$prefix_dir/bin:${PATH:+:${PATH}}" - -mkdir -p build/gcc-$gcc_ver-stage-2 -cd build/gcc-$gcc_ver-stage-2 -echo "Configuring gcc-${gcc_ver} (stage 2)" -../../unpacked/gcc-$gcc_ver/configure --prefix=$prefix_dir --target=$target --enable-languages=c,c++ >configure-stage-2.log 2>&1 -if [ ! $? ]; then less configure-stage-2.log; exit; fi -echo "Building gcc-$gcc_ver (stage 2)" -make -j$jobs all-gcc >build-stage-2.log 2>&1 -if [ ! $? ]; then less build-stage-2.log; exit; fi -echo "Installing gcc-$gcc_ver (stage 2)" -make install-gcc >install-stage-2.log 2>&1 -if [ ! $? ]; then less install-stage-2.log; exit; fi -echo "Done with gcc-$gcc_ver (stage 2)" @@ -6,6 +6,6 @@ gmp_ver=6.2.1 mpc_ver=1.2.1 isl_ver=0.24 cloog_ver=0.18.1 -target=mips-elf +target=mipsel-elf prefix_dir=$(pwd)/prefix-${target}-toolchain jobs=12 |
