Closed niuyuling closed 2 months ago
_build_in_docker() { echo "Not running in docker, starting a docker container to build cURL." local container_image cd "$(dirname "$0")"; base_name=$(basename "$0") current_time=$(date "+%Y%m%d-%H%M") container_image=${CONTAINER_IMAGE:-debian:latest} # or alpine:latest #container_name="build-curl-${current_time}" container_name="build-curl" RELEASE_DIR=${RELEASE_DIR:-/mnt} # Run in docker, # delete the container after running, # mount the current directory into the container, # pass all the environment variables to the container, # log the output to a file. docker run -d \ --name "${container_name}" \ --network host \ -v "$(pwd):${RELEASE_DIR}" -w "${RELEASE_DIR}" \ -e HTTP_PROXY="${HTTP_PROXY}" \ -e HTTPS_PROXY="${HTTPS_PROXY}" \ -e RELEASE_DIR="${RELEASE_DIR}" \ -e ARCHES="${ARCHES}" \ -e ENABLE_DEBUG="${ENABLE_DEBUG}" \ -e CURL_VERSION="${CURL_VERSION}" \ -e TLS_LIB="${TLS_LIB}" \ -e QUICTLS_VERSION="${QUICTLS_VERSION}" \ -e OPENSSL_VERSION="${OPENSSL_VERSION}" \ -e NGTCP2_VERSION="${NGTCP2_VERSION}" \ -e NGHTTP3_VERSION="${NGHTTP3_VERSION}" \ -e NGHTTP2_VERSION="${NGHTTP2_VERSION}" \ -e ZLIB_VERSION="${ZLIB_VERSION}" \ -e ZSTD_VERSION="${ZSTD_VERSION}" \ -e BROTLI_VERSION="${BROTLI_VERSION}" \ -e LIBSSH2_VERSION="${LIBSSH2_VERSION}" \ -e LIBUNISTRING_VERSION="${LIBUNISTRING_VERSION}" \ -e LIBIDN2_VERSION="${LIBIDN2_VERSION}" \ -e ENABLE_TRURL="${ENABLE_TRURL}" \ -e TRURL_VERSION="${TRURL_VERSION}" \ -e LIBC="${LIBC}" \ -e STATIC_LIBRARY="${STATIC_LIBRARY}" \ "${container_image}" sleep infinity # Wait for the container to be ready echo "Waiting for the container to start..." sleep 10 # Adjust the sleep duration as needed # Execute the command inside the container docker exec -it ${container_name} sh -c "sh ${RELEASE_DIR}/${base_name}" 2>&1 | tee -a "${container_name}.log" # Exit script after docker finishes exit; }
建议保留lib库,有时候静态链接libcurl需要
建议保留lib库,有时候静态链接libcurl需要