From ec91300dc82bb77def675ca5adff08fe74e3f2aa Mon Sep 17 00:00:00 2001 From: qstokkink Date: Mon, 28 Oct 2024 09:45:55 +0100 Subject: [PATCH] Added Windows x64 build And some minor cleanup of the build script. --- .github/workflows/build.yml | 58 ++++++++++++++++++++++++++------- build/win/locate-python.py | 10 ------ build/win/resources/tribler.nsi | 10 ++---- 3 files changed, 48 insertions(+), 30 deletions(-) delete mode 100755 build/win/locate-python.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 360dfbf0021..d02165e9f17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,11 +4,19 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, windows-latest] # macos-12 is no longer on GitHub Actions, we use the Mac mini for this - + include: # macos-12 is no longer on GitHub Actions, we use the Mac mini for this + - os: ubuntu-latest + architecture: x64 + - os: windows-latest + architecture: x86 + - os: windows-latest + architecture: x64 runs-on: ${{ matrix.os }} - steps: + + ######################################## + # NSIS installer (Windows, always x86) # + ######################################## - name: Check out SimpleFC repository (Windows) if: matrix.os == 'windows-latest' uses: actions/checkout@v4 @@ -35,6 +43,10 @@ jobs: copy "Release UNICODE\nsProcess.dll" "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\nsProcess.dll" cd ../Include copy nsProcess.nsh "C:\Program Files (x86)\NSIS\Include\nsProcess.nsh" + + ####################### + # Package preparation # + ####################### - name: Check-out repository uses: actions/checkout@v4 with: @@ -67,10 +79,11 @@ jobs: rm -rf pyipv8/stresstest rm -rf pyipv8/systemd rm -rf pyipv8/ipv8/test - - name: Setup Python + - name: Setup Python ${{ matrix.architecture }} uses: actions/setup-python@v5 with: python-version: '3.10' + architecture: ${{ matrix.architecture }} cache: 'pip' cache-dependency-path: | **/build/requirements.txt @@ -86,38 +99,59 @@ jobs: npm install npm run build rm -rf node_modules - - name: Determine tag + - name: Determine release tag shell: bash run: | git fetch --tags git for-each-ref --count=1 --sort=-creatordate --format '%(refname)' refs/tags > raw_tag.txt GITHUB_TAG=$(git name-rev --tags --name-only $(cat raw_tag.txt)) echo "GITHUB_TAG=${GITHUB_TAG#v}" >> $GITHUB_ENV + + ##################### + # Individual builds # + ##################### - name: Build Executables (Ubuntu) if: matrix.os == 'ubuntu-latest' run: | sudo apt-get install -y --allow-downgrades alien cpio=2.13+dfsg-7 devscripts fakeroot gir1.2-gtk-4.0 libgirepository1.0-dev rpm ./build/debian/makedist_debian.sh - mv build/debian/tribler_${GITHUB_TAG}_all.deb build/debian/tribler_${GITHUB_TAG}_amd64.deb + mv build/debian/tribler_${GITHUB_TAG}_all.deb build/debian/tribler_${GITHUB_TAG}_${{ matrix.architecture }}.deb + - name: Build Executables (MacOS-12) if: matrix.os == 'macos-12' run: | mv ./build/tribler.spec ./tribler.spec ./build/mac/makedist_macos.sh - - uses: actions/cache/restore@v4 + + - name: Fetch libsodium.dll (Windows) if: matrix.os == 'windows-latest' - id: restore_cache - with: - path: src/libsodium.dll - key: cache_libsodium_dll + run: | + vcpkg install libsodium:${{ matrix.architecture }}-windows + Copy C:/vcpkg/packages/libsodium_${{ matrix.architecture }}-windows/bin/libsodium.dll src/libsodium.dll + - name: Install OpenSSL (Windows, x86) + if: ${{ matrix.os == 'windows-latest' && matrix.architecture == 'x86'}} + run: | + Remove-Item -Path "C:\Program Files\OpenSSL" -Force -Recurse + vcpkg install openssl:x86-windows + New-Item -Path "C:\Program Files\OpenSSL" -ItemType SymbolicLink -Value "C:\vcpkg\packages\openssl_x86-windows\" - name: Build Executables (Windows) if: matrix.os == 'windows-latest' run: | + (gc build/win/resources/tribler.nsi) -replace '!define BITVERSION "x86"', '!define BITVERSION "${{ matrix.architecture }}"' | Out-File -encoding ASCII build/win/resources/tribler.nsi ./build/win/makedist_win.bat + echo 'Double-check executable architectures' + echo '> Should be "${{ matrix.architecture }}"' + 7z l ./dist/tribler/tribler.exe | findstr CPU + echo '> Should be "x86"' + 7z l ./dist/*.exe | findstr CPU + + ################################ + # Cleanup and artifact uploads # + ################################ - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: ${{ runner.os }} Build + name: ${{ runner.os }} ${{ matrix.architecture }} Build path: | dist/*.exe dist/*.dmg diff --git a/build/win/locate-python.py b/build/win/locate-python.py deleted file mode 100755 index 434734d11ea..00000000000 --- a/build/win/locate-python.py +++ /dev/null @@ -1,10 +0,0 @@ -""" -Print the directory where Python is installed. - -Author(s): Lipu Fei -""" -import os -import sys - -if __name__ == "__main__": - print(os.path.abspath(os.path.dirname(sys.executable))) diff --git a/build/win/resources/tribler.nsi b/build/win/resources/tribler.nsi index f28895f8079..38ffa58cb45 100644 --- a/build/win/resources/tribler.nsi +++ b/build/win/resources/tribler.nsi @@ -111,15 +111,9 @@ Section "!Main EXE" SecMain ; Install MSVCR 2008, 2012 and 2015 SetOutPath "$INSTDIR" - ; Libraries dependant on 2012 are: LibTorrent - ; 2019-10-24: Latest version is compiled against 2015 so we don't need this dependency here. Remove it completely - ; When python2 dependency is removed. - ; File vc_redist_110.exe - ; ExecWait "$INSTDIR\vc_redist_110.exe /q /norestart" - ; Libraries dependant on 2015 are: Python, Qt5 - File "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\v143\vc_redist.x64.exe" - ExecWait "$INSTDIR\vc_redist.x64.exe /q /norestart" + File "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\v143\vc_redist.${BITVERSION}.exe" + ExecWait "$INSTDIR\vc_redist.${BITVERSION}.exe /q /norestart" FileOpen $9 "$INSTDIR\tribler.exe.log" w FileWrite $9 ""