forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathPKGBUILD
205 lines (189 loc) · 7 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Maintainer: Alexey Pavlov <[email protected]>
_realname=curl
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-${_realname}-gnutls"
"${MINGW_PACKAGE_PREFIX}-${_realname}-winssl")
pkgver=7.83.1
pkgrel=1
pkgdesc="Command line tool and library for transferring data with URLs. (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://curl.se/"
license=("MIT")
_cert_depends=("${MINGW_PACKAGE_PREFIX}-ca-certificates"
"${MINGW_PACKAGE_PREFIX}-libssh2")
_openssl_depends=("${MINGW_PACKAGE_PREFIX}-openssl"
"${MINGW_PACKAGE_PREFIX}-nghttp2")
_gnutls_depends=("${MINGW_PACKAGE_PREFIX}-rtmpdump"
"${MINGW_PACKAGE_PREFIX}-gnutls")
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-cc"
"${_cert_depends[@]}"
"${_openssl_depends[@]}"
"${_gnutls_depends[@]}")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-c-ares"
"${MINGW_PACKAGE_PREFIX}-brotli"
"${MINGW_PACKAGE_PREFIX}-libidn2"
"${MINGW_PACKAGE_PREFIX}-libpsl"
"${MINGW_PACKAGE_PREFIX}-zlib"
"${MINGW_PACKAGE_PREFIX}-zstd")
options=('staticlibs')
source=("https://github.com/curl/curl/releases/download/${_realname}-${pkgver//./_}/${_realname}-${pkgver}.tar.xz"{,.asc}
"pathtools.c"
"pathtools.h"
"0001-Make-cURL-relocatable.patch"
"0002-nghttp2-static.patch"
"0003-libpsl-static-libs.patch")
sha256sums=('2cb9c2356e7263a1272fd1435ef7cdebf2cd21400ec287b068396deb705c22c4'
'SKIP'
'703cd0cb74e714f9e66d26de11c109dd76fab07e723af8dde56a35ea65102e5f'
'4f9d325265ef6f4e90ad637dea41afa6995388c921fe961ad5dc895aca10318b'
'c4e6bfd5b58f944d75293128effbd22fe42ee0131b915d9230ceb3c004c0322d'
'79eec8a337e375d5102fef884030ceacd163a79e5c495e9a974a6b9a11b60c61'
'7492d019036b5bec251bfbc3c0b40e5f16d3dd6b2515068835e087a6c21f19ad')
validpgpkeys=('914C533DF9B2ADA2204F586D78E11C6B279D5C91' # Daniel Stenberg
'27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2'
'4461EAF0F8E9097F48AF0555F9FEAFF9D34A1BDB')
prepare() {
test ! -d "${startdir}/../mingw-w64-pathtools" || {
cmp "${startdir}/../mingw-w64-pathtools/pathtools.c" "${srcdir}/pathtools.c" &&
cmp "${startdir}/../mingw-w64-pathtools/pathtools.h" "${srcdir}/pathtools.h"
} || exit 1
cd "${srcdir}/${_realname}-${pkgver}"
cp -fHv "${srcdir}"/pathtools.[ch] lib/
patch -p1 -i "${srcdir}/0001-Make-cURL-relocatable.patch"
patch -p1 -i "${srcdir}/0002-nghttp2-static.patch"
patch -p1 -i "${srcdir}/0003-libpsl-static-libs.patch"
autoreconf -vfi
}
do_build() {
_variant=$1
_destdir="${srcdir}/build-${MSYSTEM}"
if [ "${_variant}" != "-openssl" ]; then
_destdir="${_destdir}${_variant}"
fi
local -a extra_config
if check_option "debug" "y"; then
extra_config+=( --enable-debug )
else
extra_config+=( --disable-debug )
fi
local -a _variant_config
if [ "${_variant}" = "-winssl" ]; then
_variant_config+=("--with-schannel")
_variant_config+=('--without-nghttp2')
_variant_config+=("--without-ca-bundle")
_variant_config+=("--without-ca-path")
_variant_config+=("--without-librtmp")
elif [ "${_variant}" = "-gnutls" ]; then
_variant_config+=("--with-default-ssl-backend=gnutls")
_variant_config+=("--with-gnutls")
_variant_config+=("--with-schannel")
_variant_config+=('--without-nghttp2')
_variant_config+=("--with-ca-bundle=${MINGW_PREFIX}/ssl/certs/ca-bundle.crt")
_variant_config+=("--with-librtmp")
elif [ "${_variant}" = "-openssl" ]; then
_variant_config+=("--with-default-ssl-backend=openssl")
_variant_config+=("--with-openssl")
_variant_config+=("--with-schannel")
_variant_config+=("--with-ca-bundle=${MINGW_PREFIX}/ssl/certs/ca-bundle.crt")
_variant_config+=("--with-nghttp2=${MINGW_PREFIX}")
_variant_config+=("--without-librtmp")
fi
mkdir -p "${_destdir}-static" && cd "${_destdir}-static"
../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--disable-pthreads \
--without-random \
--enable-static \
--disable-shared \
--enable-sspi \
--enable-ldap \
--enable-ldaps \
--with-brotli \
--with-ldap-lib=wldap32 \
--with-libssh2 \
--with-zstd \
"${_variant_config[@]}" \
"${extra_config[@]}"
# there's a bug with zsh completion generation script and Windows.
# curl has to specified with the file extension.
sed -i "s|\/curl > \$\@|\/curl\$\{EXEEXT\} > \$\@|" scripts/Makefile
make
mkdir -p "${_destdir}-shared" && cd "${_destdir}-shared"
../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--disable-pthreads \
--without-random \
--disable-static \
--enable-shared \
--enable-sspi \
--enable-ldap \
--enable-ldaps \
--with-brotli \
--with-ldap-lib=wldap32 \
--with-libssh2 \
--with-zstd \
"${_variant_config[@]}" \
"${extra_config[@]}"
# there's a bug with zsh completion generation script and Windows.
# curl has to specified with the file extension.
sed -i "s|\/curl > \$\@|\/curl\$\{EXEEXT\} > \$\@|" scripts/Makefile
make
}
build() {
do_build -openssl
do_build -winssl
do_build -gnutls
}
do_package() {
cd "${srcdir}/build-${MSYSTEM}$1-static"
make DESTDIR="${pkgdir}" install
cd "${srcdir}/build-${MSYSTEM}$1-shared"
make DESTDIR="${pkgdir}" install
local PREFIX_DEPS=$(cygpath -am ${MINGW_PREFIX})
sed -s "s|${PREFIX_DEPS}|${MINGW_PREFIX}|g" -i ${pkgdir}${MINGW_PREFIX}/bin/curl-config
sed -s "s|${PREFIX_DEPS}|${MINGW_PREFIX}|g" -i ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/libcurl.pc
}
package_curl() {
depends=("${depends[@]}"
"${_cert_depends[@]}"
"${_openssl_depends[@]}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}-winssl"
"${MINGW_PACKAGE_PREFIX}-${_realname}-gnutls")
do_package
}
package_curl-winssl() {
depends=("${depends[@]}"
"${MINGW_PACKAGE_PREFIX}-libssh2-wincng")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-${_realname}-gnutls")
do_package -winssl
}
package_curl-gnutls() {
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
depends=("${depends[@]}"
"${_cert_depends[@]}"
"${_gnutls_depends[@]}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-${_realname}-winssl")
do_package -gnutls
}
# 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;