1 # Template file for 'binutils'
6 short_desc="GNU binary utilities"
7 maintainer="Juan RP <xtraeme@voidlinux.eu>"
8 homepage="http://www.gnu.org/software/binutils/"
10 distfiles="${GNU_SITE}/$pkgname/$pkgname-$version.tar.bz2"
11 checksum=1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc
13 if [ "$CHROOT_READY" ]; then
14 hostmakedepends="flex perl"
19 makedepends+=" zlib-devel"
22 sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
24 sed -e 's,source,\.,g' -i ld/scripttempl/elf32msp430.sc
27 if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
28 CONFIGFLAG="--enable-64-bit-bfd --enable-multilib"
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"
35 if [ "$XBPS_TARGET_MACHINE" = "mipsel-musl" ]; then
36 CONFIGFLAG+=" --with-float=soft --without-fp"
38 if [ "${XBPS_TARGET_MACHINE%-musl}" = "x86_64" ]; then
39 CONFIGFLAG+=" --enable-targets=x86_64-pep"
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
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
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
70 if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
71 mkdir -p ${DESTDIR}/usr/lib
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
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##*/}
113 binutils-devel_package() {
115 short_desc+=" - development files"