jobcore/curl/PKGBUILD

196 lines
6 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://git.disroot.org/joborun-pkg/jobcore/src/branch/main/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=curl
pkgname=(curl libcurl-compat libcurl-gnutls)
pkgver=8.9.1
pkgrel=03
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=("git+https://github.com/curl/curl.git#tag=curl-${pkgver//./_}?signed")
_backports=(
'3eec5afbd0b6377eca893c392569b2faf094d970' # https://github.com/curl/curl/issues/14344
)
_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
# 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'
)
# if some tests fail and want to rebuild --nocheck with existing
# work comment this next line out for makepkg -e --nocheck
mkdir build-curl{,-compat,-gnutls}
# build curl
cd "${srcdir}"/build-curl
"${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}"/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}"/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=('402e12ad615c1db98df9cc8199d46f5c7a9bd174a457e469acbd9d3f567cc36b2db1fc3a010c3aa8e752da182f48d3b4590c98f15f6fad6ed063c4224d794442')
sha256sums=(357a5b20ee69803f2f180a42932353c39fef196190994441efdccaff05c9a718) # curl
## 222b5c0ff40dae2292a0bcaf175d412407321c5a724e31aa25d1fc076d77cb1a curl-8.9.1-03-x86_64.pkg.tar.lz
## b80367a0f012ea7b4af9d06a0a83c1f76012a1334d7bf85380d3cc55144341f7 libcurl-compat-8.9.1-03-x86_64.pkg.tar.lz
## 0a8ad9558f7170cf2b238f759d767bec08c78ff27d6ba4e0b360c571666e35a2 libcurl-gnutls-8.9.1-03-x86_64.pkg.tar.lz