Skip to content

Commit

Permalink
cross-build: upgrade zlib to 1.2.12, show curl errors (#915)
Browse files Browse the repository at this point in the history
* upgrade zlib to 1.2.12

The package for the version 1.2.11 was removed from upstream,
which lets the build script fail.

* cross-build: show curl error if source download fails

Set the curl options `-f (--fail)` and `-S (--show-error)`,
to show errors when curl fails to download a source package.

curl -sLo- "https://zlib.net/zlib-1.2.11.tar.gz" | tar xz
tar: invalid magic
tar: short read

curl -fSsLo- "https://zlib.net/zlib-1.2.11.tar.gz" | tar xz
curl: (22) The requested URL returned error: 404
tar: invalid magic
tar: short read
  • Loading branch information
r10r authored Apr 8, 2022
1 parent 1d0e344 commit 83e514b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/cross-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ STAGE_ROOT="${STAGE_ROOT:-/opt/stage}"
BUILD_ROOT="${BUILD_ROOT:-/opt/build}"
BUILD_TARGET="${BUILD_TARGET:-x86_64}"

ZLIB_VERSION="${ZLIB_VERSION:-1.2.11}"
ZLIB_VERSION="${ZLIB_VERSION:-1.2.12}"
JSON_C_VERSION="${JSON_C_VERSION:-0.15}"
MBEDTLS_VERSION="${MBEDTLS_VERSION:-2.16.8}"
LIBUV_VERSION="${LIBUV_VERSION:-1.40.0}"
LIBWEBSOCKETS_VERSION="${LIBWEBSOCKETS_VERSION:-4.2.1}"

build_zlib() {
echo "=== Building zlib-${ZLIB_VERSION} (${TARGET})..."
curl -sLo- "https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
curl -fSsLo- "https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
pushd "${BUILD_DIR}"/zlib-"${ZLIB_VERSION}"
env CHOST="${TARGET}" ./configure --static --archs="-fPIC" --prefix="${STAGE_DIR}"
make -j"$(nproc)" install
Expand All @@ -27,7 +27,7 @@ build_zlib() {

build_json-c() {
echo "=== Building json-c-${JSON_C_VERSION} (${TARGET})..."
curl -sLo- "https://s3.amazonaws.com/json-c_releases/releases/json-c-${JSON_C_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
curl -fSsLo- "https://s3.amazonaws.com/json-c_releases/releases/json-c-${JSON_C_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
pushd "${BUILD_DIR}/json-c-${JSON_C_VERSION}"
rm -rf build && mkdir -p build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE="${BUILD_DIR}/cross-${TARGET}.cmake" \
Expand All @@ -41,7 +41,7 @@ build_json-c() {

build_mbedtls() {
echo "=== Building mbedtls-${MBEDTLS_VERSION} (${TARGET})..."
curl -sLo- "https://github.com/ARMmbed/mbedtls/archive/v${MBEDTLS_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
curl -fSsLo- "https://github.com/ARMmbed/mbedtls/archive/v${MBEDTLS_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
pushd "${BUILD_DIR}/mbedtls-${MBEDTLS_VERSION}"
rm -rf build && mkdir -p build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE="${BUILD_DIR}/cross-${TARGET}.cmake" \
Expand All @@ -55,7 +55,7 @@ build_mbedtls() {

build_libuv() {
echo "=== Building libuv-${LIBUV_VERSION} (${TARGET})..."
curl -sLo- "https://dist.libuv.org/dist/v${LIBUV_VERSION}/libuv-v${LIBUV_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
curl -fSsLo- "https://dist.libuv.org/dist/v${LIBUV_VERSION}/libuv-v${LIBUV_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
pushd "${BUILD_DIR}/libuv-v${LIBUV_VERSION}"
./autogen.sh
env CFLAGS=-fPIC ./configure --disable-shared --enable-static --prefix="${STAGE_DIR}" --host="${TARGET}"
Expand All @@ -81,7 +81,7 @@ EOF

build_libwebsockets() {
echo "=== Building libwebsockets-${LIBWEBSOCKETS_VERSION} (${TARGET})..."
curl -sLo- "https://github.com/warmcat/libwebsockets/archive/v${LIBWEBSOCKETS_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
curl -fSsLo- "https://github.com/warmcat/libwebsockets/archive/v${LIBWEBSOCKETS_VERSION}.tar.gz" | tar xz -C "${BUILD_DIR}"
pushd "${BUILD_DIR}/libwebsockets-${LIBWEBSOCKETS_VERSION}"
sed -i 's/ websockets_shared//g' cmake/libwebsockets-config.cmake.in
sed -i '/PC_OPENSSL/d' lib/tls/CMakeLists.txt
Expand Down Expand Up @@ -134,7 +134,7 @@ build() {
echo "=== Installing toolchain ${ALIAS} (${TARGET})..."

mkdir -p "${CROSS_ROOT}" && export PATH="${PATH}:/opt/cross/bin"
curl -sLo- "https://musl.cc/${TARGET}-cross.tgz" | tar xz -C "${CROSS_ROOT}" --strip-components 1
curl -fSsLo- "https://musl.cc/${TARGET}-cross.tgz" | tar xz -C "${CROSS_ROOT}" --strip-components 1

echo "=== Building target ${ALIAS} (${TARGET})..."

Expand Down

0 comments on commit 83e514b

Please sign in to comment.