Files
Firelink/scripts/aria2/build.sh
T
NimBold f4baad6fca chore(deps): refresh Tauri dependencies and CI toolchains
- Update Tauri 2 JavaScript and Cargo dependencies; remove unused JS filesystem plugin.

- Refresh verified Windows/Linux FFmpeg sources and pin workflow actions.

- Test supported Node lines, move native jobs to Node 24, and target the macOS 27 runner.

- Build patched Windows Aria2 with MSYS2 UCRT64 and fingerprint the selected environment.
2026-09-29 08:45:39 +03:30

81 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Build from the checksum-pinned upstream archive plus the reviewed patch.
source_root="$1"
patch_file="$2"
if command -v cygpath >/dev/null 2>&1; then
if [[ "${MSYSTEM:-}" != "UCRT64" ]]; then
echo "Windows Aria2 builds require the MSYS2 UCRT64 environment (MSYSTEM=UCRT64)." >&2
exit 1
fi
source_root="$(cygpath -u "$source_root")"
patch_file="$(cygpath -u "$patch_file")"
mingw_prefix=/ucrt64
export PATH="$mingw_prefix/bin:/usr/bin:$PATH"
export ACLOCAL_PATH="$mingw_prefix/share/aclocal:/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}"
export PKG_CONFIG_PATH="$mingw_prefix/lib/pkgconfig"
fi
copy_mingw_runtime_dependencies() {
local binary="$1"
local runtime_dir="$2"
local dependency
local source
local destination
while IFS= read -r dependency; do
[[ -z "$dependency" ]] && continue
source="$mingw_prefix/bin/$dependency"
if [[ ! -f "$source" ]]; then
continue
fi
destination="$runtime_dir/$dependency"
if [[ -e "$destination" ]]; then
continue
fi
cp "$source" "$destination"
copy_mingw_runtime_dependencies "$destination" "$runtime_dir"
done < <(objdump -p "$binary" | awk '/DLL Name:/{print $3}')
}
cd "$source_root"
patch --batch -p1 < "$patch_file"
autoreconf -fi
mkdir firelink-build
cd firelink-build
# Linux and Windows payloads are self-contained; do not inherit host dylibs.
export LDFLAGS="-static ${LDFLAGS:-}"
export PKG_CONFIG="pkg-config --static"
../configure --enable-static --disable-shared --disable-nls \
--without-gnutls --with-openssl --without-libxml2 --with-libexpat \
--without-libgmp --without-libnettle --without-libgcrypt \
--with-libssh2 --with-libcares
if command -v nproc >/dev/null 2>&1; then
JOBS="$(nproc 2>/dev/null || echo 4)"
elif [[ -n "${NUMBER_OF_PROCESSORS:-}" ]]; then
JOBS="$NUMBER_OF_PROCESSORS"
elif command -v sysctl >/dev/null 2>&1; then
JOBS="$(sysctl -n hw.ncpu 2>/dev/null || echo 4)"
else
JOBS=4
fi
JOBS="${JOBS//$'\r'/}"
JOBS="${JOBS// /}"
if ! [[ "$JOBS" =~ ^[1-9][0-9]*$ ]]; then
JOBS=4
fi
make -j"$JOBS"
if command -v cygpath >/dev/null 2>&1; then
command -v objdump >/dev/null 2>&1 || {
echo "MinGW objdump is required to collect Aria2 runtime dependencies." >&2
exit 1
}
runtime_dir="$source_root/aria2-libs"
mkdir -p "$runtime_dir"
copy_mingw_runtime_dependencies "$source_root/firelink-build/src/aria2c.exe" "$runtime_dir"
if [[ -d "$mingw_prefix/lib/ossl-modules" ]]; then
find "$mingw_prefix/lib/ossl-modules" -maxdepth 1 -type f -iname '*.dll' -exec cp {} "$runtime_dir/" \;
fi
fi