diff --git a/curl-static-cross.sh b/curl-static-cross.sh index 1e9ab5c..b174663 100644 --- a/curl-static-cross.sh +++ b/curl-static-cross.sh @@ -368,7 +368,8 @@ download_and_extract() { # If the file is a tarball, extract it if expr "${FILENAME}" : '.*\.\(tar\.xz\|tar\.gz\|tar\.bz2\|tgz\)$' > /dev/null; then - SOURCE_DIR=$(echo "${FILENAME}" | sed -E "s/\.tar\.(xz|bz2|gz)//g" | sed 's/\.tgz//g') + # SOURCE_DIR=$(echo "${FILENAME}" | sed -E "s/\.tar\.(xz|bz2|gz)//g" | sed 's/\.tgz//g') + SOURCE_DIR=$(tar -tf "${FILENAME}" | head -n 1 | cut -d'/' -f1) [ -d "${SOURCE_DIR}" ] && rm -rf "${SOURCE_DIR}" tar -axf "${FILENAME}" cd "${SOURCE_DIR}" @@ -684,10 +685,12 @@ compile_curl() { local url change_dir; - if [ "${CURL_VERSION}" = "dev" ] || [ "${CURL_VERSION}" = "DEV" ]; then - git clone --depth 1 https://github.com/curl/curl.git curl-dev; + if [ "${CURL_VERSION}" = "dev" ]; then + if [ ! -d "curl-dev" ]; then + git clone --depth 1 https://github.com/curl/curl.git curl-dev; + fi cd curl-dev; - CURL_VERSION="DEV"; + make clean || true; else url_from_github curl/curl "${CURL_VERSION}"; url="${URL}"; diff --git a/curl-static-mac.sh b/curl-static-mac.sh index 7fc9bbd..6864ba3 100644 --- a/curl-static-mac.sh +++ b/curl-static-mac.sh @@ -230,7 +230,8 @@ download_and_extract() { # If the file is a tarball, extract it if echo "${FILENAME}" | grep -qP '.*\.(tar\.xz|tar\.gz|tar\.bz2|tgz)$'; then - SOURCE_DIR=$(echo "${FILENAME}" | sed -E "s/\.tar\.(xz|bz2|gz)//g" | sed 's/\.tgz//g') + # SOURCE_DIR=$(echo "${FILENAME}" | sed -E "s/\.tar\.(xz|bz2|gz)//g" | sed 's/\.tgz//g') + SOURCE_DIR=$(tar -tf "${FILENAME}" | head -n 1 | cut -d'/' -f1) [ -d "${SOURCE_DIR}" ] && rm -rf "${SOURCE_DIR}" tar -xf "${FILENAME}" cd "${SOURCE_DIR}" @@ -524,10 +525,12 @@ compile_curl() { mkdir -p "${PREFIX}/lib/dylib" mv "${PREFIX}/lib/"*.dylib "${PREFIX}/lib/dylib/" - if [ "${CURL_VERSION}" = "dev" ] || [ "${CURL_VERSION}" = "DEV" ]; then - git clone --depth 1 https://github.com/curl/curl.git curl-dev; + if [ "${CURL_VERSION}" = "dev" ]; then + if [ ! -d "curl-dev" ]; then + git clone --depth 1 https://github.com/curl/curl.git curl-dev; + fi cd curl-dev; - CURL_VERSION="DEV"; + make clean || true; else url_from_github curl/curl "${CURL_VERSION}"; url="${URL}";