2021-07-01 19:59:10 +01:00
|
|
|
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
2023-01-27 06:01:03 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
2021-07-01 19:59:10 +01:00
|
|
|
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
src_prepare() {
|
|
|
|
default
|
|
|
|
|
2021-07-07 20:10:38 +01:00
|
|
|
# Generated using gperf
|
2021-07-06 00:13:58 +01:00
|
|
|
rm gcc/cp/cfns.h
|
|
|
|
|
2021-07-01 19:59:10 +01:00
|
|
|
# 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
|
|
|
|
|
2022-09-04 09:11:28 +01:00
|
|
|
# Remove unused generated files
|
|
|
|
rm libgo/aclocal.m4 libgo/configure libgo/Makefile.in
|
|
|
|
|
2021-07-01 19:59:10 +01:00
|
|
|
# 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
|
2021-07-07 20:10:38 +01:00
|
|
|
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config
|
2021-07-01 19:59:10 +01:00
|
|
|
cd ..
|
|
|
|
cd fixincludes
|
|
|
|
rm aclocal.m4
|
|
|
|
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../gcc
|
|
|
|
cd ..
|
2022-09-04 09:11:28 +01:00
|
|
|
for dir in boehm-gc libffi libgfortran libgomp libitm libjava libmudflap libobjc libquadmath libssp lto-plugin zlib; do
|
2021-07-01 19:59:10 +01:00
|
|
|
cd $dir
|
|
|
|
rm aclocal.m4
|
|
|
|
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11
|
|
|
|
cd ..
|
|
|
|
done
|
2022-09-04 09:11:28 +01:00
|
|
|
|
2021-07-07 20:10:38 +01:00
|
|
|
cd libstdc++-v3
|
|
|
|
ACLOCAL=aclocal-1.11 AUTOMAKE=automake-1.11 AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 autoreconf-2.64 -fi
|
|
|
|
cd ..
|
2022-09-04 09:11:28 +01:00
|
|
|
|
2021-07-01 19:59:10 +01:00
|
|
|
# Regenerate configure scripts
|
2021-07-07 20:10:38 +01:00
|
|
|
# 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)
|
2022-09-04 09:11:28 +01:00
|
|
|
for dir in $(find . -mindepth 2 -maxdepth 2 -name configure.ac | sed 's#/configure.ac##' | grep -v -x './libgo' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do
|
2022-05-09 19:55:26 +01:00
|
|
|
pushd "$dir"
|
2021-07-01 19:59:10 +01:00
|
|
|
rm configure
|
|
|
|
autoconf-2.64 || autoconf-2.64
|
2022-05-09 19:55:26 +01:00
|
|
|
popd
|
2021-07-01 19:59:10 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
# Regenerate Makefile.in
|
2021-07-07 20:10:38 +01:00
|
|
|
# Find all folders with Makefile.am and rebuild them. At the moment we exclude boehm-gc folder.
|
2022-09-04 09:11:28 +01:00
|
|
|
for dir in $(find . -mindepth 2 -maxdepth 2 -name Makefile.am | sed 's#/Makefile.am##' | grep -v -x './libgo' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do
|
2022-05-09 19:55:26 +01:00
|
|
|
pushd "$dir"
|
2021-07-01 19:59:10 +01:00
|
|
|
rm Makefile.in
|
2022-09-04 12:00:45 +01:00
|
|
|
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 automake-1.11 --add-missing
|
2022-05-09 19:55:26 +01:00
|
|
|
popd
|
2021-07-01 19:59:10 +01:00
|
|
|
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
|
2022-05-09 19:55:26 +01:00
|
|
|
cp "${PREFIX}/share/automake-1.15/config.sub" .
|
2021-07-01 19:59:10 +01:00
|
|
|
|
|
|
|
# Workaround for bison being too new
|
|
|
|
rm intl/plural.c
|
|
|
|
|
|
|
|
# Rebuild flex generated files
|
|
|
|
rm gcc/gengtype-lex.c
|
|
|
|
|
2023-02-13 11:15:58 +00:00
|
|
|
# Regenerate crc table in libiberty/crc32.c
|
|
|
|
pushd libiberty
|
|
|
|
sed -n -e '39,66p' crc32.c > crcgen.c
|
|
|
|
gcc -o crcgen crcgen.c
|
|
|
|
head -n 70 crc32.c > crc32.c.new
|
|
|
|
./crcgen >> crc32.c.new
|
|
|
|
tail -n +139 crc32.c >> crc32.c.new
|
|
|
|
mv crc32.c.new crc32.c
|
|
|
|
popd
|
|
|
|
|
2021-07-01 19:59:10 +01:00
|
|
|
# Remove translation catalogs
|
|
|
|
find . -name '*.gmo' -delete
|
|
|
|
|
|
|
|
# Pre-built texinfo files
|
|
|
|
find . -name '*.info' -delete
|
|
|
|
}
|
|
|
|
|
|
|
|
src_configure() {
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
2021-07-07 20:10:38 +01:00
|
|
|
for dir in libiberty libcpp libdecnumber gcc libgcc libstdc++-v3; do
|
2021-07-01 19:59:10 +01:00
|
|
|
mkdir $dir
|
|
|
|
cd $dir
|
|
|
|
../../$dir/configure \
|
|
|
|
--prefix="${PREFIX}" \
|
2022-09-14 13:07:13 +01:00
|
|
|
--libdir="${LIBDIR}" \
|
2021-07-06 00:13:58 +01:00
|
|
|
--build=i386-unknown-linux-musl \
|
|
|
|
--target=i386-unknown-linux-musl \
|
|
|
|
--host=i386-unknown-linux-musl \
|
2021-07-01 19:59:10 +01:00
|
|
|
--disable-shared \
|
2021-07-07 20:10:38 +01:00
|
|
|
--program-transform-name= \
|
|
|
|
--enable-languages=c,c++ \
|
2023-01-27 06:01:03 +00:00
|
|
|
--disable-sjlj-exceptions \
|
|
|
|
--with-system-zlib
|
2021-07-01 19:59:10 +01:00
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
}
|
|
|
|
|
|
|
|
src_compile() {
|
2021-07-06 00:13:58 +01:00
|
|
|
ln -s . build/build-i386-unknown-linux-musl
|
2021-07-01 19:59:10 +01:00
|
|
|
for dir in libiberty libcpp libdecnumber gcc; do
|
|
|
|
# We have makeinfo now but it is not happy with gcc .info files, so skip it
|
2023-04-10 06:30:16 +01:00
|
|
|
make "${MAKEJOBS}" -C build/$dir LIBGCC2_INCLUDES=-I"${PREFIX}/include" \
|
2021-08-05 13:16:19 +01:00
|
|
|
STMP_FIXINC= GMPLIBS="-lmpc -lmpfr -lgmp" MAKEINFO=true
|
2021-07-01 19:59:10 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
# host_subdir is necessary because we have slightly different build directory layout
|
2023-04-10 06:30:16 +01:00
|
|
|
make "${MAKEJOBS}" -C build/libgcc PATH="${PATH}:../gcc" CC=../gcc/xgcc \
|
2021-08-05 13:16:19 +01:00
|
|
|
host_subdir=build CFLAGS="-I../gcc/include -I/${PREFIX}/include"
|
2021-07-07 20:10:38 +01:00
|
|
|
|
2023-04-10 06:30:16 +01:00
|
|
|
make "${MAKEJOBS}" -C build/libstdc++-v3 PATH="${PATH}:${PWD}/build/gcc" \
|
2021-08-05 13:16:19 +01:00
|
|
|
CXXFLAGS="-I${PWD}/build/gcc/include -I ${PREFIX}/include"
|
2021-07-01 19:59:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
|
|
|
make -C build/gcc install STMP_FIXINC= DESTDIR="${DESTDIR}" MAKEINFO=true
|
|
|
|
make -C build/libgcc install DESTDIR="${DESTDIR}" host_subdir=build
|
2021-07-07 20:10:38 +01:00
|
|
|
make -C build/libstdc++-v3 install DESTDIR="${DESTDIR}"
|
2022-09-02 16:18:50 +01:00
|
|
|
ln -s gcc "${DESTDIR}${PREFIX}/bin/cc"
|
2022-09-14 13:07:13 +01:00
|
|
|
cp gcc/gsyslimits.h "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/include/syslimits.h"
|
2022-09-02 16:18:50 +01:00
|
|
|
|
2022-01-14 11:00:35 +00:00
|
|
|
# Very strange mis-versoning error
|
2022-09-14 13:07:13 +01:00
|
|
|
mkdir -p "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/include/"
|
|
|
|
mv "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.0.4/include/"* "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/include/"
|
|
|
|
rmdir "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.0.4/include"
|
|
|
|
mv "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.0.4/"* "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/"
|
2021-07-01 19:59:10 +01:00
|
|
|
}
|