Skip to content

Commit

Permalink
feat: 🎸 update mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
abcfy2 committed Nov 21, 2023
1 parent 26accc2 commit 5687eeb
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ case "${TARGET_HOST}" in
TARGET_HOST=Windows
rm -fr "${CROSS_ROOT}"
hash -r
if [ ! -f "/usr/share/keyrings/winehq-archive.key" ]; then
rm -f /usr/share/keyrings/winehq-archive.key.part
retry wget -cT30 -O /usr/share/keyrings/winehq-archive.key.part https://dl.winehq.org/wine-builds/winehq.key
mv -fv /usr/share/keyrings/winehq-archive.key.part /usr/share/keyrings/winehq-archive.key
fi
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
WINEHQ_URL="http://mirrors.tuna.tsinghua.edu.cn/wine-builds/ubuntu/"
else
WINEHQ_URL="http://dl.winehq.org/wine-builds/ubuntu/"
fi
echo "deb [signed-by=/usr/share/keyrings/winehq-archive.key] ${WINEHQ_URL} ${UBUNTU_CODENAME} main" >/etc/apt/sources.list.d/winehq.list
# if [ ! -f "/usr/share/keyrings/winehq-archive.key" ]; then
# rm -f /usr/share/keyrings/winehq-archive.key.part
# retry wget -cT30 -O /usr/share/keyrings/winehq-archive.key.part https://dl.winehq.org/wine-builds/winehq.key
# mv -fv /usr/share/keyrings/winehq-archive.key.part /usr/share/keyrings/winehq-archive.key
# fi
# if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
# WINEHQ_URL="http://mirrors.tuna.tsinghua.edu.cn/wine-builds/ubuntu/"
# else
# WINEHQ_URL="http://dl.winehq.org/wine-builds/ubuntu/"
# fi
# echo "deb [signed-by=/usr/share/keyrings/winehq-archive.key] ${WINEHQ_URL} ${UBUNTU_CODENAME} main" >/etc/apt/sources.list.d/winehq.list
apt update
apt install -y winehq-staging mingw-w64
apt install -y wine mingw-w64
export WINEPREFIX=/tmp/
RUNNER_CHECKER="wine"
;;
Expand Down Expand Up @@ -157,8 +157,8 @@ prepare_cmake() {
cmake_binary_url="https://github.com/Kitware/CMake/releases/download/v${cmake_latest_ver}/cmake-${cmake_latest_ver}-linux-x86_64.tar.gz"
cmake_sha256_url="https://github.com/Kitware/CMake/releases/download/v${cmake_latest_ver}/cmake-${cmake_latest_ver}-SHA-256.txt"
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
cmake_binary_url="https://ghproxy.com/${cmake_binary_url}"
cmake_sha256_url="https://ghproxy.com/${cmake_sha256_url}"
cmake_binary_url="https://gh-proxy.com/${cmake_binary_url}"
cmake_sha256_url="https://gh-proxy.com/${cmake_sha256_url}"
fi
if [ -f "${DOWNLOADS_DIR}/cmake-${cmake_latest_ver}-linux-x86_64.tar.gz" ]; then
cd "${DOWNLOADS_DIR}"
Expand All @@ -179,7 +179,7 @@ prepare_ninja() {
ninja_ver="$(retry wget -qO- --compression=auto https://ninja-build.org/ \| grep "'The last Ninja release is'" \| sed -r "'s@.*<b>(.+)</b>.*@\1@'" \| head -1)"
ninja_binary_url="https://github.com/ninja-build/ninja/releases/download/${ninja_ver}/ninja-linux.zip"
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
ninja_binary_url="https://ghproxy.com/${ninja_binary_url}"
ninja_binary_url="https://gh-proxy.com/${ninja_binary_url}"
fi
if [ ! -f "${DOWNLOADS_DIR}/ninja-${ninja_ver}-linux.zip" ]; then
rm -f "${DOWNLOADS_DIR}/ninja-${ninja_ver}-linux.zip.part"
Expand All @@ -196,7 +196,7 @@ prepare_zlib() {
zlib_ng_latest_tag="$(retry wget -qO- --compression=auto https://api.github.com/repos/zlib-ng/zlib-ng/releases \| jq -r "'.[0].tag_name'")"
zlib_ng_latest_url="https://github.com/zlib-ng/zlib-ng/archive/refs/tags/${zlib_ng_latest_tag}.tar.gz"
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
zlib_ng_latest_url="https://ghproxy.com/${zlib_ng_latest_url}"
zlib_ng_latest_url="https://gh-proxy.com/${zlib_ng_latest_url}"
fi
if [ ! -f "${DOWNLOADS_DIR}/zlib-ng-${zlib_ng_latest_tag}.tar.gz" ]; then
retry wget -cT10 -O "${DOWNLOADS_DIR}/zlib-ng-${zlib_ng_latest_tag}.tar.gz.part" "${zlib_ng_latest_url}"
Expand Down Expand Up @@ -254,7 +254,7 @@ prepare_xz() {
mkdir -p "/usr/src/xz-${xz_tag}"
tar -Jxf "${DOWNLOADS_DIR}/xz-${xz_tag}.tar.xz" --strip-components=1 -C "/usr/src/xz-${xz_tag}"
cd "/usr/src/xz-${xz_tag}"
./configure --build=x86_64-linux-gnu --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-silent-rules --enable-static --disable-shared
./configure --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-silent-rules --enable-static --disable-shared
make -j$(nproc)
make install
xz_ver="$(grep Version: "${CROSS_PREFIX}/lib/pkgconfig/liblzma.pc")"
Expand All @@ -280,18 +280,18 @@ prepare_ssl() {
if [ ! -f "./configure" ]; then
./autogen.sh
fi
./configure --build=x86_64-linux-gnu --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-silent-rules --enable-static --disable-shared --with-openssldir=/etc/ssl
./configure --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-silent-rules --enable-static --disable-shared --with-openssldir=/etc/ssl
make -j$(nproc)
make install_sw
libressl_ver="$(grep Version: "${CROSS_PREFIX}/lib/pkgconfig/openssl.pc")"
echo "- libressl: ${libressl_ver}, source: ${libressl_latest_url:-cached libressl}" >>"${BUILD_INFO}"
else
# openssl
openssl_filename="$(retry wget -qO- --compression=auto https://www.openssl.org/source/ \| grep -o "'href=\"openssl-3.*tar.gz\"'" \| grep -o "'[^\"]*.tar.gz'" \| head -1)"
openssl_filename="$(retry wget -qO- --compression=auto https://www.openssl.org/source/ \| grep -o "'href=\"openssl-3.1.*tar.gz\"'" \| grep -o "'[^\"]*.tar.gz'" \| head -1)"
openssl_ver="$(echo "${openssl_filename}" | sed -r 's/openssl-(.+)\.tar\.gz/\1/')"
openssl_latest_url="https://github.com/openssl/openssl/archive/refs/tags/${openssl_filename}"
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
openssl_latest_url="https://ghproxy.com/${openssl_latest_url}"
openssl_latest_url="https://gh-proxy.com/${openssl_latest_url}"
fi
if [ ! -f "${DOWNLOADS_DIR}/openssl-${openssl_ver}.tar.gz" ]; then
retry wget -cT10 -O "${DOWNLOADS_DIR}/openssl-${openssl_ver}.tar.gz.part" "${openssl_latest_url}"
Expand Down Expand Up @@ -320,7 +320,7 @@ prepare_libxml2() {
mkdir -p "/usr/src/libxml2-${libxml2_tag}"
tar -axf "${DOWNLOADS_DIR}/${libxml2_filename}" --strip-components=1 -C "/usr/src/libxml2-${libxml2_tag}"
cd "/usr/src/libxml2-${libxml2_tag}"
./configure --build=x86_64-linux-gnu --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-silent-rules --without-python --without-icu --enable-static --disable-shared
./configure --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-silent-rules --without-python --without-icu --enable-static --disable-shared
make -j$(nproc)
make install
libxml2_ver="$(grep Version: "${CROSS_PREFIX}/lib/pkgconfig/"libxml-*.pc)"
Expand All @@ -331,7 +331,7 @@ prepare_sqlite() {
sqlite_tag="$(wget -qO- --compression=auto https://www.sqlite.org/index.html | sed -nr 's/.*>Version (.+)<.*/\1/p')"
sqlite_latest_url="https://github.com/sqlite/sqlite/archive/release.tar.gz"
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
sqlite_latest_url="https://ghproxy.com/${sqlite_latest_url}"
sqlite_latest_url="https://gh-proxy.com/${sqlite_latest_url}"
fi
if [ ! -f "${DOWNLOADS_DIR}/sqlite-${sqlite_tag}.tar.gz" ]; then
retry wget -cT10 -O "${DOWNLOADS_DIR}/sqlite-${sqlite_tag}.tar.gz.part" "${sqlite_latest_url}"
Expand All @@ -344,7 +344,7 @@ prepare_sqlite() {
ln -sf mksourceid.exe mksourceid
SQLITE_EXT_CONF="config_TARGET_EXEEXT=.exe"
fi
./configure --build=x86_64-linux-gnu --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared ${SQLITE_EXT_CONF}
./configure --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared ${SQLITE_EXT_CONF}
make -j$(nproc)
make install
sqlite_ver="$(grep Version: "${CROSS_PREFIX}/lib/pkgconfig/"sqlite*.pc)"
Expand All @@ -365,24 +365,24 @@ prepare_c_ares() {
if [ ! -f "./configure" ]; then
autoreconf -i
fi
./configure --build=x86_64-linux-gnu --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared --enable-silent-rules --disable-tests
./configure --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared --enable-silent-rules --disable-tests
make -j$(nproc)
make install
cares_ver="$(grep Version: "${CROSS_PREFIX}/lib/pkgconfig/libcares.pc")"
echo "- c-ares: ${cares_ver}, source: ${cares_latest_url:-cached c-ares}" >>"${BUILD_INFO}"
}

prepare_libssh2() {
libssh2_tag="$(retry wget -qO- --compression=auto https://www.libssh2.org/ \| sed -nr "'s@.*libssh2 ([^<]*).*released on.*@\1@p'")"
libssh2_latest_url="https://www.libssh2.org/download/libssh2-${libssh2_tag}.tar.gz"
libssh2_tag="$(retry wget -qO- --compression=auto https://libssh2.org/ \| sed -nr "'s@.*libssh2 ([^<]*).*released on.*@\1@p'")"
libssh2_latest_url="https://libssh2.org/download/libssh2-${libssh2_tag}.tar.gz"
if [ ! -f "${DOWNLOADS_DIR}/libssh2-${libssh2_tag}.tar.gz" ]; then
retry wget -cT10 -O "${DOWNLOADS_DIR}/libssh2-${libssh2_tag}.tar.gz.part" "${libssh2_latest_url}"
mv -fv "${DOWNLOADS_DIR}/libssh2-${libssh2_tag}.tar.gz.part" "${DOWNLOADS_DIR}/libssh2-${libssh2_tag}.tar.gz"
fi
mkdir -p "/usr/src/libssh2-${libssh2_tag}"
tar -zxf "${DOWNLOADS_DIR}/libssh2-${libssh2_tag}.tar.gz" --strip-components=1 -C "/usr/src/libssh2-${libssh2_tag}"
cd "/usr/src/libssh2-${libssh2_tag}"
./configure --build=x86_64-linux-gnu --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared --enable-silent-rules
./configure --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared --enable-silent-rules
make -j$(nproc)
make install
unset CFLAGS
Expand Down Expand Up @@ -412,7 +412,7 @@ build_aria2() {
aria2_latest_url="https://github.com/aria2/aria2/archive/master.tar.gz"
fi
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
aria2_latest_url="https://ghproxy.com/${aria2_latest_url}"
aria2_latest_url="https://gh-proxy.com/${aria2_latest_url}"
fi

if [ ! -f "${DOWNLOADS_DIR}/aria2-${aria2_tag}.tar.gz" ]; then
Expand All @@ -430,7 +430,7 @@ build_aria2() {
# else
# ARIA2_EXT_CONF='--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt'
fi
./configure --build=x86_64-linux-gnu --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared --enable-silent-rules ARIA2_STATIC=yes ${ARIA2_EXT_CONF}
./configure --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared --enable-silent-rules ARIA2_STATIC=yes ${ARIA2_EXT_CONF}
make -j$(nproc)
make install
echo "- aria2: source: ${aria2_latest_url:-cached aria2}" >>"${BUILD_INFO}"
Expand All @@ -450,8 +450,10 @@ get_build_info() {
}

test_build() {
# get release
cp -fv "${CROSS_PREFIX}/bin/"aria2* "${SELF_DIR}"
echo "============= ARIA2 TEST DOWNLOAD =============="
"${RUNNER_CHECKER}" "${CROSS_PREFIX}/bin/aria2c"* --http-accept-gzip=true https://github.com/ -d /tmp -o test
"${RUNNER_CHECKER}" "${CROSS_PREFIX}/bin/aria2c"* -t 10 --console-log-level=debug --http-accept-gzip=true https://github.com/ -d /tmp -o test
echo "================================================"
}

Expand Down

0 comments on commit 5687eeb

Please sign in to comment.