Skip to content

Commit

Permalink
re-add zstd support, enabled in the "big" builds [ci skip]
Browse files Browse the repository at this point in the history
Strictly experimental, might be gone in a next commit.

```
curl 7.84.0 (x86_64-w64-mingw32) libcurl/7.84.0 BoringSSL/7528f03c (Schannel) zlib/1.2.12 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.3 libpsl/0.21.1 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.48.0 ngtcp2/0.6.0 nghttp3/0.5.0 libgsasl/1.10.0
Release-Date: 2022-06-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli gsasl HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd
```
  • Loading branch information
vszakats committed Jul 15, 2022
1 parent 9a26e58 commit e806006
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ Libs: -lcurl -lz -lcrypt32 -lwldap32 -lnghttp2 -lssh2 -lgsasl -lbcrypt -lssl -lc
```
"big":
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli gsasl HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets
Libs: -lcurl -lz -lcrypt32 -lwldap32 -lnghttp2 -lssh2 -lgsasl -lssl -lcrypto -lidn2 -lbrotlidec -lbrotlicommon -lnghttp3 -lngtcp2 -lpsl -liconv -lunistring
Features: alt-svc AsynchDNS brotli gsasl HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd
Libs: -lcurl -lz -lcrypt32 -lwldap32 -lnghttp2 -lssh2 -lgsasl -lssl -lcrypto -lidn2 -lbrotlidec -lbrotlicommon -lnghttp3 -lngtcp2 -lpsl -liconv -lunistring -lzstd
"boringssl":
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Expand Down
2 changes: 2 additions & 0 deletions _build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o p
# Supported build tools:
#
# zlib cmake
# zstd cmake
# brotli cmake
# libunistring autotools
# libiconv autotools
Expand Down Expand Up @@ -687,6 +688,7 @@ build_single_target() {
} >> "${_UNIMFT}"

bld zlib "${ZLIB_VER_}"
bld zstd "${ZSTD_VER_}"
bld brotli "${BROTLI_VER_}"
bld libunistring "${LIBUNISTRING_VER_}"
bld libiconv "${LIBICONV_VER_}"
Expand Down
11 changes: 11 additions & 0 deletions _dl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ cat <<EOF
"sig": ".asc",
"keys": "5ED46A6721D365587791E2AA783FCD8E58BCAFBA"
},
{
"name": "zstd",
"url": "https://github.com/facebook/zstd/releases/download/v{ver}/zstd-{ver}.tar.gz",
"sig": ".sig",
"sha": ".sha256",
"redir": "redir",
"keys": "4EF4AC63455FC9F4545D9B7DEF8FE99528B52FFD"
},
{
"name": "pefile",
"url": "https://github.com/erocarrera/pefile/releases/download/v{ver}/pefile-{ver}.tar.gz",
Expand Down Expand Up @@ -533,6 +541,9 @@ if [ "${_BRANCH#*pico*}" = "${_BRANCH}" ] && \
fi

if [ "${_BRANCH#*big*}" != "${_BRANCH}" ]; then
live_dl zstd "${ZSTD_VER_}"
live_xt zstd "${ZSTD_HASH}"

live_dl libunistring "${LIBUNISTRING_VER_}"
live_xt libunistring "${LIBUNISTRING_HASH}"
live_dl libiconv "${LIBICONV_VER_}"
Expand Down
2 changes: 2 additions & 0 deletions _versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export LIBRESSL_VER_='3.5.3'
export LIBRESSL_HASH=3ab5e5eaef69ce20c6b170ee64d785b42235f48f2e62b095fca5d7b6672b8b28
export ZLIB_VER_='1.2.12'
export ZLIB_HASH=7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18
export ZSTD_VER_='1.5.2'
export ZSTD_HASH=7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0
export LLVM_MINGW_LINUX_VER_='20220323'
export LLVM_MINGW_LINUX_HASH=6d69ab28a3a9a2b7159178ff11cae8545fd44c9343573900fcf60434539695d8
export LLVM_MINGW_MAC_VER_="${LLVM_MINGW_LINUX_VER_}"
Expand Down
9 changes: 7 additions & 2 deletions curl-autotools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ fi
else
options="${options} --without-brotli"
fi

options="${options} --without-zstd"
if [ -d ../zstd ]; then
options="${options} --with-zstd=${_TOP}/zstd/${_PP}"
LDFLAGS="${LDFLAGS} -L${_TOP}/zstd/${_PP}/lib"
LIBS="${LIBS} -lzstd"
else
options="${options} --without-zstd"
fi

options="${options} --with-schannel"
CPPFLAGS="${CPPFLAGS} -DHAS_ALPN"
Expand Down
7 changes: 7 additions & 0 deletions curl-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ _VER="$1"
else
options="${options} -DCURL_BROTLI=OFF"
fi
if [ -d ../zstd ]; then
options="${options} -DCURL_ZSTD=ON"
options="${options} -DZstd_LIBRARY=${_TOP}/zstd/${_PP}/lib/libzstd.a"
options="${options} -DZstd_INCLUDE_DIR=${_TOP}/zstd/${_PP}/include"
else
options="${options} -DCURL_ZSTD=OFF"
fi

if [ -d ../libressl ]; then
options="${options} -DCURL_USE_OPENSSL=ON"
Expand Down
5 changes: 5 additions & 0 deletions curl-m32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ _VER="$1"
export BROTLI_PATH="../../brotli/${_PP}"
export BROTLI_LIBS='-Wl,-Bstatic -lbrotlidec -lbrotlicommon -Wl,-Bdynamic'
fi
if [ -d ../zstd ]; then
options="${options}-zstd"
export ZSTD_PATH="../../zstd/${_PP}"
export ZSTD_LIBS='-Wl,-Bstatic -lzstd -Wl,-Bdynamic'
fi

export OPENSSL_LIBS=''
if [ -d ../libressl ]; then
Expand Down
66 changes: 66 additions & 0 deletions zstd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/sh

# Copyright 2017-present Viktor Szakats. See LICENSE.md

# shellcheck disable=SC3040
set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail

export _NAM _VER _OUT _BAS _DST

_NAM="$(basename "$0" | cut -f 1 -d '.')"
_VER="$1"

(
cd "${_NAM}" || exit 0

rm -r -f "${_PKGDIR}" "${_BLDDIR}"

_CFLAGS="${_CFLAGS_GLOBAL} ${_CPPFLAGS_GLOBAL}"

# shellcheck disable=SC2086
cmake build/cmake -B "${_BLDDIR}" ${_CMAKE_GLOBAL} ${_CMAKE_CXX_GLOBAL} \
'-DZSTD_BUILD_CONTRIB=OFF' \
'-DZSTD_BUILD_TESTS=OFF' \
'-DZSTD_LEGACY_SUPPORT=OFF' \
'-DZSTD_BUILD_PROGRAMS=OFF' \
'-DZSTD_PROGRAMS_LINK_SHARED=OFF' \
'-DZSTD_BUILD_SHARED=OFF' \
'-DZSTD_BUILD_STATIC=ON' \
'-DZSTD_MULTITHREAD_SUPPORT=OFF' \
"-DCMAKE_C_FLAGS=-Wno-unused-command-line-argument ${_CFLAGS} ${_LDFLAGS_GLOBAL} ${_LIBS_GLOBAL}" \
"-DCMAKE_CXX_FLAGS=-Wno-unused-command-line-argument ${_CFLAGS} ${_LDFLAGS_GLOBAL} ${_LIBS_GLOBAL} ${_CXXFLAGS_GLOBAL} ${_LDFLAGS_CXX_GLOBAL}"

make --directory="${_BLDDIR}" --jobs="${_JOBS}" install "DESTDIR=$(pwd)/${_PKGDIR}"

_pkg="${_PP}" # DESTDIR= + _PREFIX

# Delete .pc files
rm -r -f "${_pkg}"/lib/pkgconfig

# Make steps for determinism

readonly _ref='CHANGELOG'

"${_STRIP}" --enable-deterministic-archives --strip-debug "${_pkg}"/lib/*.a

touch -c -r "${_ref}" "${_pkg}"/include/*.h
touch -c -r "${_ref}" "${_pkg}"/lib/*.a

# Create package

_OUT="${_NAM}-${_VER}${_REVSUFFIX}${_PKGSUFFIX}"
_BAS="${_NAM}-${_VER}${_PKGSUFFIX}"
_DST="$(mktemp -d)/${_BAS}"

mkdir -p "${_DST}"
mkdir -p "${_DST}/include"
mkdir -p "${_DST}/lib"

cp -f -p "${_pkg}"/include/*.h "${_DST}/include/"
cp -f -p "${_pkg}"/lib/*.a "${_DST}/lib/"
cp -f -p CHANGELOG "${_DST}/CHANGELOG.txt"
cp -f -p README.md "${_DST}/"
cp -f -p LICENSE "${_DST}/LICENSE.txt"

../_pkg.sh "$(pwd)/${_ref}"
)

0 comments on commit e806006

Please sign in to comment.