Repository navigation
Expand file tree
/
Copy pathPKGBUILD
More file actions
141 lines (121 loc) · 5.48 KB
/
Copy pathPKGBUILD
File metadata and controls
141 lines (121 loc) · 5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>
# Contributor: Mateusz Mikula <mati865@gmail.com>
_realname=binutils
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.38
pkgrel=2
pkgdesc="A set of programs to assemble and manipulate binary and object files (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64')
url="https://www.gnu.org/software/binutils/"
license=('GPL')
groups=("${MINGW_PACKAGE_PREFIX}-toolchain")
depends=("${MINGW_PACKAGE_PREFIX}-libiconv"
"${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-autotools")
options=('staticlibs' '!distcc' '!ccache')
source=(https://ftp.gnu.org/gnu/binutils/${_realname}-${pkgver}.tar.xz{,.sig}
0001-Revert-check-thin-archive-element-file-size.patch
0002-check-for-unusual-file-harder.patch
0010-bfd-Increase-_bfd_coff_max_nscns-to-65279.patch
0110-binutils-mingw-gnu-print.patch
2001-ld-option-to-move-default-bases-under-4GB.patch
2003-Restore-old-behaviour-of-windres-so-that-options-con.patch
reproducible-import-libraries.patch
specify-timestamp.patch)
sha256sums=('e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024'
'SKIP'
'8df34481c39811f31bc5c37a733ae30cafc8a87d8c57d2e5f745193198c687b8'
'2c99345fc575c3a060d6677537f636c6c4154fac0fde508070f3b6296c1060d4'
'4e8ac055df61b1b5d6ae29dc87e1154737c2e87c7b244b44866702cabf1a5d18'
'702635038b245709aa2cf6016c25f6bbf8a53d4cfb5b21f3d5bfe6309b10acb7'
'675ea7c58b8b3fc628ea85843ee7ca7fb10137c2d42dbd407f83002cb98ff22d'
'd584f1cd9e94cba0e9b27625c4acc8ad5242cd625c9b44839d42fc116072568c'
'a094660ec95996c00b598429843b7869037732146442af567ada9f539bd40480'
'27696da8ecfff307537a461b205fad44d6abc1fa648fbf839e72a1d3ea71c40a')
validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93'
'3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F')
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying ${_patch}"
patch -p1 -i "${srcdir}/${_patch}"
done
}
prepare() {
cd ${srcdir}/${_realname}-${pkgver}
# Fixes https://github.com/msys2/MINGW-packages/issues/10860
# Already merged upstream as 2d92604cd3, please remove this
# patch when upgrading to a later version than 2.38.
apply_patch_with_msg \
0001-Revert-check-thin-archive-element-file-size.patch \
apply_patch_with_msg \
0002-check-for-unusual-file-harder.patch \
0010-bfd-Increase-_bfd_coff_max_nscns-to-65279.patch \
0110-binutils-mingw-gnu-print.patch
# Add an option to change default bases back below 4GB to ease transition
# https://github.com/msys2/MINGW-packages/issues/7027
# https://github.com/msys2/MINGW-packages/issues/7023
apply_patch_with_msg 2001-ld-option-to-move-default-bases-under-4GB.patch
# https://github.com/msys2/MINGW-packages/pull/9233#issuecomment-889439433
patch -R -p1 -i "${srcdir}/2003-Restore-old-behaviour-of-windres-so-that-options-con.patch"
# patches for reproducibility from Debian:
# https://salsa.debian.org/mingw-w64-team/binutils-mingw-w64/-/tree/master/debian/patches
patch -p2 -i "${srcdir}/reproducible-import-libraries.patch"
patch -p2 -i "${srcdir}/specify-timestamp.patch"
}
build() {
[[ -d ${srcdir}/build-${MSYSTEM} ]] && rm -rf ${srcdir}/build-${MSYSTEM}
mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}
if check_option "debug" "y"; then
CFLAGS+=" -O0"
fi
declare -a extra_config=""
if [ "${CARCH}" = "x86_64" ]; then
extra_config+=('--enable-64-bit-bfd')
else
LDFLAGS+=" -Wl,--large-address-aware"
fi
../${_realname}-${pkgver}/configure \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--prefix=${MINGW_PREFIX} \
--disable-werror \
--enable-lto \
--with-sysroot=${MINGW_PREFIX} \
--with-libiconv-prefix=${MINGW_PREFIX} \
${extra_config[@]} \
--enable-nls \
--disable-rpath \
--disable-multilib \
--enable-install-libiberty \
--enable-plugins \
--disable-shared \
--enable-deterministic-archives
make
}
check() {
cd ${srcdir}/build-${MSYSTEM}
# unset LDFLAGS as testsuite makes assumptions about which ones are active
# do not abort on errors - manually check log files
make LDFLAGS="" -k check || true
}
package() {
cd ${srcdir}/build-${MSYSTEM}
make DESTDIR=${pkgdir} install
mkdir -p ${pkgdir}${MINGW_PREFIX}/{lib,include}/${_realname}
mv ${pkgdir}${MINGW_PREFIX}/include/*.h ${pkgdir}${MINGW_PREFIX}/include/${_realname}
cp ${pkgdir}${MINGW_PREFIX}/include/${_realname}/ansidecl.h ${pkgdir}${MINGW_PREFIX}/include/
mv ${pkgdir}${MINGW_PREFIX}/lib/*.a ${pkgdir}${MINGW_PREFIX}/lib/${_realname}
# https://github.com/msys2/MINGW-packages/issues/7890
rm "${pkgdir}${MINGW_PREFIX}/lib/bfd-plugins/libdep.a"
find ${pkgdir}${MINGW_PREFIX}/share -type f -iname "opcodes.mo" -o -iname "bfd.mo" | xargs -rtl1 rm
install -Dm644 ${srcdir}/${_realname}-${pkgver}/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
install -Dm644 ${srcdir}/${_realname}-${pkgver}/COPYING.LIB ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING.LIB
install -Dm644 ${srcdir}/${_realname}-${pkgver}/COPYING3 ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING3
install -Dm644 ${srcdir}/${_realname}-${pkgver}/COPYING3.LIB ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING3.LIB
}