cURL-build-win32/build.sh

415 lines
22 KiB
Bash
Raw Normal View History

2021-06-07 22:14:25 +02:00
#!/bin/bash
2021-06-17 21:14:38 +02:00
# _ _ ____ _
# ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
2021-06-07 22:14:25 +02:00
set -e
2021-06-20 16:22:12 +02:00
trap 'read -p "Press any key..." x' EXIT
2021-06-07 22:14:25 +02:00
2023-12-07 01:29:52 +01:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# cURL version
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-09-13 00:35:16 +02:00
readonly MY_VERSION=8.10.0
2023-12-07 01:29:52 +01:00
###############################################################################
# PREPARATION
###############################################################################
2021-06-13 20:11:58 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-02-11 01:05:17 +01:00
# Check bash version
2021-06-13 20:11:58 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-02-11 01:05:17 +01:00
if [ -z "${BASH}" ] || [ ${BASH_VERSINFO[0]} -lt 5 ]; then
echo 'This script requires BASH 5.x or newer !!!'
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check environment
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly UNAME_SPEC="$(uname -so)"
if [[ "${UNAME_SPEC,,}" =~ ^mingw(32|64)(.*)msys$ ]]; then
echo "Running on: ${UNAME_SPEC}"
else
echo 'This script is supposed to run on MSYS2/Mingw-w64 !!!'
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check C compiler
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly CC_TARGET="$(cc -dumpmachine)"
if [[ "${CC_TARGET,,}" =~ w64-mingw(32|64)$ ]]; then
echo "Target arch: ${CC_TARGET}"
else
if [[ -n "${CC_TARGET}" ]]; then
echo 'This script is supposed to run on MSYS2/Mingw-w64 !!!'
else
echo 'Sorry, no working C compiler found !!!'
fi
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set up the compiler flags
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case "${CC_TARGET}" in
2021-06-13 16:15:09 +02:00
i686-*)
2021-06-13 17:44:41 +02:00
readonly MY_CPU=x86
2021-06-18 01:48:56 +02:00
readonly MY_MARCH=i486
2021-06-13 16:15:09 +02:00
readonly MY_MTUNE=intel
;;
x86_64-*)
2021-06-13 17:44:41 +02:00
readonly MY_CPU=x64
2021-06-13 16:15:09 +02:00
readonly MY_MARCH=x86-64
2022-06-28 22:49:30 +02:00
readonly MY_MTUNE=znver3
2021-06-13 16:15:09 +02:00
;;
*)
2024-02-11 01:05:17 +01:00
echo "Unknown compiler arch detected !!!";
2021-06-13 16:15:09 +02:00
exit 1
;;
esac
2021-06-07 22:14:25 +02:00
2021-06-13 20:11:58 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-02-11 01:05:17 +01:00
# Base directory
2021-06-13 20:11:58 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-06-07 22:14:25 +02:00
readonly BASE_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
2024-02-11 01:05:17 +01:00
if [ ! -d "${BASE_DIR}/build" ]; then
echo 'Failed to find the "build" directory !!!';
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Mutex
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-02-12 00:29:35 +01:00
readonly SIGNATURE="$(date +"%s")-$$"
2024-02-11 01:05:17 +01:00
readonly LOCK_FILE="${BASE_DIR}/build/lockfile.${MY_CPU}"
readonly TEMP_FILE="$(mktemp /tmp/lockfile_XXXXX)"
2024-02-12 00:29:35 +01:00
printf "%s" "${SIGNATURE}" > "${TEMP_FILE}"
mv -n "${TEMP_FILE}" "${LOCK_FILE}"; rm -f "${TEMP_FILE}"
if [ "$(sed '/^$/d' "${LOCK_FILE}" | head -n1)" != "${SIGNATURE}" ] ; then
2024-02-11 01:05:17 +01:00
echo 'Error: Build process is already in progress !!!'
exit 1
else
trap "rm -f \"${LOCK_FILE}\"; read -p \"Press any key...\" x" EXIT
2024-02-11 01:05:17 +01:00
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Logfile
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exec &> >(tee "${BASE_DIR}/build/curl_build-${MY_CPU}.log")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Initialize paths
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-02-06 23:03:54 +01:00
readonly WORK_DIR="${BASE_DIR}/build/${MY_CPU}"
2024-02-11 01:05:17 +01:00
readonly PKGS_DIR="${WORK_DIR}/_pkgs"
readonly DEPS_DIR="${WORK_DIR}/_deps"
for i in {1..12}; do rm -rf "${WORK_DIR}" && break; done
mkdir -v "${WORK_DIR}"
mkdir -p "${PKGS_DIR}" "${DEPS_DIR}/bin" "${DEPS_DIR}/include" "${DEPS_DIR}/lib/pkgconfig" "${DEPS_DIR}/share"
###############################################################################
# DOWNLOAD SOURCES
###############################################################################
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Helper function
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function fetch_pkg () {
if ! wget -4 --tries=8 --retry-connrefused -O "${2}" "${3}"; then
return 1
fi
local checksum_computed="$(sha256sum -b "${2}" | head -n 1 | grep -Po '^[[:xdigit:]]+')"
if ! [[ "${checksum_computed,,}" == "${1,,}" || "${1}" =~ ^z{64} ]]; then
printf "Checksum mismatch detected!\n* Expected: %s\n* Computed: %s\n" "${1,,}" "${checksum_computed,,}"
return 1
fi
}
2021-06-07 22:14:25 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Download
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-02-11 01:05:17 +01:00
printf "\n==================== download ====================\n\n"
fetch_pkg "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23" "${PKGS_DIR}/zlib.tar.gz" https://zlib.net/zlib-1.3.1.tar.gz
fetch_pkg "8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1" "${PKGS_DIR}/zstd.tar.gz" https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz
fetch_pkg "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff" "${PKGS_DIR}/brotli.tar.gz" https://github.com/google/brotli/archive/refs/tags/v1.1.0.tar.gz
fetch_pkg "e7e514ea033c290f09c7250dd43a845bc1e08066b793274f3ad3fe04c76a5206" "${PKGS_DIR}/openssl.tar.gz" https://github.com/quictls/openssl/archive/refs/tags/openssl-3.1.7-quic1.tar.gz
fetch_pkg "c68e05989a93c002e3ba8df3baef0021c17099aa2123a9c096a5cc8e029caf95" "${PKGS_DIR}/rtmpdump.tar.gz" https://distfiles.macports.org/rtmpdump/f1b83c10d8beb43fcc70a6e88cf4325499f25857.tar.gz
fetch_pkg "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313" "${PKGS_DIR}/libiconv.tar.gz" https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
fetch_pkg "ec1705b1e969b83a9f073144ec806151db88127f5e40fe5a94cb6c8fa48996a0" "${PKGS_DIR}/gettext.tar.gz" https://ftp.gnu.org/pub/gnu/gettext/gettext-0.22.5.tar.gz
fetch_pkg "3736161e41e2693324deb38c26cfdc3efe6209d634ba4258db1cecff6a5ad461" "${PKGS_DIR}/libssh2.tar.gz" https://www.libssh2.org/download/libssh2-1.11.0.tar.gz
fetch_pkg "d0b0b9d00500ee4aa3bfcac00145d3b1ef372fd301c35bff96cf019c739db1b4" "${PKGS_DIR}/nghttp2.tar.gz" https://github.com/nghttp2/nghttp2/releases/download/v1.62.1/nghttp2-1.62.1.tar.gz
fetch_pkg "43a78073b103acd4668c8d3314eb98e5d002095c1e49014e48ca20bd3094408f" "${PKGS_DIR}/nghttp3.tar.gz" https://github.com/ngtcp2/nghttp3/releases/download/v1.4.0/nghttp3-1.4.0.tar.gz
fetch_pkg "0c6f140268ef80a86b146714f7dc7c03a94699d019cd1815870ba222cb112bf0" "${PKGS_DIR}/ngtcp2.tar.gz" https://github.com/ngtcp2/ngtcp2/releases/download/v1.6.0/ngtcp2-1.6.0.tar.gz
fetch_pkg "4c21a791b610b9519b9d0e12b8097bf2f359b12f8dd92647611a929e6bfd7d64" "${PKGS_DIR}/libidn2.tar.gz" https://ftp.gnu.org/gnu/libidn/libidn2-2.3.7.tar.gz
fetch_pkg "1dcc9ceae8b128f3c0b3f654decd0e1e891afc6ff81098f227ef260449dae208" "${PKGS_DIR}/libpsl.tar.gz" https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz
fetch_pkg "f1b553384dedbd87478449775546a358d6f5140c15cccc8fb574136fdc77329f" "${PKGS_DIR}/libgsasl.tar.gz" https://ftp.gnu.org/gnu/gsasl/libgsasl-1.10.0.tar.gz
2024-09-13 00:35:16 +02:00
fetch_pkg "58c9dcf73493ae9d181fd334b3b3987ff73124621565187ade237bff1064a716" "${PKGS_DIR}/curl.tar.gz" https://curl.se/download/curl-${MY_VERSION}.tar.gz
2024-08-01 21:15:14 +02:00
fetch_pkg "1bf458412568e134a4514f5e170a328d11091e071c7110955c9884ed87972ac9" "${PKGS_DIR}/cacert.pem" https://curl.se/ca/cacert-2024-07-02.pem
fetch_pkg "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" "${PKGS_DIR}/manpage.html" https://curl.se/docs/manpage.html
###############################################################################
# BUILD DEPENDENCIES
###############################################################################
2021-06-07 22:14:25 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# zlib
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== zlib ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly ZLIB_DIR="${WORK_DIR}/zlib"
2021-06-07 22:14:25 +02:00
rm -rf "${ZLIB_DIR}" && mkdir "${ZLIB_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/zlib.tar.gz" --strip-components=1 -C "${ZLIB_DIR}"
2021-06-07 22:14:25 +02:00
pushd "${ZLIB_DIR}"
2022-06-22 23:20:16 +02:00
make -f win32/Makefile.gcc LOC="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501"
2024-02-11 01:05:17 +01:00
make -f win32/Makefile.gcc install BINARY_PATH="${DEPS_DIR}/include" INCLUDE_PATH="${DEPS_DIR}/include" LIBRARY_PATH="${DEPS_DIR}/lib"
2021-06-07 22:14:25 +02:00
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Zstandard
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== Zstandard ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly ZSTD_DIR="${WORK_DIR}/zstd"
2021-06-07 22:14:25 +02:00
rm -rf "${ZSTD_DIR}" && mkdir "${ZSTD_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/zstd.tar.gz" --strip-components=1 -C "${ZSTD_DIR}" || true
2021-06-07 22:14:25 +02:00
pushd "${ZSTD_DIR}"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" make lib V=1
cp -vf lib/libzstd.a "${DEPS_DIR}/lib"
cp -vf lib/zstd.h lib/zstd_errors.h lib/zdict.h "${DEPS_DIR}/include"
sed -e "s|@PREFIX@|${DEPS_DIR}|g" -e 's|@EXEC_PREFIX@|${prefix}|g' -e 's|@INCLUDEDIR@|${prefix}/include|g' -e 's|@LIBDIR@|${prefix}/lib|g' -e 's|@VERSION@|1.5.0|g' lib/libzstd.pc.in > "${DEPS_DIR}/lib/pkgconfig/libzstd.pc"
2021-06-07 22:14:25 +02:00
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Brotli
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== Brotli ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly BROT_DIR="${WORK_DIR}/brotli"
2021-06-07 22:14:25 +02:00
rm -rf "${BROT_DIR}" && mkdir "${BROT_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/brotli.tar.gz" --strip-components=1 -C "${BROT_DIR}"
mkdir "${BROT_DIR}/out"
pushd "${BROT_DIR}/out"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib -static" cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="${DEPS_DIR}" ..
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib -static" cmake --build . --config Release --target install
2021-06-07 22:14:25 +02:00
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# OpenSSL
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== OpenSSL ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly OSSL_DIR="${WORK_DIR}/openssl"
2021-06-07 22:14:25 +02:00
rm -rf "${OSSL_DIR}" && mkdir "${OSSL_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/openssl.tar.gz" --strip-components=1 -C "${OSSL_DIR}"
2021-06-13 17:44:41 +02:00
[[ "${MY_CPU}" == "x64" ]] && readonly ossl_flag="no-sse2" || readonly ossl_flag="386"
[[ "${MY_CPU}" == "x64" ]] && readonly ossl_mngw="mingw64" || readonly ossl_mngw="mingw"
2021-06-07 22:14:25 +02:00
pushd "${OSSL_DIR}"
./Configure no-hw no-shared no-engine no-capieng no-dso zlib ${ossl_flag} -static -march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I"${DEPS_DIR}/include" -L"${DEPS_DIR}/lib" --prefix="${DEPS_DIR}" --libdir="lib" ${ossl_mngw}
2021-06-16 21:16:50 +02:00
make build_libs && make install_dev
2021-06-07 22:14:25 +02:00
popd
2021-06-17 21:13:50 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# librtmp
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== librtmp ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly RTMP_DIR="${WORK_DIR}/librtmp"
2021-06-17 21:13:50 +02:00
rm -rf "${RTMP_DIR}" && mkdir "${RTMP_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/rtmpdump.tar.gz" --strip-components=1 -C "${RTMP_DIR}"
2021-06-17 21:13:50 +02:00
pushd "${RTMP_DIR}"
patch -p1 -b < "${BASE_DIR}/patch/librtmp_openssl.diff"
make SYS=mingw SHARED= prefix="${DEPS_DIR}" XCFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" XLDFLAGS="-L${DEPS_DIR}/lib" XLIBS="-lws2_32 -lcrypt32"
2024-02-11 01:05:17 +01:00
make SYS=mingw SHARED= prefix="${DEPS_DIR}" install
2021-06-17 21:13:50 +02:00
popd
2021-06-18 00:09:42 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# libiconv
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libiconv ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly ICNV_DIR="${WORK_DIR}/libiconv"
2021-06-18 00:09:42 +02:00
rm -rf "${ICNV_DIR}" && mkdir "${ICNV_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/libiconv.tar.gz" --strip-components=1 -C "${ICNV_DIR}"
2021-06-18 00:09:42 +02:00
pushd "${ICNV_DIR}"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-rpath --disable-shared
2021-06-18 00:09:42 +02:00
make && make install
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# gettext
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== gettext ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly GTXT_DIR="${WORK_DIR}/gettext"
2021-06-18 00:09:42 +02:00
rm -rf "${GTXT_DIR}" && mkdir "${GTXT_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/gettext.tar.gz" --strip-components=1 -C "${GTXT_DIR}"
2021-06-18 00:09:42 +02:00
pushd "${GTXT_DIR}/gettext-runtime"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared --disable-libasprintf --without-emacs --disable-java --disable-native-java --disable-csharp --disable-openmp
2021-06-18 00:09:42 +02:00
make && make install
popd
2021-06-08 18:47:03 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# libssh2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libssh2 ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly SSH2_DIR="${WORK_DIR}/libssh2"
2021-06-08 18:47:03 +02:00
rm -rf "${SSH2_DIR}" && mkdir "${SSH2_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/libssh2.tar.gz" --strip-components=1 -C "${SSH2_DIR}"
2021-06-08 18:47:03 +02:00
pushd "${SSH2_DIR}"
2021-06-13 21:58:25 +02:00
patch -p1 -b < "${BASE_DIR}/patch/ssh2_session.diff"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-examples-build --disable-shared --with-libz
2021-06-16 21:16:50 +02:00
make && make install
2021-06-08 18:47:03 +02:00
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# nghttp2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== nghttp2 ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly NGH2_DIR="${WORK_DIR}/nghttp2"
rm -rf "${NGH2_DIR}" && mkdir "${NGH2_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/nghttp2.tar.gz" --strip-components=1 -C "${NGH2_DIR}"
2021-06-08 03:00:49 +02:00
pushd "${NGH2_DIR}"
patch -p1 -b < "${BASE_DIR}/patch/nghttp2_time.diff"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" OPENSSL_CFLAGS="-I${DEPS_DIR}/include" OPENSSL_LIBS="-L${DEPS_DIR}/lib -lssl -lcrypto" ZLIB_CFLAGS="-I${DEPS_DIR}/include" ZLIB_LIBS="-L${DEPS_DIR}/lib -lz" ./configure --prefix="${DEPS_DIR}" --enable-lib-only --disable-threads --disable-shared
2021-06-16 21:16:50 +02:00
make && make install
2021-06-08 17:35:58 +02:00
popd
2022-06-22 20:00:20 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# nghttp3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== nghttp3 ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly NGH3_DIR="${WORK_DIR}/nghttp3"
2022-06-22 20:00:20 +02:00
rm -rf "${NGH3_DIR}" && mkdir "${NGH3_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/nghttp3.tar.gz" --strip-components=1 -C "${NGH3_DIR}"
2022-06-22 20:00:20 +02:00
pushd "${NGH3_DIR}"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" OPENSSL_CFLAGS="-I${DEPS_DIR}/include" OPENSSL_LIBS="-L${DEPS_DIR}/lib -lssl -lcrypto" ZLIB_CFLAGS="-I${DEPS_DIR}/include" ZLIB_LIBS="-L${DEPS_DIR}/lib -lz" ./configure --prefix="${DEPS_DIR}" --enable-lib-only --disable-threads --disable-shared
2022-06-22 20:00:20 +02:00
make && make install
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ngtcp2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== ngtcp2 ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly TCP2_DIR="${WORK_DIR}/ngtcp2"
2022-06-22 20:00:20 +02:00
rm -rf "${TCP2_DIR}" && mkdir "${TCP2_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/ngtcp2.tar.gz" --strip-components=1 -C "${TCP2_DIR}"
2022-06-22 20:00:20 +02:00
pushd "${TCP2_DIR}"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" OPENSSL_CFLAGS="-I${DEPS_DIR}/include" OPENSSL_LIBS="-L${DEPS_DIR}/lib -lssl -lcrypto -lws2_32 -lz" ZLIB_CFLAGS="-I${DEPS_DIR}/include" ZLIB_LIBS="-L${DEPS_DIR}/lib -lz" ./configure --prefix="${DEPS_DIR}" --enable-lib-only --with-openssl --disable-shared
2022-06-22 20:00:20 +02:00
make && make install
popd
2021-06-08 16:36:12 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# libidn2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libidn2 ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly IDN2_DIR="${WORK_DIR}/libidn2"
2021-06-08 16:36:12 +02:00
rm -rf "${IDN2_DIR}" && mkdir "${IDN2_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/libidn2.tar.gz" --strip-components=1 -C "${IDN2_DIR}"
2021-06-08 16:36:12 +02:00
pushd "${IDN2_DIR}"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared --disable-doc --without-libiconv-prefix --without-libunistring-prefix --disable-valgrind-tests
2021-06-16 21:16:50 +02:00
make && make install
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# libpsl
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libpsl ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly LPSL_DIR="${WORK_DIR}/libpsl"
rm -rf "${LPSL_DIR}" && mkdir "${LPSL_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/libpsl.tar.gz" --strip-components=1 -C "${LPSL_DIR}"
pushd "${LPSL_DIR}"
2024-02-11 01:05:17 +01:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared
make && make install
popd
2021-06-09 21:32:35 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# libgsasl
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libgsasl ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly SASL_DIR="${WORK_DIR}/libgsasl"
2021-06-09 21:32:35 +02:00
rm -rf "${SASL_DIR}" && mkdir "${SASL_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/libgsasl.tar.gz" --strip-components=1 -C "${SASL_DIR}"
2021-06-09 21:32:35 +02:00
pushd "${SASL_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include -Wno-error=int-conversion" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared --disable-valgrind-tests --disable-obsolete -without-libintl-prefix
2021-06-16 21:16:50 +02:00
make && make install
2021-06-09 21:32:35 +02:00
popd
2021-06-07 22:14:25 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# cURL
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== cURL ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly CURL_DIR="${WORK_DIR}/curl"
2021-06-07 22:14:25 +02:00
rm -rf "${CURL_DIR}" && mkdir "${CURL_DIR}"
2024-02-06 23:03:54 +01:00
tar -xvf "${PKGS_DIR}/curl.tar.gz" --strip-components=1 -C "${CURL_DIR}"
2021-06-07 22:14:25 +02:00
pushd "${CURL_DIR}"
2021-06-20 14:44:55 +02:00
patch -p1 -b < "${BASE_DIR}/patch/curl_getenv.diff"
2021-06-09 19:47:18 +02:00
patch -p1 -b < "${BASE_DIR}/patch/curl_threads.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_doswin.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_getparam.diff"
2021-06-09 19:47:18 +02:00
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_parsecfg.diff"
2024-09-13 21:33:42 +02:00
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${DEPS_DIR}/include" CPPFLAGS="-DNDEBUG -D_WIN32_WINNT=0x0501 -DNGHTTP2_STATICLIB -DNGHTTP3_STATICLIB -DNGTCP2_STATICLIB -DUNICODE -D_UNICODE" LDFLAGS="-mconsole -Wl,--trace -static -no-pthread -L${DEPS_DIR}/lib" LIBS="-liconv -lcrypt32 -lwinmm -lbrotlicommon" PKG_CONFIG_PATH="${DEPS_DIR}/lib/pkgconfig" ./configure --enable-static --disable-shared --enable-windows-unicode --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib --with-zstd --with-brotli --with-openssl --with-librtmp --with-libssh2 --with-nghttp2="${DEPS_DIR}" --with-ngtcp2="${DEPS_DIR}" --with-nghttp3="${DEPS_DIR}" --with-libidn2 --without-ca-bundle
2022-06-22 20:00:20 +02:00
make V=1
2021-06-08 21:19:35 +02:00
strip -s src/curl.exe
2021-06-07 22:14:25 +02:00
popd
###############################################################################
# CREATE RELEASE FILES
###############################################################################
2021-06-08 21:19:35 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Output
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== Output ====================\n\n"
2024-02-06 23:03:54 +01:00
readonly OUT_DIR="${WORK_DIR}/_bin"
2021-06-13 16:24:31 +02:00
rm -rf "${OUT_DIR}" && mkdir -p "${OUT_DIR}"
2021-06-08 22:24:45 +02:00
pushd "${OUT_DIR}"
2024-02-06 23:03:54 +01:00
cp -vf "${CURL_DIR}/src/curl.exe" curl.exe
cp -vf "${PKGS_DIR}/cacert.pem" curl-ca-bundle.crt
cp -vf "${PKGS_DIR}/manpage.html" manpage.html
2021-06-10 00:01:32 +02:00
sed -n "/Configured to build curl\/libcurl:$/,/^[[:space:]]*Features:/p" "${CURL_DIR}/config.log" | sed -r "s/configure:[[:digit:]]+://" | sed -r "s/^[[:blank:]]*//" | unix2dos > config.log
2021-06-08 21:19:35 +02:00
mkdir -p "${OUT_DIR}/legal"
unix2dos -n "${BROT_DIR}/LICENSE" "legal/brotli.LICENSE.txt"
unix2dos -n "${BROT_DIR}/README.md" "legal/brotli.README.md"
unix2dos -n "${CURL_DIR}/CHANGES.md" "legal/curl.CHANGES.txt"
unix2dos -n "${CURL_DIR}/COPYING" "legal/curl.COPYING.txt"
unix2dos -n "${CURL_DIR}/README" "legal/curl.README.txt"
unix2dos -n "${GTXT_DIR}/AUTHORS" "legal/gettext.AUTHORS.txt"
unix2dos -n "${GTXT_DIR}/COPYING" "legal/gettext.COPYING.txt"
unix2dos -n "${GTXT_DIR}/README" "legal/gettext.README.txt"
unix2dos -n "${ICNV_DIR}/AUTHORS" "legal/libiconv.AUTHORS.txt"
unix2dos -n "${ICNV_DIR}/COPYING" "legal/libiconv.COPYING.txt"
unix2dos -n "${ICNV_DIR}/README" "legal/libiconv.README"
unix2dos -n "${IDN2_DIR}/AUTHORS" "legal/libidn2.AUTHORS.txt"
unix2dos -n "${IDN2_DIR}/COPYING" "legal/libidn2.COPYING.txt"
unix2dos -n "${IDN2_DIR}/README.md" "legal/libidn2.README.md"
2024-08-01 21:15:14 +02:00
unix2dos -n "${LPSL_DIR}/AUTHORS" "legal/libpsl.AUTHORS.txt"
unix2dos -n "${LPSL_DIR}/COPYING" "legal/libpsl.COPYING.txt"
unix2dos -n "${NGH2_DIR}/AUTHORS" "legal/nghttp2.AUTHORS.txt"
unix2dos -n "${NGH2_DIR}/COPYING" "legal/nghttp2.COPYING.txt"
unix2dos -n "${NGH2_DIR}/README.rst" "legal/nghttp2.README.rst"
unix2dos -n "${NGH3_DIR}/COPYING" "legal/nghttp3.COPYING.txt"
unix2dos -n "${NGH3_DIR}/README.rst" "legal/nghttp3.README.rst"
unix2dos -n "${TCP2_DIR}/COPYING" "legal/ngtcp2.COPYING.txt"
unix2dos -n "${TCP2_DIR}/README.rst" "legal/ngtcp2.README.rst"
unix2dos -n "${OSSL_DIR}/AUTHORS.md" "legal/openssl.AUTHORS.md"
unix2dos -n "${OSSL_DIR}/LICENSE.txt" "legal/openssl.LICENSE.txt"
unix2dos -n "${OSSL_DIR}/README.md" "legal/openssl.README.md"
unix2dos -n "${RTMP_DIR}/COPYING" "legal/librtmp.COPYING.txt"
unix2dos -n "${RTMP_DIR}/README" "legal/librtmp.README.txt"
unix2dos -n "${SASL_DIR}/AUTHORS" "legal/libgsasl.AUTHORS.txt"
unix2dos -n "${SASL_DIR}/COPYING" "legal/libgsasl.COPYING.txt"
unix2dos -n "${SASL_DIR}/README" "legal/libgsasl.README.txt"
unix2dos -n "${SSH2_DIR}/COPYING" "legal/libssh2.COPYING.txt"
unix2dos -n "${SSH2_DIR}/README" "legal/libssh2.README.txt"
unix2dos -n "${ZLIB_DIR}/README" "legal/zlib.README.txt"
unix2dos -n "${ZSTD_DIR}/LICENSE" "legal/zstandard.LICENSE.txt"
unix2dos -n "${ZSTD_DIR}/README.md" "legal/zstandard.README.md"
2021-06-09 23:12:30 +02:00
mkdir -p "${OUT_DIR}/patch"
2021-06-13 21:19:14 +02:00
cp -vf "${BASE_DIR}/patch/"*.diff "${OUT_DIR}/patch"
2021-06-08 21:19:35 +02:00
find "${OUT_DIR}" -type f -exec chmod 444 "{}" \;
2024-02-06 23:03:54 +01:00
readonly zfile="${BASE_DIR}/build/curl-${MY_VERSION}-windows-${MY_CPU}.$(date +"%Y-%m-%d").zip"
2021-06-08 22:24:45 +02:00
rm -rf "${zfile}" && zip -v -r -9 "${zfile}" "."
chmod 444 "${zfile}"
popd
2021-06-08 21:19:35 +02:00
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Complete
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-06-07 22:14:25 +02:00
printf "\nCompleted.\n\n"