jobcore/curl/PKGBUILD
2023-09-13 18:54:19 +03:00

191 lines
5.6 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='8c537ee308eca91d0a240315b24025048ae54e61' # git rev-parse v${_tag_name}
_tag_name='8_3_0'
pkgver="${_tag_name//_/.}"
pkgrel=01
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' 'libpsl' 'libpsl.so' 'libssh2' 'libssh2.so'
'openssl' 'zlib')
makedepends=('patchelf' 'git')
provides=('libcurl.so')
#source=("https://curl.haxx.se/download/${pkgname}-${pkgver}.tar.gz"{,.asc}
# '0001-Revert-http2-minor-buffer-and-error-path-fixes.patch')
source=("git+https://github.com/bagder/curl.git#tag=${_tag}?signed")
_backports=(
# # http2: double http request parser max line length
# '77c9a9845bbee66f3aff158b8452dc8cd963cbd5'
#
# # urlapi: allow numerical parts in the host name
# '92772e6d395bbdda0e7822d980caf86e8c4aa51c'
#
# # http2: fix EOF handling on uploads with auth negotiation
# 5c58cb0212bcf63cce33a974906bf9905948b4bb
# 'c1effdfe658ae505e8ea65e5f46d810c4b8d81cb'
# '0470577eb4524f09d245e9e6afd42ba8677a5a19'
)
_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 "${_tag}")\"" \
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[@]}" \
--with-openssl \
--enable-versioned-symbols
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[@]}" \
--with-openssl \
--disable-versioned-symbols
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make -C lib
# build libcurl-gnutls
cd "${srcdir}"/build-curl-gnutls
# "${srcdir}/${pkgbase}-${pkgver}"/configure \
"${srcdir}/${pkgbase}"/configure \
"${_configure_options[@]}" \
--disable-versioned-symbols \
--without-openssl \
--without-zstd \
--with-gnutls
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
}
package_curl() {
cd build-curl
make DESTDIR="${pkgdir}" install
make DESTDIR="${pkgdir}" install -C scripts
# cd "${srcdir}/${pkgname}-${pkgver}"
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' 'openssl')
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}
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
sha256sums=(SKIP)
## f79fc9758652a19180ad6adc2b2bc94ccaa5403d90b7f9da0ddb4d10e6cb88da curl-8.3.0-01-x86_64.pkg.tar.lz
## c733628675c75c5233cd3a25cdcb2777292159790315d46b3235a2f234dff297 libcurl-compat-8.3.0-01-x86_64.pkg.tar.lz
## 2cdbd82eb6094bae1e2194ca07fc75fdb09571adafcfd11d6b3aab3bde6d8423 libcurl-gnutls-8.3.0-01-x86_64.pkg.tar.lz