11# SPDX-FileCopyrightText: 2022 Dor Askayo <[email protected] >22# SPDX-FileCopyrightText: 2021 Andrius Štikonas <[email protected] >33# SPDX-FileCopyrightText: 2021 Paul Dersey <[email protected] >4- # SPDX-FileCopyrightText: 2023 fosslinux <[email protected] >4+ # SPDX-FileCopyrightText: 2023,2025 fosslinux <[email protected] >55#
66# SPDX-License-Identifier: GPL-3.0-or-later
77
@@ -10,28 +10,9 @@ src_prepare() {
1010
1111 # Remove unused generated files
1212 rm etc/Makefile.in etc/configure
13- rm zlib/aclocal.m4 zlib/configure
1413
15- # Regenerate top-level (autogen + autotools)
16- autogen Makefile.def
17- ACLOCAL=aclocal-1.15 autoreconf-2.69 -fi
18-
19- # Regenerate autoconf
20- for dir in bfd binutils gas gold gprof intl ld libctf libiberty libsframe opcodes; do
21- cd $dir
22- ACLOCAL=aclocal-1.15 AUTOMAKE=automake-1.15 autoreconf-2.69 -fi
23- cd ..
24- done
25-
26- # Regenerate directories with Makefile.am only
27- pushd gold
28- automake-1.15 -fai testsuite/Makefile
29- popd
30- pushd gprofng
31- automake-1.15 -fai doc/Makefile
32- automake-1.15 -fai gp-display-html/Makefile
33- automake-1.15 -fai src/Makefile
34- popd
14+ # Remove unused parts
15+ rm -r zlib
3516
3617 # intl/ Makefile is a bit broken because of new gettext
3718 sed -i ' s/@USE_INCLUDED_LIBINTL@/no/' intl/Makefile.in
@@ -42,46 +23,104 @@ src_prepare() {
4223
4324 # Rebuild bison files
4425 touch -- * /* .y
45- rm binutils/arparse.c binutils/arparse.h
46- rm binutils/defparse.c binutils/defparse.h
47- rm binutils/mcparse.c binutils/mcparse.h
48- rm binutils/rcparse.c binutils/rcparse.h
49- rm binutils/sysinfo.c binutils/sysinfo.h
50- rm gas/config/bfin-parse.c gas/config/bfin-parse.h
51- rm gas/config/loongarch-parse.c gas/config/loongarch-parse.h
52- rm gas/config/m68k-parse.c gas/config/rl78-parse.c
53- rm gas/config/rl78-parse.h gas/config/rx-parse.c
54- rm gas/config/rx-parse.h gas/itbl-parse.c
55- rm gas/itbl-parse.h gold/yyscript.c
56- rm gold/yyscript.h intl/plural.c
57- rm ld/deffilep.c ld/deffilep.h
58- rm ld/ldgram.c ld/ldgram.h
26+ rm binutils/arparse.c binutils/arparse.h binutils/defparse.c \
27+ binutils/defparse.h binutils/mcparse.c binutils/mcparse.h \
28+ binutils/rcparse.c binutils/rcparse.h binutils/sysinfo.c \
29+ binutils/sysinfo.h gas/config/bfin-parse.c gas/config/bfin-parse.h \
30+ gas/config/loongarch-parse.c gas/config/loongarch-parse.h \
31+ gas/config/m68k-parse.c gas/config/rl78-parse.c \
32+ gas/config/rl78-parse.h gas/config/rx-parse.c gas/config/rx-parse.h \
33+ gas/itbl-parse.c gas/itbl-parse.h gold/yyscript.c gold/yyscript.h \
34+ intl/plural.c ld/deffilep.c ld/deffilep.h ld/ldgram.c ld/ldgram.h
5935
6036 # Rebuild flex generated files
6137 touch -- * /* .l * /* /* .l
62- rm binutils/arlex.c binutils/deflex.c binutils/syslex.c
63- rm gas/config/bfin-lex.c gas/config/loongarch-lex.c gas/itbl-lex.c
64- rm ld/ldlex.c
38+ rm binutils/arlex.c binutils/deflex.c binutils/syslex.c \
39+ gas/config/bfin-lex.c gas/config/loongarch-lex.c gas/itbl-lex.c \
40+ ld/ldlex.c
6541
66- # Remove prebuilt texinfo files
42+ # Remove prebuilt docs
6743 find . -type f -name ' *.info*' \
6844 -not -wholename ' ./binutils/sysroff.info' \
6945 -delete
46+ find . -type f \( -name ' *.1' -or -name ' *.man' \) -delete
47+ rm libiberty/functions.texi
48+
49+ # Remove gettext translation files
50+ find . -type f -name ' *.gmo' -delete
7051
7152 # Remove pregenerated opcodes files
72- rm opcodes/i386-init.h opcodes/i386-tbl.h opcodes/i386-mnem.h
73- rm opcodes/ia64-asmtab.c
74- rm opcodes/z8k -opc.h
75- rm opcodes/aarch64-asm-2 .c opcodes/aarch64-opc-2 .c opcodes/aarch64-dis-2 .c
53+ rm opcodes/i386-init.h opcodes/i386-tbl.h opcodes/i386-mnem.h \
54+ opcodes/ia64-asmtab.c opcodes/z8k-opc.h opcodes/aarch64-asm-2.c \
55+ opcodes/aarch64 -opc-2.c opcodes/aarch64-dis-2.c \
56+ opcodes/msp430-decode .c opcodes/rl78-decode .c opcodes/rx-decode .c
7657 rm $( grep -l ' MACHINE GENERATED' opcodes/* .c opcodes/* .h)
7758
78- rm libiberty/functions.texi
59+ # Various other blobs/generated headers
60+ rm ld/emultempl/* .o_c
61+ rm gprof/bsd_callg_bl.c gprof/flat_bl.c gprof/fsf_callg_bl.c
62+ rm bfd/libcoff.h bfd/libbfd.h bfd/go32stub.h bfd/bfd-in2.h
63+
64+ # Generated testsuite stuff (xz-style attack)
65+ rm libsframe/testsuite/libsframe.decode/DATA* \
66+ ld/testsuite/ld-x86-64/* .obj.bz2 ld/testsuite/ld-sh/arch/* .s \
67+ ld/testsuite/ld-sh/arch/arch_expected.txt \
68+ ld/testsuite/ld-i386/pr27193a.o.bz2 \
69+ gas/testsuite/gas/xstormy16/allinsn.sh \
70+ gas/testsuite/gas/tic4x/opcodes.s gas/testsuite/gas/sh/arch/* .s \
71+ gas/testsuite/gas/sh/arch/arch_expected.txt \
72+ binutils/testsuite/binutils-all/x86-64/pr22451.o.bz2 \
73+ binutils/testsuite/binutils-all/x86-64/pr26808.dwp.bz2 \
74+ binutils/testsuite/binutils-all/x86-64/pr27708.exe.bz2 \
75+ binutils/testsuite/binutils-all/nfp/* .nffw \
76+ binutils/testsuite/binutils-all/pr26112.o.bz2 \
77+ binutils/testsuite/binutils-all/pr26160.dwp.bz2
78+
79+ # Regenerate crc table in libiberty/crc32.c
80+ cd libiberty
81+ sed -n ' /^ #include <stdio.h>/,/^ \}$/p' crc32.c > crcgen.c
82+ gcc -o crcgen crcgen.c
83+ sed ' /crc_v3\.txt/{n; q}' crc32.c > crc32.c.new
84+ ./crcgen >> crc32.c.new
85+ sed ' 1,/^};$/d' crc32.c >> crc32.c.new
86+ mv crc32.c.new crc32.c
87+ cd ..
88+
89+ # bfd-in2.h is required to run autoreconf, but we don't have it yet
90+ cd bfd
91+ cp configure.ac configure.ac.bak
92+ sed -i " s/bfd-in3.h:bfd-in2.h //" configure.ac
93+ AUTOPOINT=true ACLOCAL=aclocal-1.15 AUTOMAKE=automake-1.15 autoreconf-2.69 -fi
94+ ./configure
95+ make headers
96+ mv configure.ac.bak configure.ac
97+ make distclean
98+ cd ..
99+
100+ # Regenerate top-level (autogen + autotools)
101+ autogen Makefile.def
102+ ACLOCAL=aclocal-1.15 autoreconf-2.69 -fi
103+
104+ # Regenerate autoconf
105+ for dir in bfd binutils gas gold gprof intl ld libctf libiberty libsframe opcodes; do
106+ cd $dir
107+ ACLOCAL=aclocal-1.15 AUTOMAKE=automake-1.15 autoreconf-2.69 -fi
108+ cd ..
109+ done
110+ cd gprofng
111+ # there is no libtool in gprofng, and libtoolize fails
112+ LIBTOOLIZE=true ACLOCAL=aclocal-1.15 AUTOMAKE=automake-1.15 autoreconf-2.69 -fi
113+ cd ..
114+
115+ # Rebuild dependencies in libiberty/Makefile.in
116+ cd libiberty
117+ ./configure --enable-maintainer-mode
118+ make maint-deps
119+ make distclean
120+ cd ..
79121
80122 # Regenerate MeP sections
81123 ./bfd/mep-relocs.pl
82-
83- # Manpages
84- find . -type f \( -name ' *.1' -or -name ' *.man' \) -delete
85124}
86125
87126src_configure () {
0 commit comments