2024-04-13 17:50:08 +02:00
# Maintainer of official package: Felix Yan <felixonmars@archlinux.org>
2016-08-09 01:59:28 +02:00
# Same as official package but uses symlinks instead of hard links allowing
# installation when /usr/i686-w64-mingw32 and /usr/x86_64-w64-mingw32 are
# bound from another partition.
pkgname = mingw-w64-binutils-symlinks
2024-04-13 17:50:08 +02:00
pkgver = 2.42
2016-08-09 01:59:28 +02:00
pkgrel = 1
2024-04-13 17:50:08 +02:00
pkgdesc = "Cross binutils for the MinGW-w64 cross-compiler"
arch = ( 'x86_64' )
2016-08-09 01:59:28 +02:00
url = "http://www.gnu.org/software/binutils"
2024-04-13 17:50:08 +02:00
license = ( GPL-2.0-or-later GPL-3.0-or-later LGPL-2.0-or-later LGPL-3.0-or-later GFDL-1.3 FSFAP)
2016-08-09 01:59:28 +02:00
groups = ( 'mingw-w64-toolchain' 'mingw-w64' )
depends = ( 'zlib' )
provides = ( 'mingw-w64-binutils' )
2024-04-13 17:50:08 +02:00
conflicts = ( 'mingw-w64-binutils' ) ;
2016-08-09 01:59:28 +02:00
options = ( '!libtool' '!emptydirs' )
2024-04-13 17:50:08 +02:00
validpgpkeys = ( '3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F' ) # Nick Clifton (Chief Binutils Maintainer) <nickc@redhat.com>
2018-04-17 21:32:21 +02:00
source = ( " https://ftp.gnu.org/gnu/binutils/binutils- ${ pkgver } .tar.gz " { ,.sig} )
2024-04-13 17:50:08 +02:00
sha512sums = ( '1e4ee462513eadd3c540e4782f9661df62ecbcd4d6297d61dcc0845ae7d30243c57571787706af3bb4d561e4350609d7057307290e81d76290a301f159a6abc5'
2018-07-15 18:33:29 +02:00
'SKIP' )
2016-08-09 01:59:28 +02:00
2024-04-13 17:50:08 +02:00
_targets = "i686-w64-mingw32 x86_64-w64-mingw32"
2016-08-09 01:59:28 +02:00
prepare( ) {
2024-04-13 17:50:08 +02:00
cd " $srcdir " /binutils-${ pkgver }
2016-08-09 01:59:28 +02:00
#do not install libiberty
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
}
build( ) {
2024-04-13 17:50:08 +02:00
# Fix the check for limits.h and certain other checks by dropping the fortify flag from CPPFLAGS
# note: Otherwise libiberty/config.h lacks HAVE_LIMITS_H and the compilation runs into errors like:
# /build/gcc-static-compat/src/gcc/libiberty/fibheap.c:38:25: error: ‘ LONG_MIN’ undeclared (first use in this function)
# 38 | #define FIBHEAPKEY_MIN LONG_MIN
# | ^~~~~~~~
# /build/gcc-static-compat/src/gcc/libiberty/fibheap.c:220:30: note: in expansion of macro ‘ FIBHEAPKEY_MIN’
# 220 | if (okey == key && okey != FIBHEAPKEY_MIN)
# | ^~~~~~~~~~~~~~
# /build/gcc-static-compat/src/gcc/libiberty/fibheap.c:36:1: note: ‘ LONG_MIN’ is defined in header ‘ <limits.h>’ ; did you forget to ‘ #include <limits.h>’ ?
# 35 | #include "fibheap.h"
# +++ |+#include <limits.h>
CPPFLAGS = ${ CPPFLAGS /-D_FORTIFY_SOURCE=2 }
2016-08-09 01:59:28 +02:00
for _target in $_targets ; do
2024-04-13 17:50:08 +02:00
echo " Building ${ _target } cross binutils "
mkdir -p " $srcdir " /binutils-${ _target } && cd " ${ srcdir } /binutils- ${ _target } "
" $srcdir " /binutils-${ pkgver } /configure --prefix= /usr \
2016-08-09 01:59:28 +02:00
--target= ${ _target } \
--infodir= /usr/share/info/${ _target } \
--enable-lto --enable-plugins \
2018-04-17 21:32:21 +02:00
--enable-deterministic-archives \
2016-08-09 01:59:28 +02:00
--disable-multilib --disable-nls \
--disable-werror
2024-04-13 17:50:08 +02:00
make -O
2016-08-09 01:59:28 +02:00
done
}
package( ) {
for _target in ${ _targets } ; do
2024-04-13 17:50:08 +02:00
echo " Installing ${ _target } cross binutils "
cd " $srcdir " /binutils-${ _target }
make DESTDIR = " $pkgdir " install
rm " $pkgdir " /usr/lib/bfd-plugins/libdep.so
2016-08-09 01:59:28 +02:00
done
2024-04-13 17:50:08 +02:00
2016-08-09 01:59:28 +02:00
cd " ${ pkgdir } /usr/bin "
for file in *; do
if [ [ ! -L $file ] ] && [ [ ! -d $file ] ] ; then
local _arch = " ${ file %*-w64-mingw32* } "
local _name = " ${ file #*-w64-mingw32- } "
local _target = " /usr/ ${ _arch } -w64-mingw32/bin/ ${ _name } "
if [ [ -f ${ pkgdir } /${ _target } ] ] ; then
ln -sf " ${ _target } " " ${ file } "
fi
fi
done
}