-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
PKGBUILD
124 lines (103 loc) · 4.37 KB
/
PKGBUILD
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
# Maintainer: Alexey Pavlov <[email protected]>
# Contributor: Martell Malone <[email protected]>
# Contributor: Renato Silva <[email protected]>
_realname=winpthreads
pkgbase=mingw-w64-${_realname}-git
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-git" "${MINGW_PACKAGE_PREFIX}-libwinpthread-git")
pkgver=11.0.0.r404.g3a137bd87
pkgrel=1
_commit='3a137bd87ea83d174f4a225568b75cabdbc70852'
pkgdesc="MinGW-w64 winpthreads library"
url="https://www.mingw-w64.org/"
msys2_repository_url="https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-libraries/winpthreads"
# The main license of `winpthreads' is MIT, but parts of this library are
# derived from the "POSIX Threads for Microsoft Windows" library, which is
# licensed under BSD [1].
license=('MIT' 'BSD')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
groups=("${MINGW_PACKAGE_PREFIX}-toolchain")
makedepends=("git"
"${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-binutils"
"${MINGW_PACKAGE_PREFIX}-crt-git"
"${MINGW_PACKAGE_PREFIX}-headers-git")
options=('!emptydirs')
source=("mingw-w64"::"git+https://git.code.sf.net/p/mingw-w64/mingw-w64#commit=$_commit"
"0001-Define-__-de-register_frame_info-in-fake-libgcc_s.patch")
sha256sums=('SKIP'
'd9e8af81682d9bf70e3d87506f51156cec61260b810a234bce861cb2eb3a5919')
pkgver() {
cd "${srcdir}/mingw-w64"
git describe --long ${_commit} | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g'
}
prepare() {
cd "${srcdir}/mingw-w64"
[[ -f mingw-w64-libraries/winpthreads/src/libgcc/dll_frame_info.c ]] && rm -rf mingw-w64-libraries/winpthreads/src/libgcc/dll_frame_info.c
git apply "${srcdir}"/0001-Define-__-de-register_frame_info-in-fake-libgcc_s.patch
cd "${srcdir}"/mingw-w64/mingw-w64-libraries/winpthreads
autoreconf -vfi
}
build() {
[[ -d ${srcdir}/build-${MSYSTEM} ]] && rm -rf ${srcdir}/build-${MSYSTEM}
mkdir -p "${srcdir}"/build-${MSYSTEM} && cd ${srcdir}/build-${MSYSTEM}
declare -a extra_config
# https://github.com/msys2/MINGW-packages/issues/7043
extra_config+=("CPPFLAGS=${CPPFLAGS//-D__USE_MINGW_ANSI_STDIO=1/}")
if check_option "debug" "y"; then
extra_config+=("CFLAGS=-O0 -g -DWINPTHREAD_DBG")
extra_config+=("CXXFLAGS=-O0 -g -DWINPTHREAD_DBG")
extra_config+=("CXXFLAGS=")
fi
../mingw-w64/mingw-w64-libraries/winpthreads/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--enable-static \
--enable-shared \
"${extra_config[@]}"
# I failed to figure out how to disable stripping, this
# will have to do instead.
if check_option "strip" "n"; then
sed -i 's,^STRIP = .*$,STRIP = true,g' Makefile
sed -i 's,^STRIP=.*$,STRIP=true,g' libtool
sed -i 's,old_striplib=.*$strip,old_striplib=true,g' libtool
sed -i 's,striplib=.*$,striplib=true,g' libtool
fi
make
}
_install_licenses() {
# TODO: any more license files?
install -Dm644 ${srcdir}/mingw-w64/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/$1/COPYING
install -Dm644 ${srcdir}/mingw-w64/mingw-w64-libraries/winpthreads/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/$1/mingw-w64-libraries/winpthreads/COPYING
}
package_winpthreads-git() {
depends=("${MINGW_PACKAGE_PREFIX}-crt-git" "${MINGW_PACKAGE_PREFIX}-libwinpthread-git=${pkgver}")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}")
cd ${srcdir}/build-${MSYSTEM}
make DESTDIR=${pkgdir} install
rm -rf ${pkgdir}${MINGW_PREFIX}/bin
_install_licenses ${_realname}
}
package_libwinpthread-git() {
provides=("${MINGW_PACKAGE_PREFIX}-libwinpthread")
conflicts=("${MINGW_PACKAGE_PREFIX}-libwinpthread")
cd ${srcdir}/build-${MSYSTEM}
make DESTDIR=${pkgdir} install
rm -rf ${pkgdir}${MINGW_PREFIX}/include
rm -rf ${pkgdir}${MINGW_PREFIX}/lib
_install_licenses libwinpthread
}
# template start; name=mingw-w64-splitpkg-wrappers; version=1.0;
# vim: set ft=bash :
# generate wrappers
for _name in "${pkgname[@]}"; do
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
_func="$(declare -f "${_short}")"
eval "${_func/#${_short}/package_${_name}}"
done
# template end;
# [1] https://locklessinc.com/articles/pthreads_on_windows/