Skip to content

Commit 821c6d3

Browse files
committed
Initial commit: restart repo from clean ARM64 native files
0 parents  commit 821c6d3

12 files changed

Lines changed: 1011 additions & 0 deletions
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Build for MinGW ARM64
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build-mingw-arm64:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
env:
11+
llvm_path: "${{ github.workspace }}/llvm-mingw"
12+
libtorrent_path: "${{ github.workspace }}/libtorrent-mingw-arm64"
13+
qt_path: "${{ github.workspace }}/qt-mingw-arm64"
14+
boost_path: "${{ github.workspace }}/boost"
15+
libt_version: "2.0.11"
16+
qbt_version: "5.1.4"
17+
qt_version: "6.9.3"
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Install tools
24+
run: |
25+
sudo apt update
26+
sudo apt install \
27+
aria2 p7zip build-essential cmake ninja-build pkg-config autoconf automake autoconf-archive make texlive-binaries texinfo bison flex m4 libtool
28+
aria2c https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-ucrt-ubuntu-20.04-x86_64.tar.xz
29+
tar -xf llvm-mingw-*.tar.xz
30+
mv llvm-mingw-20240619-ucrt-ubuntu-20.04-x86_64 llvm-mingw
31+
32+
- name: Setup a new (or from cache) vcpkg (and does not build any package)
33+
uses: lukka/run-vcpkg@v11 # Always specify the specific _version_ of the
34+
# action you need, `v11` in this case to stay up
35+
# to date with fixes on the v11 branch
36+
with:
37+
vcpkgGitCommitId: '84bab45d415d22042bd0b9081aea57f362da3f35'
38+
39+
- name: Install dependencies from vcpkg
40+
run: |
41+
PATH=$PATH:${{ env.llvm_path }}/bin
42+
# tell vcpkg to only build Release variants of the dependencies
43+
cd ${{ env.RUNVCPKG_VCPKG_ROOT }}
44+
# patch -p1 < "${{ github.workspace }}/patches//0001-support-openssl-arm64-mingw-static-release.patch"
45+
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/community/arm64-mingw-dynamic.cmake
46+
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/community/arm64-mingw-static.cmake
47+
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/x64-linux.cmake
48+
packages='openssl zlib'
49+
./vcpkg upgrade
50+
./vcpkg install $packages --triplet arm64-mingw-static --clean-after-build
51+
cd installed/arm64-mingw-static/lib/
52+
ln libzlib.a libz.a
53+
54+
- name: Install boost
55+
run: |
56+
aria2c \
57+
"https://archives.boost.io/release/1.90.0/source/boost_1_90_0.7z" \
58+
-o "boost.7z"
59+
7z x "boost.7z"
60+
rm "boost.7z"
61+
mv boost_1_90_0 boost
62+
63+
- name: Install Qt (host x64)
64+
uses: jurplel/install-qt-action@v4
65+
with:
66+
aqtversion: '==3.1.*'
67+
version: '${{ env.qt_version }}'
68+
host: 'linux'
69+
target: 'desktop'
70+
arch: 'linux_gcc_64'
71+
72+
- name: Install Qt (target arm64)
73+
run: |
74+
git clone https://github.com/qt/qt5.git qt6
75+
cd qt6
76+
git checkout "v${{ env.qt_version }}"
77+
perl init-repository --module-subset=qtbase,qtsvg
78+
./configure -opensource -confirm-license -nomake tests -nomake examples \
79+
-static -static-runtime -release -xplatform win32-clang-g++ \
80+
-prefix "${{ env.qt_path }}" -qt-host-path "${{ env.QT_ROOT_DIR }}" \
81+
-system-zlib -qt-sqlite -sql-sqlite -no-sql-mysql -no-sql-odbc -no-sql-psql -no-icu -c++std c++20 -- \
82+
-DQT_FEATURE_openssl_linked=ON \
83+
-DLLVM_ARCH=aarch64 -DVCPKG_LIB_PREFIX="${{ env.RUNVCPKG_VCPKG_ROOT }}/installed/arm64-mingw-static" -DLLVM_PREFIX="${{ env.llvm_path }}" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/Toolchain-llvm-mingw.cmake"
84+
cmake --build .
85+
cmake --install .
86+
87+
- name: Install libtorrent
88+
run: |
89+
git clone \
90+
--branch v${{ env.libt_version }} \
91+
--depth 1 \
92+
--recurse-submodules \
93+
https://github.com/arvidn/libtorrent.git
94+
cd libtorrent
95+
cmake \
96+
-B build \
97+
-G "Ninja" \
98+
-DCMAKE_BUILD_TYPE=Release \
99+
-DCMAKE_INSTALL_PREFIX="${{ env.libtorrent_path }}" \
100+
-DBOOST_ROOT="${{ env.boost_path }}" -DBOOST_SRC="${{ env.boost_path }}" \
101+
-DBUILD_SHARED_LIBS=OFF \
102+
-Ddeprecated-functions=OFF \
103+
-Dstatic_runtime=ON \
104+
-DLLVM_ARCH=aarch64 -DVCPKG_LIB_PREFIX="${{ env.RUNVCPKG_VCPKG_ROOT }}/installed/arm64-mingw-static" -DLLVM_PREFIX="${{ env.llvm_path }}" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/Toolchain-llvm-mingw.cmake"
105+
cmake --build build
106+
cmake --install build
107+
108+
- name: Build qBittorrent
109+
run: |
110+
PATH="${{ env.qt_path }}/bin:$PATH"
111+
aria2c http://prdownloads.sourceforge.net/qbittorrent/qbittorrent/qbittorrent-${{ env.qbt_version }}/qbittorrent-${{ env.qbt_version }}.tar.gz
112+
tar -xf qbittorrent-${{ env.qbt_version }}.tar.gz
113+
cd qbittorrent-${{ env.qbt_version }}
114+
sed -i 's/Iphlpapi PowrProf/iphlpapi powrprof/g' src/base/CMakeLists.txt
115+
cmake \
116+
-B build \
117+
-G "Ninja" \
118+
-DCMAKE_BUILD_TYPE=Release \
119+
-DBOOST_ROOT="${{ env.boost_path }}" -DBOOST_SRC="${{ env.boost_path }}" \
120+
-DLibtorrentRasterbar_DIR="${{ env.libtorrent_path }}/lib/cmake/LibtorrentRasterbar" \
121+
-DSTACKTRACE=OFF \
122+
-DQT6=ON \
123+
-DLLVM_ARCH=aarch64 -DVCPKG_LIB_PREFIX="${{ env.RUNVCPKG_VCPKG_ROOT }}/installed/arm64-mingw-static" -DLLVM_PREFIX="${{ env.llvm_path }}" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/Toolchain-llvm-mingw.cmake"
124+
cmake --build build
125+
126+
- name: Prepare build artifacts
127+
run: |
128+
mkdir upload
129+
cp qbittorrent-${{ env.qbt_version }}/build/qbittorrent.exe upload
130+
cp qbittorrent-${{ env.qbt_version }}/dist/windows/qt.conf upload
131+
cd upload
132+
7z a qbittorrent_${{ env.qbt_version }}_arm64.zip *
133+
mv qbittorrent_${{ env.qbt_version }}_arm64.zip ..
134+
135+
- name: Upload build artifacts
136+
uses: actions/upload-artifact@v6
137+
with:
138+
name: qBittorrent_${{ env.qbt_version }}_arm64
139+
path: upload
140+
141+
- name: Batch release
142+
if: startsWith(github.ref, 'refs/tags/')
143+
uses: softprops/action-gh-release@v1
144+
env:
145+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146+
with:
147+
files: qbittorrent_${{ env.qbt_version }}_arm64.zip
Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
name: Build for Windows ARM64
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build-windows-arm64:
14+
name: Build
15+
runs-on: windows-latest
16+
env:
17+
boost_path: "${{ github.workspace }}/../boost"
18+
libtorrent_path: "${{ github.workspace }}/libtorrent-msvc-arm64"
19+
qt_path: "${{ github.workspace }}/../qt-msvc-arm64"
20+
boost_version: "1.91.0"
21+
libt_version: "2.0.13"
22+
qbt_version: "5.2.3"
23+
qt_version: "6.10.3"
24+
qbt_url_base: "https://github.com/qbittorrent/qBittorrent/archive/refs/tags"
25+
qbt_url_prefix: "release-"
26+
qbt_url_suffix: ".tar.gz"
27+
boost_url: "https://archives.boost.io/release/{version}/source/boost_{version_underscored}.7z"
28+
29+
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
35+
- name: Setup devcmd
36+
uses: ilammy/msvc-dev-cmd@v1
37+
with:
38+
arch: amd64_arm64
39+
40+
- name: Install build tools
41+
run: |
42+
choco install ninja
43+
44+
# use the preinstalled vcpkg from image
45+
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#package-management
46+
- name: Setup vcpkg
47+
uses: lukka/run-vcpkg@v10
48+
with:
49+
vcpkgDirectory: C:/vcpkg
50+
doNotUpdateVcpkg: true # the preinstalled vcpkg is updated regularly
51+
52+
# Fix backslashes for CMake strings to prevent '\v' escape errors
53+
- name: Sanitize vcpkg path for CMake
54+
shell: pwsh
55+
run: |
56+
$clean_path = "${{ env.RUNVCPKG_VCPKG_ROOT }}".Replace('\', '/')
57+
echo "VCPKG_CMAKE_ROOT=$clean_path" >> $env:GITHUB_ENV
58+
59+
60+
- name: Install dependencies from vcpkg
61+
run: |
62+
# clear buildtrees after each package installation to reduce disk space requirements
63+
$packages = `
64+
"openssl:arm64-windows-static-release",
65+
"zlib:arm64-windows-static-release"
66+
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe upgrade `
67+
--no-dry-run
68+
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install `
69+
--clean-after-build `
70+
$packages
71+
72+
# added to build url based on version and server
73+
- name: Build Boost URL
74+
shell: pwsh
75+
run: |
76+
function Build-Url {
77+
param(
78+
[string]$version,
79+
[string]$template
80+
)
81+
82+
# Convert dotted to underscored
83+
$v_u = $version -replace '\.', '_'
84+
85+
# Replace placeholders
86+
$url = $template `
87+
-replace '\{version\}', $version `
88+
-replace '\{version_underscored\}', $v_u
89+
90+
return $url
91+
}
92+
$url = Build-Url "${{ env.boost_version }}" "${{ env.boost_url }}"
93+
echo "boost_url=$url" >> $env:GITHUB_ENV
94+
95+
- name: Install boost
96+
run: |
97+
aria2c `
98+
"${{ env.boost_url }}" `
99+
-d "${{ runner.temp }}" `
100+
-o "boost.7z"
101+
7z x "${{ runner.temp }}/boost.7z" -o"${{ github.workspace }}/.."
102+
move "${{ github.workspace }}/../boost_*" "${{ env.boost_path }}"
103+
104+
# added to build url based on version and server
105+
- name: Build qBittorrent URL
106+
shell: pwsh
107+
run: |
108+
$url = "${{ env.qbt_url_base }}/${{ env.qbt_url_prefix }}${{ env.qbt_version }}${{ env.qbt_url_suffix }}"
109+
echo "qbt_url=$url" >> $env:GITHUB_ENV
110+
111+
- name: Install Qt (host x64)
112+
uses: jurplel/install-qt-action@v4
113+
with:
114+
aqtversion: '==3.3.*'
115+
version: "${{ env.qt_version }}"
116+
archives: 'qtbase qttools'
117+
set-env: 'false'
118+
dir: 'C:'
119+
120+
- name: Verify Environment and CMake
121+
run: |
122+
echo "Target Version: ${{ env.qt_version }}"
123+
cmake --version
124+
ninja --version 2>&1 || echo "Ninja not found"
125+
126+
- name: Install Qt (target arm64)
127+
run: |
128+
$env:Path = "C:\Qt\${{ env.qt_version }}\msvc2022_64\bin;" + $env:Path
129+
git clone https://github.com/qt/qt5.git qt6
130+
cd qt6
131+
git checkout "v${{ env.qt_version }}"
132+
./configure -init-submodules -submodules qtbase,qtsvg
133+
rm CMakeCache.txt
134+
./configure -opensource -confirm-license -nomake tests -nomake examples `
135+
-static -static-runtime -release -xplatform win32-arm64-msvc `
136+
-prefix "${{ env.qt_path }}" `
137+
-qt-host-path "C:/Qt/${{ env.qt_version }}/msvc2022_64" `
138+
-system-zlib -schannel -qt-sqlite -sql-sqlite -no-sql-mysql -no-sql-odbc -no-sql-psql -c++std c++20 -- `
139+
-DCMAKE_PREFIX_PATH="${{ env.VCPKG_CMAKE_ROOT }}/installed/arm64-windows-static-release" `
140+
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_CMAKE_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
141+
-DVCPKG_TARGET_TRIPLET=arm64-windows-static-release
142+
143+
cmake --build .
144+
cmake --install .
145+
146+
- name: Install libtorrent
147+
run: |
148+
git clone `
149+
--branch v${{ env.libt_version }} `
150+
--depth 1 `
151+
--recurse-submodules `
152+
https://github.com/arvidn/libtorrent.git
153+
cd libtorrent
154+
cmake `
155+
-B build `
156+
-G "Ninja" `
157+
-DCMAKE_BUILD_TYPE=Release `
158+
-DCMAKE_INSTALL_PREFIX="${{ env.libtorrent_path }}" `
159+
-DCMAKE_TOOLCHAIN_FILE="${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
160+
-DBOOST_ROOT="${{ env.boost_path }}" `
161+
-DBUILD_SHARED_LIBS=OFF `
162+
-Ddeprecated-functions=OFF `
163+
-Dstatic_runtime=ON `
164+
-DVCPKG_TARGET_TRIPLET=arm64-windows-static-release
165+
cmake --build build
166+
cmake --install build
167+
168+
- name: Build qBittorrent
169+
run: |
170+
# Resolve your custom ARM64 Qt path cleanly
171+
$AbsoluteQtPath = (Get-Item "${{ env.qt_path }}").FullName.Replace('\', '/')
172+
$HostQtPath = "C:/Qt/${{ env.qt_version }}/msvc2022_64"
173+
$VcpkgInstalledPath = "C:/vcpkg/installed/arm64-windows-static-release"
174+
175+
$env:path = "$AbsoluteQtPath/bin;$env:path"
176+
$env:LDFLAGS+=" /FORCE:MULTIPLE"
177+
aria2c "${{ env.qbt_url }}"
178+
tar -xf qbittorrent-release-${{ env.qbt_version }}.tar.gz
179+
cd qbittorrent-release-${{ env.qbt_version }}
180+
181+
# --- HOTFIX: Force Global Visibility for ZLIB & OpenSSL ---
182+
$FixCode = @"
183+
# Forced Global Promotion Hotfix
184+
find_package(ZLIB REQUIRED)
185+
if(TARGET ZLIB::ZLIB)
186+
set_property(TARGET ZLIB::ZLIB PROPERTY IMPORTED_GLOBAL TRUE)
187+
endif()
188+
find_package(OpenSSL REQUIRED)
189+
if(TARGET OpenSSL::SSL)
190+
set_property(TARGET OpenSSL::SSL PROPERTY IMPORTED_GLOBAL TRUE)
191+
endif()
192+
if(TARGET OpenSSL::Crypto)
193+
set_property(TARGET OpenSSL::Crypto PROPERTY IMPORTED_GLOBAL TRUE)
194+
endif()
195+
"@
196+
197+
$Path = "cmake/Modules/CheckPackages.cmake"
198+
$OriginalContent = Get-Content $Path -Raw
199+
Set-Content $Path -Value ($FixCode + "`n" + $OriginalContent)
200+
Write-Host "Successfully injected global target promotion hotfix into $Path"
201+
# --- END HOTFIX ---
202+
203+
cmake `
204+
-B build `
205+
-G "Ninja" `
206+
-DCMAKE_BUILD_TYPE=Release `
207+
-DCMAKE_PREFIX_PATH="$AbsoluteQtPath;$HostQtPath;$VcpkgInstalledPath" `
208+
-DQT_HOST_PATH="$HostQtPath" `
209+
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_CMAKE_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
210+
-DVCPKG_MANIFEST_MODE=OFF `
211+
-DBOOST_ROOT="${{ env.boost_path }}" `
212+
-DLibtorrentRasterbar_DIR="${{ env.libtorrent_path }}/lib/cmake/LibtorrentRasterbar" `
213+
-DMSVC_RUNTIME_DYNAMIC=OFF `
214+
-DSTACKTRACE=OFF `
215+
-DQT_NO_PRIVATE_MODULE_WARNING=ON `
216+
-DVCPKG_TARGET_TRIPLET=arm64-windows-static-release
217+
cmake --build build
218+
219+
- name: Prepare build artifacts
220+
run: |
221+
mkdir upload
222+
copy qbittorrent-release-${{ env.qbt_version }}/build/qbittorrent.exe upload
223+
copy qbittorrent-release-${{ env.qbt_version }}/dist/windows/qt.conf upload
224+
cd upload
225+
7z a qbittorrent_${{ env.qbt_version }}_arm64.zip *
226+
mv qbittorrent_${{ env.qbt_version }}_arm64.zip ..
227+
228+
- name: Upload build artifacts
229+
uses: actions/upload-artifact@v4
230+
with:
231+
name: qBittorrent_${{ env.qbt_version }}_arm64
232+
path: upload
233+
234+
- name: Publish to GitHub Releases
235+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
236+
uses: softprops/action-gh-release@v2
237+
with:
238+
name: qBittorrent ${{ env.qbt_version }} (Windows ARM64)
239+
tag_name: v${{ env.qbt_version }}
240+
files: qbittorrent_${{ env.qbt_version }}_arm64.zip
241+
draft: false
242+
prerelease: false
243+
body: |
244+
### Build Dependency Components:
245+
* **qBittorrent:** ${{ env.qbt_version }}
246+
* **Libtorrent:** ${{ env.libt_version }}
247+
* **Boost:** ${{ env.boost_version }}
248+
* **Qt:** ${{ env.qt_version }}
249+
env:
250+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)