2008-10-21 03:09:29 +02:00
|
|
|
# Template file for 'binutils'
|
|
|
|
pkgname=binutils
|
2013-12-02 17:51:50 +01:00
|
|
|
version=2.24
|
2014-03-14 09:16:14 +01:00
|
|
|
revision=3
|
2014-01-01 16:10:11 +01:00
|
|
|
bootstrap=yes
|
|
|
|
replaces="chroot-binutils>=0"
|
2008-10-21 03:09:29 +02:00
|
|
|
short_desc="GNU binary utilities"
|
|
|
|
maintainer="Juan RP <xtraeme@gmail.com>"
|
2011-07-11 23:14:09 +02:00
|
|
|
homepage="http://www.gnu.org/software/binutils/"
|
|
|
|
license="GPL-3"
|
2013-12-02 17:51:50 +01:00
|
|
|
distfiles="http://ftp.gnu.org/gnu/$pkgname/$pkgname-$version.tar.gz"
|
|
|
|
checksum=4930b2886309112c00a279483eaef2f0f8e1b1b62010e0239c16b22af7c346d4
|
2013-02-24 13:32:26 +01:00
|
|
|
|
2013-10-23 10:33:46 +02:00
|
|
|
if [ "$CHROOT_READY" ]; then
|
|
|
|
hostmakedepends="flex perl"
|
|
|
|
fi
|
|
|
|
|
2014-01-18 11:35:51 +01:00
|
|
|
makedepends+=" zlib-devel"
|
2013-04-12 08:55:23 +02:00
|
|
|
|
2013-10-23 10:33:46 +02:00
|
|
|
pre_configure() {
|
|
|
|
# Drop bashism!
|
|
|
|
sed -e 's,source,\.,g' -i ld/scripttempl/elf.sc
|
|
|
|
}
|
|
|
|
|
2011-11-22 10:59:32 +01:00
|
|
|
do_configure() {
|
2013-03-24 10:21:58 +01:00
|
|
|
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
|
2013-02-24 13:32:26 +01:00
|
|
|
CONFIGFLAG="--enable-64-bit-bfd --enable-multilib"
|
|
|
|
fi
|
2013-05-26 06:16:52 +02:00
|
|
|
if [ "$CROSS_BUILD" ]; then
|
2013-05-26 10:41:55 +02:00
|
|
|
# Do not use configure_args nor build_style=gnu-configure,
|
2013-05-26 06:16:52 +02:00
|
|
|
# avoiding --with-sysroot to $XBPS_CROSS_BASE.
|
|
|
|
CONFIGFLAG="--host=$XBPS_CROSS_TRIPLET --with-build-sysroot=$XBPS_CROSS_BASE"
|
|
|
|
fi
|
|
|
|
./configure --prefix=/usr --enable-threads \
|
2013-02-24 13:32:26 +01:00
|
|
|
--enable-plugins --enable-secureplt --with-mmap \
|
2014-02-11 00:28:53 +01:00
|
|
|
--disable-shared --disable-bootstrap \
|
|
|
|
--enable-ld=default --enable-gold $CONFIGFLAG LDFLAGS=
|
2011-11-22 10:59:32 +01:00
|
|
|
}
|
2011-07-11 23:14:54 +02:00
|
|
|
|
2011-11-22 10:59:32 +01:00
|
|
|
do_build() {
|
2011-07-11 23:14:09 +02:00
|
|
|
make ${makejobs}
|
2013-05-26 10:41:55 +02:00
|
|
|
|
2012-06-12 10:44:04 +02:00
|
|
|
# Rebuild libiberty.a with -fPIC
|
|
|
|
cp -a libiberty libiberty-pic
|
|
|
|
make -C libiberty-pic clean
|
|
|
|
make CFLAGS="$CFLAGS -fPIC" -C libiberty-pic
|
|
|
|
|
|
|
|
# Rebuild libbfd.a with -fPIC
|
|
|
|
# hidden visability prevent 3rd party shared libraries exporting bfd non-stable API
|
|
|
|
cp -a bfd bfd-pic
|
|
|
|
make -C bfd-pic clean
|
|
|
|
make CFLAGS="$CFLAGS -fPIC -fvisibility=hidden" -C bfd-pic
|
|
|
|
|
|
|
|
# Rebuild libopcodes.a with -fPIC
|
|
|
|
cp -a opcodes opcodes-pic
|
|
|
|
make -C opcodes-pic clean
|
|
|
|
make CFLAGS="$CFLAGS -fPIC" -C opcodes-pic
|
2011-07-11 23:14:09 +02:00
|
|
|
}
|
|
|
|
|
2011-11-22 10:59:32 +01:00
|
|
|
do_install() {
|
2013-03-24 10:21:58 +01:00
|
|
|
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
|
2013-05-10 09:35:57 +02:00
|
|
|
mkdir -p ${DESTDIR}/usr/lib
|
|
|
|
cd ${DESTDIR}/usr
|
|
|
|
ln -s lib lib64
|
|
|
|
cd ${wrksrc}
|
2009-10-18 12:28:15 +02:00
|
|
|
fi
|
2011-07-11 23:14:09 +02:00
|
|
|
make DESTDIR=${DESTDIR} tooldir=/usr install
|
|
|
|
|
2013-12-02 10:51:36 +01:00
|
|
|
# Remove ld (hardlink) and make a symlink to ld.bfd.
|
|
|
|
rm -f ${DESTDIR}/usr/bin/ld
|
|
|
|
ln -sfr ${DESTDIR}/usr/bin/ld.bfd ${DESTDIR}/usr/bin/ld
|
2013-02-24 13:32:26 +01:00
|
|
|
|
2012-06-12 10:44:04 +02:00
|
|
|
# Add some useful headers
|
|
|
|
install -m644 include/libiberty.h ${DESTDIR}/usr/include
|
|
|
|
install -m644 include/demangle.h ${DESTDIR}/usr/include
|
|
|
|
|
|
|
|
# install libraries rebuilt with -fPIC
|
|
|
|
install -m644 libiberty-pic/libiberty.a ${DESTDIR}/usr/lib
|
|
|
|
install -m644 bfd-pic/libbfd.a ${DESTDIR}/usr/lib
|
|
|
|
install -m644 opcodes-pic/libopcodes.a ${DESTDIR}/usr/lib
|
|
|
|
|
|
|
|
# Remove these symlinks, they are not ABI stable.
|
|
|
|
# Programs should compile static to the .a file.
|
|
|
|
rm -f ${DESTDIR}/usr/lib/lib{bfd,opcodes}.so
|
|
|
|
echo "INPUT ( /usr/lib/libbfd.a -liberty -lz )" \
|
|
|
|
>${DESTDIR}/usr/lib/libbfd.so
|
|
|
|
echo "INPUT ( /usr/lib/libopcodes.a -lbfd )" \
|
|
|
|
>${DESTDIR}/usr/lib/libopcodes.so
|
|
|
|
|
2009-10-18 08:11:54 +02:00
|
|
|
# Remove info file that conflicts with autoconf.
|
|
|
|
rm -f ${DESTDIR}/usr/share/info/standards.info
|
2010-01-27 02:16:31 +01:00
|
|
|
rm -f ${DESTDIR}/usr/lib64
|
2010-05-21 01:14:19 +02:00
|
|
|
|
2011-07-11 23:14:09 +02:00
|
|
|
# Remove useless manpages.
|
|
|
|
for f in dlltool nlmconv windres windmc; do
|
|
|
|
rm -f ${DESTDIR}/usr/share/man/man1/${f}.1
|
|
|
|
done
|
2009-10-18 08:11:54 +02:00
|
|
|
}
|
2013-04-12 08:55:23 +02:00
|
|
|
|
|
|
|
binutils-devel_package() {
|
2013-10-23 10:39:15 +02:00
|
|
|
replaces="chroot-binutils>=0"
|
2014-02-11 00:28:53 +01:00
|
|
|
depends="zlib-devel"
|
2013-05-10 09:35:57 +02:00
|
|
|
short_desc+=" - development files"
|
2013-04-12 08:55:23 +02:00
|
|
|
pkg_install() {
|
|
|
|
vmove usr/include
|
|
|
|
vmove "usr/lib/*.a"
|
2014-02-11 00:28:53 +01:00
|
|
|
vmove "usr/lib/*.so"
|
2013-04-12 08:55:23 +02:00
|
|
|
}
|
|
|
|
}
|