1 # Build recipe for binutils.
3 # Copyright (c) 2015-2018 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 # Set 'outdir' for a nice and well-organized output directory
22 outdir="${outdir}/${arch}/devel"
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"
61 patch -Np1 -i "${worktree}/patches/binutils/136_bfd_pic.patch"
63 # Create a separate build directory
64 rm -rf ../binutils-build
65 mkdir ../binutils-build
68 # Set sane permissions
69 chmod -R u+w,go-w,a+rX-s .
71 ../${program}-${version}/configure \
72 CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
75 --libdir=/usr/lib${libSuffix} \
78 --with-docdir=$docsdir \
79 --enable-deterministic-archives \
89 --enable-targets=i386-efi-pe,x86_64-pep \
90 --enable-install-libiberty \
92 --disable-compressed-debug-sections \
96 make -j${jobs} tooldir=/usr/${MACHTYPE}
98 make -j${jobs} tooldir=/usr/${MACHTYPE} DESTDIR="$destdir" install-strip
101 cd .. && cd "$srcdir"
103 # Replace hard-links with relative soft-links for the package size
105 cd "${destdir}/usr/bin" && \
106 rm -f ld ; ln -sf ld.bfd ld
109 cd "${destdir}/usr/${MACHTYPE}/bin" && \
112 if test -x "../../bin/$file"
114 rm -f "$file" && ln -s "../../bin/$file" .
119 # Compress info documents deleting index file for the package
120 if test -d "${destdir}/$infodir"
122 rm -f "${destdir}/${infodir}/dir"
123 lzip -9 "${destdir}/${infodir}"/*
127 if test -d "${destdir}/$mandir"
129 lzip -9 "${destdir}/${mandir}"/man?/*
133 mkdir -p "${destdir}${docsdir}"
134 cp -p $docs "${destdir}${docsdir}/"
136 # Delete temporary build directory
138 if test -d ./binutils-build
140 rm -rf ./binutils-build