stages: 2/04-iso: Do not include kernel build/source tree in the LiveCD
[dragora.git] / stages / 0 / 01-binutils
blob4d0a9c3bfdfdf6c1f877fe40b730b0391f6f42e8
1 # Build script for binutils.
3 # Copyright (c) 2014-2022 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 version=2.38.20220801_dc2474e7d20
19 cd -- "$TMPDIR"
20 rm -rf binutils-${version}
21 unpack "${worktree}/sources/binutils-${version}.tar.lz"
23 # Build instructions
24 cd binutils-${version}
26 # Apply patches from Fedora (Nick Clifton)
28 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-export-demangle.h.patch"
29 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-no-config-h-check.patch"
30 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-filename-in-error-messages.patch"
31 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-revert-PLT-elision.patch"
32 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-readelf-other-sym-info.patch"
33 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-2.27-aarch64-ifunc.patch"
34 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-do-not-link-with-static-libstdc++.patch"
35 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-special-sections-in-groups.patch"
36 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gold-mismatched-section-flags.patch"
37 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-CVE-2019-1010204.patch"
38 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gold-warn-unsupported.patch"
39 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-use-long-long.patch"
40 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gold-i386-gnu-property-notes.patch"
41 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-autoconf-version.patch"
42 patch -Np1 -i "${worktree}/patches/binutils/2.38/gcc12-libtool-no-rpath.patch"
43 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-section-type.patch"
44 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gas-loc-view.patch"
45 patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-do-not-use-debuginfod.patch"
47 # Binutils ships an outdated copy of libtool in the tarball.  It lacks sysroot support,
48 # so the produced binaries will be mistakenly linked to libraries from the host distro.
49 # (Thanks to "Linux From Scratch" for this!)
50 #sed '6009s/$add_dir//' -i ltmain.sh
52 # Build in a separate directory
53 rm -rf ../binutils-build
54 mkdir ../binutils-build
55 cd ../binutils-build
57 ../binutils-${version}/configure \
58 AR="ar" AS="as" CC="$BTCC" CXX="$BTCXX" \
59 CFLAGS="$BTCFLAGS" CXXFLAGS="$BTCXXFLAGS" LDFLAGS="$BTLDFLAGS" \
60  --prefix="$crossdir" \
61  --libdir="${crossdir}/lib${libSuffix}" \
62  --host=$host \
63  --target=$target \
64  --enable-deterministic-archives \
65  --enable-separate-code \
66  --disable-compressed-debug-sections \
67  --disable-generate-build-notes \
68  --disable-werror \
69  --disable-nls \
70  --disable-ppl-version-check \
71  --disable-cloog-version-check \
72  --disable-gprofng \
73  --disable-gdb \
74  --with-mmap \
75  --with-sysroot="${crossdir}/$target" \
76  $multilib_options
78 make -j${jobs} V=1 MAKEINFO="true"
79 make -j${jobs} V=1 MAKEINFO="true" install
81 cd -- "$TMPDIR"
83 cleanup()
85     rm -rf binutils-${version} binutils-build