The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
ci(windows): 恢复原生 arm64 构建
XiaoYouChRd84571387adf
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex c5371080..6446969d 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -151,10 +151,19 @@ jobs:needs: [prepare]if: ${{ github.event.inputs.build_target == 'windows' || github.event.inputs.build_target == 'all' }}strategy:+ fail-fast: falsematrix:include:- architecture: x86_64runner: windows-2022+ msvc_arch: x64+ hdiff_arch: windows64+ installer_arch: x64compatible+ - architecture: arm64+ runner: windows-11-arm+ msvc_arch: ARM64+ hdiff_arch: windows_arm64+ installer_arch: arm64runs-on: ${{ matrix.runner }}steps:- name: Checkout@@ -168,25 +177,55 @@ jobs:- name: Install dependenciesrun: |uv python install 3.13- uv sync+ uv sync ${{ matrix.architecture == 'arm64' && '--no-install-package libtorrent' || '' }}++ - name: Read libtorrent version+ if: ${{ matrix.architecture == 'arm64' }}+ id: libtorrent+ shell: pwsh+ run: |+ $version = uv run --no-sync python -c "import tomllib; print(next(p['version'] for p in tomllib.load(open('uv.lock', 'rb'))['package'] if p['name'] == 'libtorrent'))"+ echo "version=$version" >> $env:GITHUB_OUTPUT+ echo "python=$((Get-Content .python-version).Trim())" >> $env:GITHUB_OUTPUT++ - name: Cache libtorrent wheel+ if: ${{ matrix.architecture == 'arm64' }}+ id: libtorrent-cache+ uses: actions/cache@v6+ with:+ path: libtorrent-wheel+ key: libtorrent-win_arm64-py${{ steps.libtorrent.outputs.python }}-${{ steps.libtorrent.outputs.version }}-${{ hashFiles('scripts/build_libtorrent_wheel.py') }}++ - name: Set up MSBuild+ if: ${{ matrix.architecture == 'arm64' && steps.libtorrent-cache.outputs.cache-hit != 'true' }}+ uses: microsoft/setup-msbuild@v2++ - name: Build libtorrent wheel+ if: ${{ matrix.architecture == 'arm64' && steps.libtorrent-cache.outputs.cache-hit != 'true' }}+ run: uv run --no-sync python scripts/build_libtorrent_wheel.py "${{ steps.libtorrent.outputs.version }}" "${{ steps.libtorrent.outputs.python }}" libtorrent-wheel++ - name: Install libtorrent wheel+ if: ${{ matrix.architecture == 'arm64' }}+ shell: pwsh+ run: uv pip install (Get-ChildItem libtorrent-wheel/*.whl).FullName- name: Build with Nuitkarun: |echo "VERSION=${{ needs.prepare.outputs.version }}" >> $env:GITHUB_ENV- (Get-Content scripts/Ghost-Downloader-3.iss) -replace 'APPLICATION_VERSION', '${{ needs.prepare.outputs.version }}' | Set-Content scripts/Ghost-Downloader-3.iss- uv run scripts/deploy.py+ (Get-Content scripts/Ghost-Downloader-3.iss) -replace 'APPLICATION_VERSION', '${{ needs.prepare.outputs.version }}' -replace 'APPLICATION_ARCHITECTURES', '${{ matrix.installer_arch }}' | Set-Content scripts/Ghost-Downloader-3.iss+ uv run --no-sync scripts/deploy.py- name: Build updatershell: pwshrun: |- cmake -B build-updater -G "Visual Studio 17 2022" -A x64 tools/updater+ cmake -B build-updater -G "Visual Studio 17 2022" -A ${{ matrix.msvc_arch }} tools/updatercmake --build build-updater --config ReleaseCopy-Item build-updater/Release/updater.exe dist/Ghost-Downloader-3.dist/- name: Build ghdshell: pwshrun: |- cmake -B build-ghd -G "Visual Studio 17 2022" -A x64 tools/ghd+ cmake -B build-ghd -G "Visual Studio 17 2022" -A ${{ matrix.msvc_arch }} tools/ghdcmake --build build-ghd --config ReleaseNew-Item -ItemType Directory -Force dist/Ghost-Downloader-3.dist/binCopy-Item build-ghd/Release/ghd.exe dist/Ghost-Downloader-3.dist/bin/@@ -194,9 +233,9 @@ jobs:- name: Download HDiffPatchshell: pwshrun: |- Invoke-WebRequest -Uri "https://github.com/sisong/HDiffPatch/releases/download/v5.1.3/hdiffpatch_v5.1.3_bin_windows64.zip" -OutFile hdiffpatch.zip+ Invoke-WebRequest -Uri "https://github.com/sisong/HDiffPatch/releases/download/v5.1.3/hdiffpatch_v5.1.3_bin_${{ matrix.hdiff_arch }}.zip" -OutFile hdiffpatch.zipExpand-Archive hdiffpatch.zip -DestinationPath hdiffpatch- Copy-Item hdiffpatch/windows64/hpatchz.exe dist/Ghost-Downloader-3.dist/+ Copy-Item hdiffpatch/${{ matrix.hdiff_arch }}/hpatchz.exe dist/Ghost-Downloader-3.dist/- name: Prepare For Signif: ${{ github.event.inputs.sign_artifact == 'true' }}@@ -295,6 +334,10 @@ jobs:GH_TOKEN: ${{ github.token }}run: |$baseVer = "${{ needs.prepare.outputs.patch_base }}"+ $baseAssets = gh release view "v$baseVer" --json assets --jq '.assets[].name'+ if ($baseAssets -notcontains "Ghost-Downloader-v$baseVer-Windows-${{ matrix.architecture }}.zip") {+ Write-Output "v$baseVer has no Windows-${{ matrix.architecture }} package, skipping patch"; exit 0+ }New-Item -ItemType Directory -Path prev -Forcegh release download "v$baseVer" -p "*Windows-${{ matrix.architecture }}.zip" -D prev/@@ -313,7 +356,7 @@ jobs:}$patchFile = "patch-Windows-${{ matrix.architecture }}-${baseVer}-to-${{ env.VERSION }}.hdiff"- & "hdiffpatch/windows64/hdiffz.exe" -f "$oldDir" dist/Ghost-Downloader-3.dist "$patchFile"+ & "hdiffpatch/${{ matrix.hdiff_arch }}/hdiffz.exe" -f "$oldDir" dist/Ghost-Downloader-3.dist "$patchFile"echo "PATCH_FILE=$patchFile" >> $env:GITHUB_ENV- name: Upload to release@@ -982,7 +1025,7 @@ jobs:h.update(chunk)return h.hexdigest()- platforms = ["Windows-x86_64", "macOS-arm64", "macOS-x86_64"]+ platforms = ["Windows-x86_64", "Windows-arm64", "macOS-arm64", "macOS-x86_64"]patches = {}full = {}diff --git a/README.md b/README.mdindex 25bae601..156ddcde 100644--- a/README.md+++ b/README.md@@ -42,7 +42,7 @@ Started as a passion project to help a Bilibili creator manage resources. Now it| Platform | Required Version | Architectures ||:--|:--|:--|-| <img src="https://api.iconify.design/mdi/microsoft-windows.svg?color=%238B949E" width="16" height="16"> **Windows** | `10+` | `x86_64` |+| <img src="https://api.iconify.design/mdi/microsoft-windows.svg?color=%238B949E" width="16" height="16"> **Windows** | `10+` | `x86_64` / `arm64` || <img src="https://api.iconify.design/mdi/apple.svg?color=%238B949E" width="16" height="16"> **macOS** | `13.0+` | `x86_64` / `arm64` || <img src="https://api.iconify.design/mdi/linux.svg?color=%238B949E" width="16" height="16"> **Linux** | `glibc 2.35+` | `x86_64` / `arm64` || <img src="https://api.iconify.design/mdi/android.svg?color=%238B949E" width="16" height="16"> **Android** | `9.0+` | `arm64-v8a` |diff --git a/README_zh.md b/README_zh.mdindex 5dc41c5b..cd56925a 100644--- a/README_zh.md+++ b/README_zh.md@@ -43,7 +43,7 @@| 平台 | 版本要求 | 架构支持 ||:--|:--|:--|-| <img src="https://api.iconify.design/mdi/microsoft-windows.svg?color=%238B949E" width="16" height="16"> **Windows** | `10+` | `x86_64` |+| <img src="https://api.iconify.design/mdi/microsoft-windows.svg?color=%238B949E" width="16" height="16"> **Windows** | `10+` | `x86_64` / `arm64` || <img src="https://api.iconify.design/mdi/apple.svg?color=%238B949E" width="16" height="16"> **macOS** | `13.0+` | `x86_64` / `arm64` || <img src="https://api.iconify.design/mdi/linux.svg?color=%238B949E" width="16" height="16"> **Linux** | `glibc 2.35+` | `x86_64` / `arm64` || <img src="https://api.iconify.design/mdi/android.svg?color=%238B949E" width="16" height="16"> **Android** | `9.0+` | `arm64-v8a` |diff --git a/scripts/Ghost-Downloader-3.iss b/scripts/Ghost-Downloader-3.issindex 18a8f5ec..fae04338 100644--- a/scripts/Ghost-Downloader-3.iss+++ b/scripts/Ghost-Downloader-3.iss@@ -3,6 +3,7 @@#define MyAppName "Ghost Downloader"#define MyAppVersion "APPLICATION_VERSION"+#define MyAppArchitectures "APPLICATION_ARCHITECTURES"#define MyAppPublisher "XiaoYouChR"#define MyAppURL "https://github.com/XiaoYouChR/Ghost-Downloader-3/"#define MyAppExeName "Ghost-Downloader-3.exe"@@ -21,14 +22,8 @@ AppUpdatesURL={#MyAppURL}SourceDir=..DefaultDirName={autopf}\{#MyAppName}UninstallDisplayIcon={app}\{#MyAppExeName}-; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run-; on anything but x64 and Windows 11 on Arm.-ArchitecturesAllowed=x64compatible-; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the-; install be done in "64-bit mode" on x64 or Windows 11 on Arm,-; meaning it should use the native 64-bit Program Files directory and-; the 64-bit view of the registry.-ArchitecturesInstallIn64BitMode=x64compatible+ArchitecturesAllowed={#MyAppArchitectures}+ArchitecturesInstallIn64BitMode={#MyAppArchitectures}DisableProgramGroupPage=yesLicenseFile=LICENSEPrivilegesRequired=lowestdiff --git a/scripts/build_libtorrent_wheel.py b/scripts/build_libtorrent_wheel.pynew file mode 100644index 00000000..398b4e2c--- /dev/null+++ b/scripts/build_libtorrent_wheel.py@@ -0,0 +1,49 @@+#!/usr/bin/env python3+"""Build the libtorrent win_arm64 wheel from the upstream tag.++PyPI has no win_arm64 wheel. Boost and OpenSSL versions follow the upstream+tag's own cibuildwheel config, so the wheel matches the x64 one on PyPI.++Usage:+ python scripts/build_libtorrent_wheel.py <libtorrent version> <python version> <output folder>+"""+import os+import shutil+import subprocess+import sys+from pathlib import Path++UPSTREAM = "https://github.com/arvidn/libtorrent.git"+OPENSSL_FOLDER = Path(r"C:\Program Files\OpenSSL")+++def run(*args: str, cwd: Path | None = None, env: dict[str, str] | None = None) -> None:+ subprocess.run(args, cwd=cwd, env=env, check=True)+++def main() -> None:+ version, pythonVersion, outputFolder = sys.argv[1:]+ source = Path(os.environ["RUNNER_TEMP"]) / "libtorrent"++ run("git", "clone", "--depth=1", f"--branch=v{version}",+ "--recurse-submodules", "--shallow-submodules", UPSTREAM, str(source))+ run("git", "apply", "../patch-libdatachannel-32bit-builds.patch", cwd=source / "deps" / "libdatachannel")++ run("vcpkg", "install", "--triplet=arm64-windows-static", cwd=source / "tools")+ # 上游 pyproject 的 B2_EXTRA_ARGS 固定从这里找 OpenSSL+ shutil.rmtree(OPENSSL_FOLDER, ignore_errors=True)+ run("cmd", "/c", "mklink", "/J", str(OPENSSL_FOLDER),+ str(source / "tools" / "vcpkg_installed" / "arm64-windows-static"))++ env = os.environ | {+ "CIBW_BUILD": f"cp{pythonVersion.replace('.', '')}-win_arm64",+ "CIBW_ARCHS_WINDOWS": "ARM64",+ # 上游只给 win32、win_amd64 配了装 Boost 的 before-all+ "CIBW_BEFORE_ALL_WINDOWS": "bash -c './tools/cibuildwheel/setup_boost.sh $BOOST_VERSION $BOOST_ROOT'",+ "CIBW_TEST_SKIP": "*",+ }+ run("uvx", "cibuildwheel", "--output-dir", str(Path(outputFolder).resolve()), str(source), env=env)+++if __name__ == "__main__":+ main()