recipes: xorg/mesa: upgraded to version 18.3.2
[dragora.git] / recipes / devel / binutils / recipe
blobf75db8f8bbdb6dfc1a2f4f4c2647481fd222e92d
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.
17 program=binutils
18 version=2.31.1
19 release=4
21 # Set 'outdir' for a nice and well-organized output directory
22 outdir="${outdir}/${arch}/devel"
24 tarname=${program}-${version}.tar.lz
26 # Remote source(s)
27 fetch=http://ftp.gnu.org/gnu/binutils/$tarname
29 description="
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}"
46 # System-dependent
47 MACHTYPE="$(cc -dumpmachine)"
49 build()
51     set -e
53     unpack "${tardir}/$tarname"
55     cd "$srcdir"
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
66     cd ../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" \
73      $configure_args \
74      $multilib_options \
75      --libdir=/usr/lib${libSuffix} \
76      --mandir=$mandir \
77      --infodir=$infodir \
78      --with-docdir=$docsdir \
79      --enable-deterministic-archives \
80      --enable-shared \
81      --enable-gold=yes \
82      --enable-ld=default \
83      --enable-relro \
84      --enable-lto \
85      --enable-nls \
86      --enable-plugins \
87      --enable-threads \
88      --enable-64-bit-bfd \
89      --enable-targets=i386-efi-pe,x86_64-pep \
90      --enable-install-libiberty \
91      --disable-werror \
92      --disable-compressed-debug-sections \
93      --with-system-zlib \
94      --build=$MACHTYPE
96     make -j${jobs} tooldir=/usr/${MACHTYPE}
97     #make -k check
98     make -j${jobs} tooldir=/usr/${MACHTYPE} DESTDIR="$destdir" install-strip
100     # Back to srcdir
101     cd .. && cd "$srcdir"
103     # Replace hard-links with relative soft-links for the package size
104     (
105         cd "${destdir}/usr/bin" && \
106         rm -f ld ; ln -sf ld.bfd ld
107     )
108     (
109         cd "${destdir}/usr/${MACHTYPE}/bin" && \
110         for file in *
111         do
112             if test -x "../../bin/$file"
113             then
114                 rm -f "$file" && ln -s "../../bin/$file" .
115             fi
116         done
117     )
119     # Compress info documents deleting index file for the package
120     if test -d "${destdir}/$infodir"
121     then
122         rm -f "${destdir}/${infodir}/dir"
123         lzip -9 "${destdir}/${infodir}"/*
124     fi
126     # Compress man pages
127     if test -d "${destdir}/$mandir"
128     then
129         lzip -9 "${destdir}/${mandir}"/man?/*
130     fi
132     # Copy documentation
133     mkdir -p "${destdir}${docsdir}"
134     cp -p $docs "${destdir}${docsdir}/"
136     # Delete temporary build directory
137     cd -- "$TMPDIR"
138     if test -d ./binutils-build
139     then
140         rm -rf ./binutils-build
141     fi