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-03-02 22:02:53 +00:00
|
|
|
default_src_prepare
|
|
|
|
|
2021-02-27 12:04:59 +00:00
|
|
|
rm configure
|
|
|
|
autoconf-2.13
|
|
|
|
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
|
|
|
|
|
|
|
|
# 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
|
|
|
|
touch */*.y
|
|
|
|
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
|
|
|
|
touch */*.l
|
|
|
|
rm ld/ldlex.c
|
|
|
|
rm gas/itbl-lex.c
|
|
|
|
rm binutils/syslex.c binutils/rclex.c binutils/deflex.c binutils/arlex.c
|
2021-02-27 12:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
src_configure() {
|
2021-02-24 14:38:10 +00:00
|
|
|
AR="tcc -ar" RANLIB="true" CC="tcc -D __GLIBC_MINOR__=6" \
|
|
|
|
./configure \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-shared \
|
|
|
|
--disable-werror \
|
|
|
|
--build=i386-unknown-linux \
|
|
|
|
--host=i386-unknown-linux \
|
|
|
|
--target=i386-unknown-linux \
|
|
|
|
--with-sysroot=/after \
|
2021-02-27 12:04:59 +00:00
|
|
|
--disable-64-bit-bfd \
|
2021-02-28 12:52:50 +00:00
|
|
|
--prefix="${PREFIX}" \
|
|
|
|
--libdir="${PREFIX}/lib/musl"
|
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
|
|
|
|
sed -i 's/C_alloca/alloca/g' libiberty/alloca.c
|
|
|
|
sed -i 's/C_alloca/alloca/g' include/libiberty.h
|
|
|
|
}
|
2021-03-01 23:32:04 +00:00
|
|
|
|
|
|
|
src_compile() {
|
|
|
|
# Rebuild generated header files. bfd/Makefile does not exists at this stage,
|
|
|
|
# so we need to create it first.
|
|
|
|
make configure-bfd
|
|
|
|
make -C bfd headers
|
|
|
|
|
|
|
|
default_src_compile
|
|
|
|
}
|