1 # Build recipe for binutils.
3 # Copyright (c) 2015-2020 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.
21 # Define a category for the output of the package name
24 tarname=${program}-${version}.tar.lz
27 fetch=http://ftp.gnu.org/gnu/binutils/$tarname
30 The GNU binary utilities.
32 Binutils is a collection of programming tools for the manipulation
33 of object code in various object file formats. These tools consist
34 of the GNU linker (ld), the GNU assembler (as) and the profiler
35 (gprof). There is also a collection of other binary tools like
36 the disassembler (objdump).
39 homepage=http://www.gnu.org/software/binutils
40 license="GPLv2+, GPLv3+, LGPLv2, LGPLv3"
42 # Source documentation
43 docs="COPYING* README"
44 docsdir="${docdir}/${program}-${version}"
47 MACHTYPE="$(cc -dumpmachine)"
53 unpack "${tardir}/$tarname"
57 # Set sane permissions
58 chmod -R u+w,go-w,a+rX-s .
60 patch -Np1 -i "${worktree}/patches/binutils/branch-updates.diff"
62 # Create a separate build directory
63 rm -rf ../binutils-build
64 mkdir ../binutils-build
67 # Set sane permissions
68 chmod -R u+w,go-w,a+rX-s .
70 # To pass extra options to binutils according to the architecture
73 binutils_targets="--enable-targets=i386-efi-pe,x86_64-pep"
77 ../${program}-${version}/configure \
78 CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
81 --libdir=/usr/lib${libSuffix} \
84 --with-docdir=$docsdir \
85 --enable-deterministic-archives \
89 --enable-threads=auto \
95 --enable-install-libiberty \
96 --enable-initfini-array \
98 --disable-separate-code \
99 --disable-compressed-debug-sections \
104 unset binutils_targets
105 make -j${jobs} tooldir=/usr/${MACHTYPE}
107 make -j${jobs} tooldir=/usr/${MACHTYPE} DESTDIR="$destdir" install-strip
110 cd .. && cd "$srcdir"
112 # Replace hard-links with relative soft-links for the package size
114 cd "${destdir}/usr/bin" && \
115 rm -f ld ; ln -sf ld.bfd ld
118 cd "${destdir}/usr/${MACHTYPE}/bin" && \
121 if test -x "../../bin/$file"
123 rm -f "$file" && ln -s "../../bin/$file" .
128 # Compress info documents deleting index file for the package
129 if test -d "${destdir}/$infodir"
131 rm -f "${destdir}/${infodir}/dir"
132 lzip -9 "${destdir}/${infodir}"/*
136 if test -d "${destdir}/$mandir"
138 lzip -9 "${destdir}/${mandir}"/man?/*
142 mkdir -p "${destdir}${docsdir}"
143 cp -p $docs "${destdir}${docsdir}/"
145 # Delete temporary build directory
147 if test -d ./binutils-build
149 rm -rf ./binutils-build