logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>
commit: effa9ba93ac52551b25d1a04b66191f13a8829dc
parent 3835f1e1aaaf54f8c8504a8e08c2f4be9547af77
Author: Andrius Štikonas <andrius@stikonas.eu>
Date:   Wed,  7 Jul 2021 20:10:38 +0100

Build g++.

Diffstat:

Mparts.rst6++++--
Msysa/bison-2.3/patches/autover-mismatch.patch2+-
Asysa/gcc-4.7.4/checksums25+++++++++++++++++++++++++
Dsysa/gcc-4.7.4/checksums/pass121---------------------
Asysa/gcc-4.7.4/gcc-4.7.4.sh127+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsysa/gcc-4.7.4/pass1.sh120-------------------------------------------------------------------------------
Asysa/gcc-4.7.4/patches/libstdc++-v3_musl.patch17+++++++++++++++++
Asysa/gcc-4.7.4/patches/remove_gperf_dependency.patch36++++++++++++++++++++++++++++++++++++
Msysa/run2.sh2+-
9 files changed, 211 insertions(+), 145 deletions(-)

diff --git a/parts.rst b/parts.rst @@ -195,7 +195,7 @@ we patch mes libc. tcc 0.9.27 ========== -Rebuild tcc 0.9.27 to get the fix from patches mes libc. We have to do +Rebuild tcc 0.9.27 to get the fix from patched mes libc. We have to do it using older ``tcc`` because tcc-0.9.27 is not self hosting. musl 1.1.24 @@ -698,7 +698,9 @@ DEFLATE algorithm that is also used in ``gzip``. gcc 4.7.4 ========= -GCC 4.7.4 is the last version written in C. +GCC 4.7.4 is the last version written in C. This time we build both C and C++ backends. +C++ backend has some dependency on ``gperf`` which is written in C++. Fortunately, it is +easy to patch it out and resulting ``g++`` compiler is capable of building ``gperf``. libunistring 0.9.10 =================== diff --git a/sysa/bison-2.3/patches/autover-mismatch.patch b/sysa/bison-2.3/patches/autover-mismatch.patch @@ -3,7 +3,7 @@ SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space> SPDX-License-Identifier: GPL-2.0-or-later This macro does not exist in newer versions of autoconf and is unrequired. -There is no verion of autoconf supporting this project + gnulib + this macro. +There is no version of autoconf supporting this project + gnulib + this macro. --- m4/po_gl.m4 2021-04-11 18:39:53.353069610 +1000 +++ m4/po_gl.m4 2021-04-11 18:40:20.422242498 +1000 diff --git a/sysa/gcc-4.7.4/checksums b/sysa/gcc-4.7.4/checksums @@ -0,0 +1,25 @@ +8f4b1c859ad99f4ef17970dafb4c7b818a4e01744c4a1e7d632c09598bea737d /image/bin/cpp +4b522a12cdc654809e796e41062de1d48458626060ec0fac492f9a4757df38da /image/bin/gcc +8e7bde329795793d2d2f71c5d011376ab93a7673645ea44c0d9aee7e8bb9f058 /image/bin/gcc-ar +ede1d40ad93ab8daf788b1362ce1deb4946865398e991725487f25af66a42bed /image/bin/gcc-nm +d93e0b44788e1111073f9ced886e9b41b906075ddcdf73a1cf911cc72b1bcbde /image/bin/gcc-ranlib +1657ba8afdac845ddfa8842efa5e7bf3cfc9be23aa31f6265e3f43eead1316d4 /image/bin/gcov +77adc8cb0648cd8b3546254e7277d16a04b18fe643b889352717c361cc8a4309 /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/cc1 +a96e1cd5eff7904cfcd260e859a65bf38c45eafe3f81b7df537e0bb68543e856 /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/collect2 +4dd787d729d8d57434fb7cfaf2a7a42dfca2bdf665e6e5246fb56e4cee0f10fd /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/lto-wrapper +b85d6aabe0ffa30cc2fa1f6a1c899256b4051086c566d9c75299c6b2f6cbd618 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtbegin.o +db6caa96b09785d820b2b5a6fc0e2c49dc1980a18b6a6472aa2ccdb5f38fef57 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtbeginS.o +b85d6aabe0ffa30cc2fa1f6a1c899256b4051086c566d9c75299c6b2f6cbd618 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtbeginT.o +42a533b816b6c060f4269a310112bde2e07329cb3c2fa5b21bbad6d2d03e90b5 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtend.o +e5059cb3aaec30653dfb2cbc09ee555218d276d6b49b1ddc05ba8c4d63e3edfb /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtendS.o +042ed2a9c7c8ea05291f79d30ad6f2bb61a9d1a58494ee835e1cb5473b5b5b4b /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtfastmath.o +135b6793737d181031ac9042fd42c38f7c627468447f9c90f687156968282c6f /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtprec32.o +67ea5a6dc10582c4b4c3f53763c7408874c625e054dc4f7137206a1c927bc0b5 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtprec64.o +412c06a772f2bceaef31514685c7634358b9d7a5e01b30c3b1aef2dd24ad68f9 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtprec80.o +65082b00fb62e18e816e99a533835a5025794907b8f4d8b5075d3a607249ab08 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/libgcc.a +af7c0180e5f5854947414ff8f4dac6dcc8b853cb56e592be367760fd4869829d /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/libgcov.a +f0b8f0639b0d596a6028b2eb4f1b738d2ef41243a652083bbb59ade32d0e5a7f /image/lib/musl/libstdc++.a +9ed64bd654c3a9be96e4d60637a9e65183cd94c32f946d5a88370ee9228f280a /image/lib/musl/libstdc++.a-gdb.py +b82cbc46d5977ba01330dc2091656f13df5391a14afcecc729269ceab7fa7706 /image/lib/musl/libstdc++.la +f209ea28cf192f18817724f462402d5d7c307ed2c5256ffe462e93478b751d4d /image/lib/musl/libsupc++.a +963b895bf80dccc967cde0a03e9de439cad6f25fd912e0e7765cd2924768a5ac /image/lib/musl/libsupc++.la diff --git a/sysa/gcc-4.7.4/checksums/pass1 b/sysa/gcc-4.7.4/checksums/pass1 @@ -1,21 +0,0 @@ -d340fbc8a6db39c17573169b77d480b920f91433dc818fc4ce3f112c58cbcfcc /image/bin/cpp -b267777f9061e0563fe34cd291e9a834bcb6c3fe2b488c40b815055a005692d2 /image/bin/gcc -8e7bde329795793d2d2f71c5d011376ab93a7673645ea44c0d9aee7e8bb9f058 /image/bin/gcc-ar -ede1d40ad93ab8daf788b1362ce1deb4946865398e991725487f25af66a42bed /image/bin/gcc-nm -d93e0b44788e1111073f9ced886e9b41b906075ddcdf73a1cf911cc72b1bcbde /image/bin/gcc-ranlib -1657ba8afdac845ddfa8842efa5e7bf3cfc9be23aa31f6265e3f43eead1316d4 /image/bin/gcov -b267777f9061e0563fe34cd291e9a834bcb6c3fe2b488c40b815055a005692d2 /image/bin/i386-unknown-linux-musl-gcc-4.7.4 -77adc8cb0648cd8b3546254e7277d16a04b18fe643b889352717c361cc8a4309 /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/cc1 -a96e1cd5eff7904cfcd260e859a65bf38c45eafe3f81b7df537e0bb68543e856 /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/collect2 -4dd787d729d8d57434fb7cfaf2a7a42dfca2bdf665e6e5246fb56e4cee0f10fd /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/lto-wrapper -b85d6aabe0ffa30cc2fa1f6a1c899256b4051086c566d9c75299c6b2f6cbd618 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtbegin.o -db6caa96b09785d820b2b5a6fc0e2c49dc1980a18b6a6472aa2ccdb5f38fef57 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtbeginS.o -b85d6aabe0ffa30cc2fa1f6a1c899256b4051086c566d9c75299c6b2f6cbd618 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtbeginT.o -42a533b816b6c060f4269a310112bde2e07329cb3c2fa5b21bbad6d2d03e90b5 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtend.o -e5059cb3aaec30653dfb2cbc09ee555218d276d6b49b1ddc05ba8c4d63e3edfb /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtendS.o -042ed2a9c7c8ea05291f79d30ad6f2bb61a9d1a58494ee835e1cb5473b5b5b4b /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtfastmath.o -135b6793737d181031ac9042fd42c38f7c627468447f9c90f687156968282c6f /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtprec32.o -67ea5a6dc10582c4b4c3f53763c7408874c625e054dc4f7137206a1c927bc0b5 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtprec64.o -412c06a772f2bceaef31514685c7634358b9d7a5e01b30c3b1aef2dd24ad68f9 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtprec80.o -65082b00fb62e18e816e99a533835a5025794907b8f4d8b5075d3a607249ab08 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/libgcc.a -af7c0180e5f5854947414ff8f4dac6dcc8b853cb56e592be367760fd4869829d /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/libgcov.a diff --git a/sysa/gcc-4.7.4/gcc-4.7.4.sh b/sysa/gcc-4.7.4/gcc-4.7.4.sh @@ -0,0 +1,127 @@ +# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu> +# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com> + +# SPDX-License-Identifier: GPL-3.0-or-later + +src_prepare() { + default + + # Generated using gperf + rm gcc/cp/cfns.h + + # Regenerating top level Makefile requires GNU Autogen and hence Guile, + # but it is not essential for building gcc. + rm configure Makefile.in fixincludes/fixincl.x + + # Regenerate aclocal.m4 files + # grep "generated automatically by aclocal" */aclocal.m4 -l | sed -e 's#/aclocal.m4##' | tr "\n" " " | sed -e 's/ $/\n/' + for dir in intl libcpp libdecnumber; do + cd $dir + rm aclocal.m4 + AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config + cd .. + done + cd gcc + rm aclocal.m4 + AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config + cd .. + cd fixincludes + rm aclocal.m4 + AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../gcc + cd .. + for dir in boehm-gc libffi libgfortran libgo libgomp libitm libjava libmudflap libobjc libquadmath libssp lto-plugin zlib; do + cd $dir + rm aclocal.m4 + AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 + cd .. + done + cd libstdc++-v3 + ACLOCAL=aclocal-1.11 AUTOMAKE=automake-1.11 AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 autoreconf-2.64 -fi + cd .. + # Regenerate configure scripts + # Find all folders with configure script and rebuild them. At the moment we exclude boehm-gc folder due to + # an error but we don't use that directory anyway (it's only needed for Objective C) + for dir in $(ls */configure | sed 's#/configure##' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do + cd $dir + rm configure + autoconf-2.64 || autoconf-2.64 + cd .. + done + + # Regenerate Makefile.in + # Find all folders with Makefile.am and rebuild them. At the moment we exclude boehm-gc folder. + for dir in $(ls */Makefile.am | sed 's#/Makefile.am##' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do + cd $dir + rm Makefile.in + AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 automake-1.11 + cd .. + done + + for dir in libdecnumber libcpp libiberty gcc; do + cd $dir + rm -f config.in + autoheader-2.64 + cd .. + done + + # Rebuild libtool files + rm config.guess config.sub ltmain.sh + libtoolize + cp "${PREFIX}/"/share/automake-1.15/config.sub . + + # Workaround for bison being too new + rm intl/plural.c + + # Rebuild flex generated files + rm gcc/gengtype-lex.c + + # Remove translation catalogs + find . -name '*.gmo' -delete + + # Pre-built texinfo files + find . -name '*.info' -delete +} + +src_configure() { + mkdir build + cd build + + for dir in libiberty libcpp libdecnumber gcc libgcc libstdc++-v3; do + mkdir $dir + cd $dir + ../../$dir/configure \ + --prefix="${PREFIX}" \ + --libdir="${PREFIX}"/lib/musl \ + --build=i386-unknown-linux-musl \ + --target=i386-unknown-linux-musl \ + --host=i386-unknown-linux-musl \ + --disable-shared \ + --program-transform-name= \ + --enable-languages=c,c++ \ + --disable-sjlj-exceptions + cd .. + done + cd .. +} + +src_compile() { + ln -s . build/build-i386-unknown-linux-musl + for dir in libiberty libcpp libdecnumber gcc; do + # We have makeinfo now but it is not happy with gcc .info files, so skip it + make -C build/$dir LIBGCC2_INCLUDES=-I"${PREFIX}/include" \ + STMP_FIXINC= GMPLIBS="-lmpc -lmpfr -lgmp" MAKEINFO=true + done + + # host_subdir is necessary because we have slightly different build directory layout + make -C build/libgcc PATH="${PATH}:../gcc" CC=../gcc/xgcc \ + host_subdir=build CFLAGS="-I../gcc/include -I/${PREFIX}/include" + + make -C build/libstdc++-v3 PATH="${PATH}:${PWD}/build/gcc" \ + CXXFLAGS="-I${PWD}/build/gcc/include -I ${PREFIX}/include" +} + +src_install() { + make -C build/gcc install STMP_FIXINC= DESTDIR="${DESTDIR}" MAKEINFO=true + make -C build/libgcc install DESTDIR="${DESTDIR}" host_subdir=build + make -C build/libstdc++-v3 install DESTDIR="${DESTDIR}" +} diff --git a/sysa/gcc-4.7.4/pass1.sh b/sysa/gcc-4.7.4/pass1.sh @@ -1,120 +0,0 @@ -# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu> -# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com> - -# SPDX-License-Identifier: GPL-3.0-or-later - -src_prepare() { - default - - # Needs gperf - rm gcc/cp/cfns.h - - # Needed for musl - # sed -i 's/struct siginfo/siginfo_t/' libgcc/config/i386/linux-unwind.h - - # Regenerating top level Makefile requires GNU Autogen and hence Guile, - # but it is not essential for building gcc. - rm configure Makefile.in fixincludes/fixincl.x - - # Regenerate aclocal.m4 files - # grep "generated automatically by aclocal" */aclocal.m4 -l | sed -e 's#/aclocal.m4##' | tr "\n" " " | sed -e 's/ $/\n/' - for dir in intl libcpp libdecnumber; do - cd $dir - rm aclocal.m4 - AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config - cd .. - done - cd gcc - rm aclocal.m4 - AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config #AM_PROG_CC_C_O - cd .. - cd fixincludes - rm aclocal.m4 - AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../gcc - cd .. - #libjava warning - for dir in boehm-gc libffi libgfortran libgo libgomp libitm libjava libmudflap libobjc libquadmath libssp libstdc++-v3 lto-plugin zlib; do - cd $dir - rm aclocal.m4 - AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 - cd .. - done - - # Regenerate configure scripts - for dir in $(ls */configure | sed 's#/configure##' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do - cd $dir - rm configure - autoconf-2.64 || autoconf-2.64 - cd .. - done - - # Regenerate Makefile.in - for dir in $(ls */Makefile.am | sed 's#/Makefile.am##' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do - cd $dir - rm Makefile.in - AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 automake-1.11 - cd .. - done - - for dir in libdecnumber libcpp libiberty gcc; do - cd $dir - rm -f config.in - autoheader-2.64 - cd .. - done - - # Rebuild libtool files - rm config.guess config.sub ltmain.sh - libtoolize - cp "${PREFIX}/"/share/automake-1.15/config.sub . - - # Workaround for bison being too new - rm intl/plural.c - - # Rebuild flex generated files - rm gcc/gengtype-lex.c - - # Remove translation catalogs - find . -name '*.gmo' -delete - - # Pre-built texinfo files - find . -name '*.info' -delete -} - -src_configure() { - mkdir build - cd build - - for dir in libiberty libcpp libdecnumber gcc libgcc; do - mkdir $dir - cd $dir - ../../$dir/configure \ - --prefix="${PREFIX}" \ - --libdir="${PREFIX}"/lib/musl \ - --build=i386-unknown-linux-musl \ - --target=i386-unknown-linux-musl \ - --host=i386-unknown-linux-musl \ - --disable-shared \ - --program-transform-name= - cd .. - done - cd .. -} - -src_compile() { - ln -s . build/build-i386-unknown-linux-musl - for dir in libiberty libcpp libdecnumber gcc; do - # We have makeinfo now but it is not happy with gcc .info files, so skip it - make -C build/$dir LIBGCC2_INCLUDES=-I"${PREFIX}/include" \ - STMP_FIXINC= GMPLIBS="-lmpc -lmpfr -lgmp" MAKEINFO=true - done - - # host_subdir is necessary because we have slightly different build directory layout - make -C build/libgcc PATH="${PATH}:../gcc" CC=../gcc/xgcc \ - host_subdir=build CFLAGS="-I../gcc/include -I/${PREFIX}/include" -} - -src_install() { - make -C build/gcc install STMP_FIXINC= DESTDIR="${DESTDIR}" MAKEINFO=true - make -C build/libgcc install DESTDIR="${DESTDIR}" host_subdir=build -} diff --git a/sysa/gcc-4.7.4/patches/libstdc++-v3_musl.patch b/sysa/gcc-4.7.4/patches/libstdc++-v3_musl.patch @@ -0,0 +1,17 @@ +SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu> +SPDX-License-Identifier: GPL-3.0-or-later + +Add support for *-linux-musl triplet. + +--- libstdc++-v3/configure.host 2021-07-07 10:00:23.934848223 +0100 ++++ libstdc++-v3/configure.host 2021-07-07 10:00:36.295195348 +0100 +@@ -242,6 +242,9 @@ + freebsd*) + os_include_dir="os/bsd/freebsd" + ;; ++ linux-musl*) ++ os_include_dir="os/generic" ++ ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) + if [ "$uclibc" = "yes" ]; then + os_include_dir="os/uclibc" diff --git a/sysa/gcc-4.7.4/patches/remove_gperf_dependency.patch b/sysa/gcc-4.7.4/patches/remove_gperf_dependency.patch @@ -0,0 +1,36 @@ +SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu> +SPDX-License-Identifier: GPL-3.0-or-later + +Remove dependency on gperf. + +--- gcc/cp/except.c 2021-07-07 18:24:36.561530121 +0100 ++++ gcc/cp/except.c 2021-07-07 18:27:18.035681929 +0100 +@@ -987,8 +987,6 @@ + exception, unless it calls a program-supplied function that + throws an exception. */ + +-#include "cfns.h" +- + int + nothrow_libfn_p (const_tree fn) + { +@@ -1007,7 +1005,7 @@ + unless the system headers are playing rename tricks, and if + they are, we don't want to be confused by them. */ + id = DECL_NAME (fn); +- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id)); ++ return 0; + } + + /* Returns nonzero if an exception of type FROM will be caught by a +--- gcc/cp/Make-lang.in 2021-07-07 18:24:36.571530380 +0100 ++++ gcc/cp/Make-lang.in 2021-07-07 18:26:47.154887799 +0100 +@@ -313,7 +313,7 @@ + cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) convert.h \ + $(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h intl.h + cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \ +- cp/cfns.h $(TREE_INLINE_H) $(TARGET_H) gt-cp-except.h ++ $(TREE_INLINE_H) $(TARGET_H) gt-cp-except.h + cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(TM_P_H) + cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/cp-objcp-common.h \ + toplev.h $(TREE_INLINE_H) pointer-set.h gt-cp-pt.h vecprim.h intl.h \ diff --git a/sysa/run2.sh b/sysa/run2.sh @@ -60,7 +60,7 @@ build texinfo-6.7 build zlib-1.2.11 -build gcc-4.7.4 pass1.sh checksums/pass1 +build gcc-4.7.4 build libunistring-0.9.10