2022-09-04 09:12:21 +01:00
|
|
|
# SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
|
|
|
|
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
2023-02-02 10:28:37 +00:00
|
|
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
2022-09-04 09:12:21 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
src_prepare() {
|
|
|
|
default
|
|
|
|
|
|
|
|
# Remove unused generated files
|
|
|
|
rm etc/Makefile.in etc/configure
|
|
|
|
rm zlib/aclocal.m4 zlib/configure
|
|
|
|
|
2023-04-17 12:39:32 +01:00
|
|
|
# Regenerate top-level (autogen + autotools)
|
|
|
|
autogen Makefile.def
|
|
|
|
ACLOCAL=aclocal-1.15 autoreconf-2.69 -fi
|
|
|
|
|
|
|
|
# Regenerate autoconf
|
2022-09-04 09:12:21 +01:00
|
|
|
for dir in bfd binutils gas gold gprof intl ld libctf libiberty opcodes; do
|
|
|
|
cd $dir
|
2023-04-17 12:39:32 +01:00
|
|
|
ACLOCAL=aclocal-1.15 AUTOMAKE=automake-1.15 autoreconf-2.69 -fi
|
2022-09-04 09:12:21 +01:00
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
|
2023-04-17 12:39:32 +01:00
|
|
|
# Regenerate directories with Makefile.am only
|
|
|
|
pushd gold
|
|
|
|
automake-1.15 -fai testsuite/Makefile
|
|
|
|
popd
|
|
|
|
pushd bfd
|
|
|
|
automake-1.15 -fai doc/Makefile
|
|
|
|
popd
|
|
|
|
|
|
|
|
# intl/ Makefile is a bit broken because of new gettext
|
|
|
|
sed -i 's/@USE_INCLUDED_LIBINTL@/no/' intl/Makefile.in
|
|
|
|
|
|
|
|
# There is no way to add -all-static to libtool LDFLAGS (such a thing doesn't exist)
|
|
|
|
# -all-static is required for static binaries with libtool
|
|
|
|
sed -i 's:\(--mode=link $(CCLD)\):\1 -all-static:' {bfd,binutils,opcodes,ld,libctf,gas,gprof}/Makefile.in
|
2022-09-04 09:12:21 +01:00
|
|
|
|
|
|
|
# Rebuild bison files
|
|
|
|
touch -- */*.y
|
|
|
|
rm binutils/arparse.c binutils/arparse.h
|
|
|
|
rm binutils/defparse.c binutils/defparse.h
|
|
|
|
rm binutils/mcparse.c binutils/mcparse.h
|
|
|
|
rm binutils/rcparse.c binutils/rcparse.h
|
|
|
|
rm binutils/sysinfo.c binutils/sysinfo.h
|
|
|
|
rm gas/config/bfin-parse.c gas/config/bfin-parse.h
|
|
|
|
rm gas/config/loongarch-parse.c gas/config/loongarch-parse.h
|
|
|
|
rm gas/config/m68k-parse.c gas/config/rl78-parse.c
|
|
|
|
rm gas/config/rl78-parse.h gas/config/rx-parse.c
|
|
|
|
rm gas/config/rx-parse.h gas/itbl-parse.c
|
|
|
|
rm gas/itbl-parse.h gold/yyscript.c
|
|
|
|
rm gold/yyscript.h intl/plural.c
|
|
|
|
rm ld/deffilep.c ld/deffilep.h
|
|
|
|
rm ld/ldgram.c ld/ldgram.h
|
|
|
|
|
|
|
|
# Rebuild flex generated files
|
|
|
|
touch -- */*.l */*/*.l
|
|
|
|
rm binutils/arlex.c binutils/deflex.c binutils/syslex.c
|
|
|
|
rm gas/config/bfin-lex.c gas/config/loongarch-lex.c gas/itbl-lex.c
|
|
|
|
rm ld/ldlex.c
|
|
|
|
|
|
|
|
# Remove prebuilt texinfo files
|
|
|
|
find . -type f -name '*.info*' \
|
|
|
|
-not -wholename './binutils/sysroff.info' \
|
|
|
|
-delete
|
|
|
|
|
|
|
|
# Remove pregenerated opcodes files
|
|
|
|
rm opcodes/i386-init.h opcodes/i386-tbl.h
|
|
|
|
rm opcodes/ia64-asmtab.c
|
|
|
|
rm opcodes/z8k-opc.h
|
|
|
|
rm opcodes/aarch64-asm-2.c opcodes/aarch64-opc-2.c opcodes/aarch64-dis-2.c
|
2023-02-26 02:00:50 +00:00
|
|
|
rm $(grep -l 'MACHINE GENERATED' opcodes/*.c opcodes/*.h)
|
2022-09-04 09:12:21 +01:00
|
|
|
|
|
|
|
# Regenerate MeP sections
|
|
|
|
./bfd/mep-relocs.pl
|
2023-02-26 02:00:50 +00:00
|
|
|
|
|
|
|
# Manpages
|
2023-04-27 14:06:50 +01:00
|
|
|
find . -type f \( -name '*.1' -or -name '*.man' \) -delete
|
2022-09-04 09:12:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
src_configure() {
|
2023-04-17 12:39:32 +01:00
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
LDFLAGS="-static" \
|
|
|
|
../configure \
|
|
|
|
--prefix="${PREFIX}" \
|
|
|
|
--libdir="${LIBDIR}" \
|
|
|
|
--build=i386-unknown-linux-musl \
|
|
|
|
--host=i386-unknown-linux-musl \
|
|
|
|
--target=i386-unknown-linux-musl \
|
|
|
|
--enable-static \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-multilib \
|
|
|
|
--disable-plugins \
|
|
|
|
--enable-threads \
|
|
|
|
--enable-64-bit-bfd \
|
|
|
|
--enable-gold \
|
|
|
|
--enable-ld=default \
|
|
|
|
--enable-install-libiberty \
|
|
|
|
--enable-deterministic-archives \
|
|
|
|
--with-system-zlib \
|
|
|
|
--program-prefix="" \
|
|
|
|
--with-sysroot= \
|
|
|
|
--srcdir=..
|
2022-09-04 09:12:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
2023-04-17 12:39:32 +01:00
|
|
|
default
|
2023-01-27 06:00:47 +00:00
|
|
|
|
|
|
|
# Create triplet symlinks
|
|
|
|
pushd "${DESTDIR}${PREFIX}/bin"
|
|
|
|
for f in *; do
|
|
|
|
ln -s "${PREFIX}/bin/${f}" "i386-unknown-linux-musl-${f}"
|
|
|
|
done
|
|
|
|
popd
|
2023-04-29 13:14:39 +01:00
|
|
|
|
|
|
|
# FIXME: Binutils' manpages dates are not reproducible
|
|
|
|
rm -r "${DESTDIR}${PREFIX}/share/man"
|
2022-09-04 09:12:21 +01:00
|
|
|
}
|