jobcore/curl/PKGBUILD

221 lines
7.0 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=curl
pkgname=(curl libcurl-compat libcurl-gnutls)
#_tag='8cd1397d3c5c9b1526c8d74530266a7a9a22294b' # git rev-parse v${_tag_name}
#_tag_name='8_6_0'
#pkgver="${_tag_name//_/.}"
pkgver=8.7.1
pkgrel=06
pkgdesc='command line tool and library for transferring data with URLs - w/o ipv6 & zstd'
url='https://curl.se'
#options=(debug) # uncomment this to produce debug package
depends=('ca-certificates' 'brotli' 'libbrotlidec.so' 'krb5' 'libgssapi_krb5.so'
'libidn2' 'libidn2.so' 'libnghttp2' 'libnghttp3' 'libpsl'
'libpsl.so' 'libssh2' 'libssh2.so' 'zlib')
makedepends=('patchelf' 'git')
checkdepends=('valgrind')
#source=("https://curl.haxx.se/download/${pkgname}-${pkgver}.tar.gz"{,.asc}
#source=("git+https://github.com/curl/curl.git#tag=${_tag}?signed")
source=("git+https://github.com/curl/curl.git#tag=curl-${pkgver//./_}?signed"
'0001-bump-version-to-match-last-tag.patch'
'curl-8_7_1-h2-ngtcp2-write-error-handling.patch')
_backports=(
# content_encoding: brotli and others, pass through 0-length writes
'b30d694a027eb771c02a3db0dee0ca03ccab7377'
# http: with chunked POST forced, disable length check on read callback
'721941aadf4adf4f6aeb3f4c0ab489bb89610c36'
# Fix CURLINFO_REQUEST_SIZE, add tests for transfer infos reported
'2793acbfc5e89fb130b1d4e045cb6cd7b6549412'
)
_reverts=(
)
prepare() {
cd "$pkgbase"
local _c
for _c in "${_backports[@]}"; do
if [[ $_c == *..* ]]; then
git log --oneline --reverse "${_c}"
else
git log --oneline -1 "${_c}"
fi
git cherry-pick -n -m1 "${_c}"
done
for _c in "${_reverts[@]}"; do
git log --oneline -1 "${_c}"
git revert -n "${_c}"
done
patch -Np1 < ../0001-bump-version-to-match-last-tag.patch
# https://github.com/curl/curl/issues/13474 backported for 8.7.1
patch -Np1 < ../curl-8_7_1-h2-ngtcp2-write-error-handling.patch
# no '-DEV' in version, release date from tagged commit...
sed -i \
-e "/\WLIBCURL_VERSION\W/c #define LIBCURL_VERSION \"${pkgver}\"" \
-e "/\WLIBCURL_TIMESTAMP\W/c #define LIBCURL_TIMESTAMP \"$(git log -1 --format=%cs "curl-${pkgver//./_}")\"" \
include/curl/curlver.h
autoreconf -fi
}
build() {
local _configure_options=(
--prefix='/usr'
--mandir='/usr/share/man'
--disable-ldap
--disable-ldaps
--disable-manual
--disable-ipv6
--disable-zstd
--enable-threaded-resolver
--with-gssapi
--with-libssh2
--with-random='/dev/urandom'
--without-zstd
--with-ca-bundle='/etc/ssl/certs/ca-certificates.crt'
)
mkdir build-curl{,-compat,-gnutls}
# build curl
cd "${srcdir}"/build-curl
# "${srcdir}/${pkgbase}-${pkgver}"/configure \
"${srcdir}/${pkgbase}"/configure \
"${_configure_options[@]}" \
--enable-versioned-symbols \
--with-fish-functions-dir=/usr/share/fish/vendor_completions.d/ \
--with-openssl \
--with-openssl-quic \
--with-zsh-functions-dir=/usr/share/zsh/site-functions/
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make
# build libcurl-compat
cd "${srcdir}"/build-curl-compat
# "${srcdir}/${pkgbase}-${pkgver}"/configure \
"${srcdir}/${pkgbase}"/configure \
"${_configure_options[@]}" \
--disable-versioned-symbols \
--with-openssl \
--with-openssl-quic
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make -C lib
patchelf --set-soname 'libcurl-compat.so.4' ./lib/.libs/libcurl.so
# build libcurl-gnutls
cd "${srcdir}"/build-curl-gnutls
# "${srcdir}/${pkgbase}-${pkgver}"/configure \
"${srcdir}/${pkgbase}"/configure \
"${_configure_options[@]}" \
--disable-versioned-symbols \
--with-gnutls \
--without-openssl \
--without-zstd
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make -C lib
patchelf --set-soname 'libcurl-gnutls.so.4' ./lib/.libs/libcurl.so
}
check() {
cd build-curl
# -v: verbose
# -a: keep going on failure (so we see everything which breaks, not just the first failing test)
# -k: keep test files after completion
# -am: automake style TAP output
# -p: print logs if test fails
# -j: parallelization
# disable test 433, since it requires the glibc debug info
make TFLAGS="-v -a -k -p -j$(nproc) !433" test-nonflaky
}
package_curl() {
depends+=('openssl' 'libcrypto.so' 'libssl.so')
provides=('libcurl.so')
cd build-curl
make DESTDIR="${pkgdir}" install
make DESTDIR="${pkgdir}" install -C scripts
cd "${srcdir}/${pkgname}"
# license
install -Dt "${pkgdir}/usr/share/licenses/$pkgname" -m0644 COPYING
}
package_libcurl-compat() {
pkgdesc='command line tool and library for transferring data with URLs (no versioned symbols)'
depends=('curl')
provides=('libcurl-compat.so')
cd "${srcdir}"/build-curl-compat
make -C lib DESTDIR="${pkgdir}" install
mv "${pkgdir}"/usr/lib/libcurl{,-compat}.so.4.8.0
rm "${pkgdir}"/usr/lib/libcurl.{a,so}*
for version in 3 4.0.0 4.1.0 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0; do
ln -s libcurl-compat.so.4.8.0 "${pkgdir}"/usr/lib/libcurl.so.${version}
ln -s libcurl-compat.so.4.8.0 "${pkgdir}"/usr/lib/libcurl-compat.so.${version}
done
install -dm 0755 "${pkgdir}"/usr/share/licenses
ln -s curl "${pkgdir}"/usr/share/licenses/libcurl-compat
}
package_libcurl-gnutls() {
pkgdesc='command line tool and library for transferring data with URLs (no versioned symbols, linked against gnutls)'
depends=('curl' 'gnutls')
provides=('libcurl-gnutls.so')
cd "${srcdir}"/build-curl-gnutls
make -C lib DESTDIR="${pkgdir}" install
mv "${pkgdir}"/usr/lib/libcurl{,-gnutls}.so.4.8.0
rm "${pkgdir}"/usr/lib/libcurl.{a,so}*
ln -s libcurl-gnutls.so.4 "${pkgdir}"/usr/lib/libcurl-gnutls.so
for version in 3 4 4.0.0 4.1.0 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0; do
ln -s libcurl-gnutls.so.4.8.0 "${pkgdir}"/usr/lib/libcurl-gnutls.so.${version}
done
install -dm 0755 "${pkgdir}"/usr/share/licenses
ln -s curl "${pkgdir}"/usr/share/licenses/libcurl-gnutls
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('MIT')
validpgpkeys=('27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2') # Daniel Stenberg
sha512sums=('38b55dc916a64a1fd40a8af3e9a694ae918f8efb714430834491ebbe0ceeee4b58ba804afa15da966cbcf9cd7100ce373aed7b2101dff56f742996072caaf09a'
'51df4903eff9f1a15b1317ea4a8ee2b8537f347984f2524f42213b09344cd6109c621a4b81b37d2fcf2027387bb81cf0a744a48e96b86c4e268c43261ff86845'
'5af6c46ac6bfc39963d22450721f89770fd3ebbe198186c0a95ee3b16b8f89722d8d2d230ec21fdd9a52b949be5704c6980802e2052eec325085f60881f32c1f') # curl-8_7_1-h2-ngtcp2-write-error-handling.patch
sha256sums=(SKIP
e05b46b3cea5ca4dfa39fdaa5d8f85095e5fc3dda9fc460cfdc002c5d7670357 # 0001-bump-version-to-match-last-tag.patch
f19681b7da011c39acb98d32103b3ce4eb18c943fc6620cfa435d1234cfb54b6) # curl-8_7_1-h2-ngtcp2-write-error-handling.patch
##