2021-02-24 14:38:10 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
2021-02-27 12:04:59 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
2021-02-24 14:38:10 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-02-27 12:04:59 +00:00
|
|
|
src_prepare() {
|
2021-05-03 23:48:06 +01:00
|
|
|
default
|
2021-03-02 22:02:53 +00:00
|
|
|
|
2021-04-01 23:51:18 +01:00
|
|
|
rm configure Makefile.in
|
2021-03-14 18:28:41 +00:00
|
|
|
|
|
|
|
# Rebuild aclocal.m4 files
|
|
|
|
# aclocal.m4 in libiberty seems to be hand-written
|
|
|
|
for dir in binutils bfd gas gprof ld opcodes; do
|
2021-03-15 07:15:25 +00:00
|
|
|
cd $dir
|
|
|
|
rm aclocal.m4
|
|
|
|
aclocal-1.4
|
|
|
|
cd ..
|
2021-03-14 18:28:41 +00:00
|
|
|
done
|
|
|
|
|
2021-03-14 23:54:32 +00:00
|
|
|
# intl/aclocal.m4 consists of two parts.
|
|
|
|
# First is generated by aclocal and second is from
|
|
|
|
# gettext.m4 file that is handwritten
|
|
|
|
# Here we rebuild just the first part
|
|
|
|
cd intl
|
|
|
|
csplit -sf file -n 1 aclocal.m4 '/This file is derived from/'
|
|
|
|
rm file0
|
|
|
|
mv file1 gettext.m4
|
|
|
|
# Build with aclocal-1.4 instead of 1.3
|
|
|
|
sed -i 's/AM_PROG_INSTALL/AC_PROG_INSTALL/' configure.in
|
|
|
|
aclocal-1.4
|
|
|
|
cat gettext.m4 >> aclocal.m4
|
|
|
|
cd ..
|
|
|
|
|
2021-03-14 18:28:41 +00:00
|
|
|
for dir in binutils bfd gas intl libiberty ld opcodes; do
|
2021-03-15 07:15:25 +00:00
|
|
|
cd $dir
|
|
|
|
rm config.in
|
2021-03-14 18:28:41 +00:00
|
|
|
autoheader-2.13
|
2021-03-15 07:15:25 +00:00
|
|
|
cd ..
|
2021-03-14 18:28:41 +00:00
|
|
|
done
|
|
|
|
|
2021-02-27 12:04:59 +00:00
|
|
|
for dir in binutils bfd gas ld gprof libiberty opcodes; do
|
|
|
|
cd $dir
|
|
|
|
rm configure
|
|
|
|
autoconf-2.13
|
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
for dir in etc intl; do
|
|
|
|
cd $dir
|
|
|
|
rm configure
|
|
|
|
autoconf-2.12
|
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
|
2021-03-12 01:09:53 +00:00
|
|
|
# Rebuild libtool files
|
|
|
|
rm config.guess config.sub ltmain.sh
|
|
|
|
libtoolize
|
2021-06-24 00:32:19 +01:00
|
|
|
cp "${PREFIX}/share/aclocal/libtool.m4" aclocal.m4
|
2021-03-12 01:09:53 +00:00
|
|
|
|
2021-02-27 12:04:59 +00:00
|
|
|
# automake errors out without this
|
|
|
|
cd gas
|
2021-02-27 23:29:59 +00:00
|
|
|
mv config/m68k-parse.y .
|
2021-02-27 12:04:59 +00:00
|
|
|
sed -i 's#config/m68k-parse.y#m68k-parse.y#' Makefile.am
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Disable documentation build which needs pod2man
|
|
|
|
for dir in bfd binutils gas gprof ld opcodes; do
|
|
|
|
cd $dir
|
|
|
|
sed -i '/SUBDIRS/d' Makefile.am
|
|
|
|
rm Makefile.in
|
|
|
|
automake-1.4
|
|
|
|
cd ..
|
|
|
|
done
|
2021-02-24 14:38:10 +00:00
|
|
|
|
2021-02-27 12:04:59 +00:00
|
|
|
# Rebuild bison files
|
2022-05-09 19:55:26 +01:00
|
|
|
touch -- */*.y
|
2021-02-27 12:04:59 +00:00
|
|
|
rm ld/ldgram.c ld/ldgram.h
|
|
|
|
rm gas/itbl-parse.c gas/itbl-parse.h
|
2021-02-27 23:29:59 +00:00
|
|
|
rm gas/m68k-parse.c
|
2021-02-27 12:04:59 +00:00
|
|
|
rm binutils/arparse.c binutils/arparse.h
|
|
|
|
rm binutils/nlmheader.c binutils/nlmheader.h
|
|
|
|
rm binutils/sysinfo.c binutils/sysinfo.h
|
|
|
|
rm binutils/defparse.c binutils/defparse.h
|
|
|
|
rm binutils/rcparse.c binutils/rcparse.h
|
2021-02-28 22:32:37 +00:00
|
|
|
|
|
|
|
# Rebuild flex generated files
|
2022-05-09 19:55:26 +01:00
|
|
|
touch -- */*.l
|
2021-02-28 22:32:37 +00:00
|
|
|
rm ld/ldlex.c
|
|
|
|
rm gas/itbl-lex.c
|
|
|
|
rm binutils/syslex.c binutils/rclex.c binutils/deflex.c binutils/arlex.c
|
2021-04-19 00:44:21 +01:00
|
|
|
|
|
|
|
# Remove prebuilt texinfo files
|
2022-05-09 19:55:26 +01:00
|
|
|
rm -- */*.info* */*/*.info*
|
2022-09-14 11:05:23 +01:00
|
|
|
|
|
|
|
# Remove pregenerated opcodes files
|
|
|
|
rm opcodes/ia64-asmtab.c
|
|
|
|
rm opcodes/z8k-opc.h
|
2021-02-27 12:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
src_configure() {
|
2021-02-24 14:38:10 +00:00
|
|
|
# TODO: Find a way to avoid these hacks
|
|
|
|
sed -i '/#undef pid_t/d' libiberty/config.in
|
|
|
|
sed -i '/#undef uintptr_t/d' libiberty/config.in
|
2021-04-01 23:51:18 +01:00
|
|
|
sed -i '/NEED_DECLARATION_SBRK/d' binutils/config.in
|
|
|
|
for dir in bfd opcodes binutils gas ld; do
|
|
|
|
sed -i '/#undef size_t/d' ${dir}/config.in
|
|
|
|
sed -i '/#undef off_t/d' ${dir}/config.in
|
|
|
|
done
|
2021-02-24 14:38:10 +00:00
|
|
|
sed -i 's/C_alloca/alloca/g' libiberty/alloca.c
|
|
|
|
sed -i 's/C_alloca/alloca/g' include/libiberty.h
|
2021-04-01 23:51:18 +01:00
|
|
|
|
|
|
|
for dir in intl libiberty opcodes bfd binutils gas gprof ld; do
|
|
|
|
cd $dir
|
|
|
|
|
|
|
|
LD="true" AR="tcc -ar" RANLIB="true" CC="tcc -D __GLIBC_MINOR__=6 -DHAVE_SBRK=1" \
|
|
|
|
./configure \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-shared \
|
|
|
|
--disable-werror \
|
|
|
|
--build=i386-unknown-linux-gnu \
|
|
|
|
--host=i386-unknown-linux-gnu \
|
|
|
|
--target=i386-unknown-linux-gnu \
|
|
|
|
--with-sysroot="${PREFIX}" \
|
|
|
|
--disable-64-bit-bfd \
|
|
|
|
--prefix="${PREFIX}" \
|
2022-09-14 13:07:13 +01:00
|
|
|
--libdir="${LIBDIR}" \
|
2021-04-20 23:57:00 +01:00
|
|
|
--srcdir=.
|
2021-04-01 23:51:18 +01:00
|
|
|
cd ..
|
|
|
|
done
|
2021-02-24 14:38:10 +00:00
|
|
|
}
|
2021-03-01 23:32:04 +00:00
|
|
|
|
|
|
|
src_compile() {
|
|
|
|
make -C bfd headers
|
2021-04-01 23:51:18 +01:00
|
|
|
for dir in libiberty bfd opcodes binutils gas gprof ld; do
|
2021-04-20 23:57:00 +01:00
|
|
|
make -C $dir MAKEINFO=true
|
2021-04-01 23:51:18 +01:00
|
|
|
done
|
|
|
|
}
|
2021-03-01 23:32:04 +00:00
|
|
|
|
2021-04-01 23:51:18 +01:00
|
|
|
src_install() {
|
|
|
|
for dir in libiberty bfd opcodes binutils gas gprof ld; do
|
2021-04-20 23:57:00 +01:00
|
|
|
make -C $dir install MAKEINFO=true DESTDIR="${DESTDIR}"
|
2021-04-01 23:51:18 +01:00
|
|
|
done
|
2021-03-01 23:32:04 +00:00
|
|
|
}
|