python-texttable: update to 1.3.1
[void-packages.git] / srcpkgs / binutils / template
blobed32fe936837d6f975df0f5e3e48a24a1291043a
1 # Template file for 'binutils'
2 pkgname=binutils
3 version=2.29.1
4 revision=3
5 bootstrap=yes
6 short_desc="GNU binary utilities"
7 maintainer="Juan RP <xtraeme@voidlinux.eu>"
8 homepage="http://www.gnu.org/software/binutils/"
9 license="GPL-3"
10 distfiles="${GNU_SITE}/$pkgname/$pkgname-$version.tar.bz2"
11 checksum=1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc
13 if [ "$CHROOT_READY" ]; then
14         hostmakedepends="flex perl"
15         checkdepends="bc"
16 else
17         unset XBPS_CHECK_PKGS
19 makedepends+=" zlib-devel"
21 pre_configure() {
22         sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
23         # Drop bashism!
24         sed -e 's,source,\.,g' -i ld/scripttempl/elf32msp430.sc
26 do_configure() {
27         if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
28                 CONFIGFLAG="--enable-64-bit-bfd --enable-multilib"
29         fi
30         if [ "$CROSS_BUILD" ]; then
31                 # Do not use configure_args nor build_style=gnu-configure,
32                 # avoiding --with-sysroot to $XBPS_CROSS_BASE.
33                 CONFIGFLAG="--host=$XBPS_CROSS_TRIPLET --with-build-sysroot=$XBPS_CROSS_BASE"
34         fi
35         if [ "$XBPS_TARGET_MACHINE" = "mipsel-musl" ]; then
36                 CONFIGFLAG+=" --with-float=soft --without-fp"
37         fi
38         if [ "${XBPS_TARGET_MACHINE%-musl}" = "x86_64" ]; then
39                 CONFIGFLAG+=" --enable-targets=x86_64-pep"
40         fi
41         ./configure --build=$XBPS_TRIPLET --prefix=/usr --enable-threads \
42                 --enable-plugins --enable-secureplt --with-mmap \
43                 --disable-shared --enable-gold --disable-werror \
44                 --enable-deterministic-archives --enable-ld=default \
45                 --disable-nls $CONFIGFLAG
47 do_build() {
48         make ${makejobs}
50         # Rebuild libiberty.a with -fPIC
51         cp -a libiberty libiberty-pic
52         make -C libiberty-pic clean
53         make CFLAGS="$CFLAGS -fPIC" -C libiberty-pic
55         # Rebuild libbfd.a with -fPIC
56         # hidden visability prevent 3rd party shared libraries exporting bfd non-stable API
57         cp -a bfd bfd-pic
58         make -C bfd-pic clean
59         make CFLAGS="$CFLAGS -fPIC -fvisibility=hidden" -C bfd-pic
61         # Rebuild libopcodes.a with -fPIC
62         cp -a opcodes opcodes-pic
63         make -C opcodes-pic clean
64         make CFLAGS="$CFLAGS -fPIC" -C opcodes-pic
66 do_check() {
67         make -k check
69 do_install() {
70         if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
71                 mkdir -p ${DESTDIR}/usr/lib
72                 cd ${DESTDIR}/usr
73                 ln -s lib lib64
74                 cd ${wrksrc}
75         fi
76         make DESTDIR=${DESTDIR} tooldir=/usr install
78         # Remove ld (hardlink) and make a symlink to ld.bfd.
79         rm -f ${DESTDIR}/usr/bin/ld
80         ln -sfr ${DESTDIR}/usr/bin/ld.bfd ${DESTDIR}/usr/bin/ld
82         # Add some useful headers
83         install -m644 include/libiberty.h ${DESTDIR}/usr/include
84         install -m644 include/demangle.h ${DESTDIR}/usr/include
86         # install libraries rebuilt with -fPIC
87         install -m644 libiberty-pic/libiberty.a ${DESTDIR}/usr/lib
88         install -m644 bfd-pic/libbfd.a ${DESTDIR}/usr/lib
89         install -m644 opcodes-pic/libopcodes.a ${DESTDIR}/usr/lib
91         # Remove these symlinks, they are not ABI stable.
92         # Programs should compile static to the .a file.
93         rm -f ${DESTDIR}/usr/lib/lib{bfd,opcodes}.so
94         echo "INPUT ( /usr/lib/libbfd.a -liberty -lz )" \
95                 >${DESTDIR}/usr/lib/libbfd.so
96         echo "INPUT ( /usr/lib/libopcodes.a -lbfd )" \
97                 >${DESTDIR}/usr/lib/libopcodes.so
99         # Remove info file that conflicts with autoconf.
100         rm -f ${DESTDIR}/usr/share/info/standards.info
101         rm -f ${DESTDIR}/usr/lib64
103         # Remove useless manpages.
104         for f in dlltool nlmconv windres windmc; do
105                 rm -f ${DESTDIR}/usr/share/man/man1/${f}.1
106         done
107         # Create triplet symlinks
108         for f in ${DESTDIR}/usr/bin/*; do
109                 ln -s ${f##*/} ${DESTDIR}/usr/bin/${XBPS_CROSS_TRIPLET:-${XBPS_TRIPLET}}-${f##*/}
110         done
113 binutils-devel_package() {
114         depends="zlib-devel"
115         short_desc+=" - development files"
116         pkg_install() {
117                 vmove usr/include
118                 vmove "usr/lib/*.a"
119                 vmove "usr/lib/*.so"
120         }