Build g++.

This commit is contained in:
Andrius Štikonas 2021-07-07 20:10:38 +01:00
parent 3835f1e1aa
commit effa9ba93a
7 changed files with 83 additions and 17 deletions

View File

@ -195,7 +195,7 @@ we patch mes libc.
tcc 0.9.27 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. it using older ``tcc`` because tcc-0.9.27 is not self hosting.
musl 1.1.24 musl 1.1.24
@ -698,7 +698,9 @@ DEFLATE algorithm that is also used in ``gzip``.
gcc 4.7.4 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 libunistring 0.9.10
=================== ===================

View File

@ -3,7 +3,7 @@ SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-or-later SPDX-License-Identifier: GPL-2.0-or-later
This macro does not exist in newer versions of autoconf and is unrequired. 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:39:53.353069610 +1000
+++ m4/po_gl.m4 2021-04-11 18:40:20.422242498 +1000 +++ m4/po_gl.m4 2021-04-11 18:40:20.422242498 +1000

View File

@ -1,10 +1,9 @@
d340fbc8a6db39c17573169b77d480b920f91433dc818fc4ce3f112c58cbcfcc /image/bin/cpp 8f4b1c859ad99f4ef17970dafb4c7b818a4e01744c4a1e7d632c09598bea737d /image/bin/cpp
b267777f9061e0563fe34cd291e9a834bcb6c3fe2b488c40b815055a005692d2 /image/bin/gcc 4b522a12cdc654809e796e41062de1d48458626060ec0fac492f9a4757df38da /image/bin/gcc
8e7bde329795793d2d2f71c5d011376ab93a7673645ea44c0d9aee7e8bb9f058 /image/bin/gcc-ar 8e7bde329795793d2d2f71c5d011376ab93a7673645ea44c0d9aee7e8bb9f058 /image/bin/gcc-ar
ede1d40ad93ab8daf788b1362ce1deb4946865398e991725487f25af66a42bed /image/bin/gcc-nm ede1d40ad93ab8daf788b1362ce1deb4946865398e991725487f25af66a42bed /image/bin/gcc-nm
d93e0b44788e1111073f9ced886e9b41b906075ddcdf73a1cf911cc72b1bcbde /image/bin/gcc-ranlib d93e0b44788e1111073f9ced886e9b41b906075ddcdf73a1cf911cc72b1bcbde /image/bin/gcc-ranlib
1657ba8afdac845ddfa8842efa5e7bf3cfc9be23aa31f6265e3f43eead1316d4 /image/bin/gcov 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 77adc8cb0648cd8b3546254e7277d16a04b18fe643b889352717c361cc8a4309 /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/cc1
a96e1cd5eff7904cfcd260e859a65bf38c45eafe3f81b7df537e0bb68543e856 /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/collect2 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 4dd787d729d8d57434fb7cfaf2a7a42dfca2bdf665e6e5246fb56e4cee0f10fd /image/libexec/gcc/i386-unknown-linux-musl/4.7.4/lto-wrapper
@ -19,3 +18,8 @@ e5059cb3aaec30653dfb2cbc09ee555218d276d6b49b1ddc05ba8c4d63e3edfb /image/lib/mus
412c06a772f2bceaef31514685c7634358b9d7a5e01b30c3b1aef2dd24ad68f9 /image/lib/musl/gcc/i386-unknown-linux-musl/4.7.4/crtprec80.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 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 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

View File

@ -6,12 +6,9 @@
src_prepare() { src_prepare() {
default default
# Needs gperf # Generated using gperf
rm gcc/cp/cfns.h 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, # Regenerating top level Makefile requires GNU Autogen and hence Guile,
# but it is not essential for building gcc. # but it is not essential for building gcc.
rm configure Makefile.in fixincludes/fixincl.x rm configure Makefile.in fixincludes/fixincl.x
@ -26,21 +23,24 @@ src_prepare() {
done done
cd gcc cd gcc
rm aclocal.m4 rm aclocal.m4
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config #AM_PROG_CC_C_O AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config
cd .. cd ..
cd fixincludes cd fixincludes
rm aclocal.m4 rm aclocal.m4
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../gcc AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../gcc
cd .. cd ..
#libjava warning for dir in boehm-gc libffi libgfortran libgo libgomp libitm libjava libmudflap libobjc libquadmath libssp lto-plugin zlib; do
for dir in boehm-gc libffi libgfortran libgo libgomp libitm libjava libmudflap libobjc libquadmath libssp libstdc++-v3 lto-plugin zlib; do
cd $dir cd $dir
rm aclocal.m4 rm aclocal.m4
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11
cd .. cd ..
done 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 # 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 for dir in $(ls */configure | sed 's#/configure##' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do
cd $dir cd $dir
rm configure rm configure
@ -49,6 +49,7 @@ src_prepare() {
done done
# Regenerate Makefile.in # 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 for dir in $(ls */Makefile.am | sed 's#/Makefile.am##' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do
cd $dir cd $dir
rm Makefile.in rm Makefile.in
@ -85,7 +86,7 @@ src_configure() {
mkdir build mkdir build
cd build cd build
for dir in libiberty libcpp libdecnumber gcc libgcc; do for dir in libiberty libcpp libdecnumber gcc libgcc libstdc++-v3; do
mkdir $dir mkdir $dir
cd $dir cd $dir
../../$dir/configure \ ../../$dir/configure \
@ -95,7 +96,9 @@ src_configure() {
--target=i386-unknown-linux-musl \ --target=i386-unknown-linux-musl \
--host=i386-unknown-linux-musl \ --host=i386-unknown-linux-musl \
--disable-shared \ --disable-shared \
--program-transform-name= --program-transform-name= \
--enable-languages=c,c++ \
--disable-sjlj-exceptions
cd .. cd ..
done done
cd .. cd ..
@ -112,9 +115,13 @@ src_compile() {
# host_subdir is necessary because we have slightly different build directory layout # host_subdir is necessary because we have slightly different build directory layout
make -C build/libgcc PATH="${PATH}:../gcc" CC=../gcc/xgcc \ make -C build/libgcc PATH="${PATH}:../gcc" CC=../gcc/xgcc \
host_subdir=build CFLAGS="-I../gcc/include -I/${PREFIX}/include" 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() { src_install() {
make -C build/gcc install STMP_FIXINC= DESTDIR="${DESTDIR}" MAKEINFO=true make -C build/gcc install STMP_FIXINC= DESTDIR="${DESTDIR}" MAKEINFO=true
make -C build/libgcc install DESTDIR="${DESTDIR}" host_subdir=build make -C build/libgcc install DESTDIR="${DESTDIR}" host_subdir=build
make -C build/libstdc++-v3 install DESTDIR="${DESTDIR}"
} }

View File

@ -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"

View File

@ -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 \

View File

@ -60,7 +60,7 @@ build texinfo-6.7
build zlib-1.2.11 build zlib-1.2.11
build gcc-4.7.4 pass1.sh checksums/pass1 build gcc-4.7.4
build libunistring-0.9.10 build libunistring-0.9.10