2018-06-13 20:12:52 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-04-13 20:56:49 +02:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
source $MY_DIR/utils.sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Function 'do_curl_build' and 'build_curl'
|
|
|
|
# copied from https://github.com/pypa/manylinux/tree/master/docker/build_scripts
|
|
|
|
#
|
|
|
|
|
2022-05-19 00:24:44 +02:00
|
|
|
if [[ -z "${CURL_VERSION}" ]]; then
|
|
|
|
echo >&2 'error: CURL_VERSION env. variable must be set to a non-empty value'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${CURL_HASH}" ]]; then
|
|
|
|
echo >&2 'error: CURL_HASH env. variable must be set to a non-empty value'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-04-05 14:09:15 +02:00
|
|
|
CURL_DOWNLOAD_URL=https://curl.haxx.se/download
|
2018-04-13 20:56:49 +02:00
|
|
|
|
|
|
|
function do_curl_build {
|
|
|
|
# We do this shared to avoid obnoxious linker issues where git couldn't
|
|
|
|
# link properly. If anyone wants to make this build statically go for it.
|
|
|
|
LIBS=-ldl CFLAGS=-Wl,--exclude-libs,ALL ./configure --with-ssl --disable-static > /dev/null
|
2021-08-08 20:45:36 +02:00
|
|
|
make -j"$(nproc)" > /dev/null
|
2018-04-13 20:56:49 +02:00
|
|
|
make install > /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function build_curl {
|
|
|
|
local curl_fname=$1
|
|
|
|
check_var ${curl_fname}
|
|
|
|
local curl_sha256=$2
|
|
|
|
check_var ${curl_sha256}
|
|
|
|
check_var ${CURL_DOWNLOAD_URL}
|
2021-08-06 01:17:47 +02:00
|
|
|
curl --connect-timeout 30 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 5 \
|
|
|
|
--retry-delay 10 \
|
|
|
|
--retry-max-time 30 \
|
|
|
|
-fsSLO ${CURL_DOWNLOAD_URL}/${curl_fname}.tar.gz
|
|
|
|
|
2021-04-05 14:09:15 +02:00
|
|
|
check_sha256sum ${curl_fname}.tar.gz ${curl_sha256}
|
|
|
|
tar -zxf ${curl_fname}.tar.gz
|
|
|
|
(cd curl-*/ && do_curl_build)
|
|
|
|
rm -rf curl-*
|
2018-04-13 20:56:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cd /usr/src
|
2022-05-19 00:24:44 +02:00
|
|
|
build_curl "${CURL_VERSION}" "${CURL_HASH}"
|
2018-04-13 20:56:49 +02:00
|
|
|
|
|
|
|
(cat /etc/ld.so.conf.d/usr-local.conf 2> /dev/null | grep -q "^/usr/local/lib$") ||
|
|
|
|
echo '/usr/local/lib' >> /etc/ld.so.conf.d/usr-local.conf
|
|
|
|
ldconfig
|
|
|
|
|