CI: Fix up Linux/Mac build and disable UWP (for now)

This commit is contained in:
Connor McLaughlin 2022-07-21 17:27:32 +10:00
parent b42b5501f6
commit 0590a6098d
4 changed files with 585 additions and 174 deletions

View file

@ -161,95 +161,95 @@ jobs:
path: "duckstation-windows-arm64-release.zip"
windows-uwp-build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2.3.1
with:
fetch-depth: 0
submodules: false
- name: Tag as preview build
if: github.ref == 'refs/heads/master'
shell: cmd
run: |
echo #pragma once > src/scmversion/tag.h
echo #define SCM_RELEASE_ASSET "duckstation-windows-x64-release.zip" >> src/scmversion/tag.h
echo #define SCM_RELEASE_TAGS {"latest", "preview"} >> src/scmversion/tag.h
echo #define SCM_RELEASE_TAG "preview" >> src/scmversion/tag.h
- name: Tag as dev build
if: github.ref == 'refs/heads/dev'
shell: cmd
run: |
echo #pragma once > src/scmversion/tag.h
echo #define SCM_RELEASE_ASSET "duckstation-windows-x64-release.zip" >> src/scmversion/tag.h
echo #define SCM_RELEASE_TAGS {"latest", "preview"} >> src/scmversion/tag.h
echo #define SCM_RELEASE_TAG "latest" >> src/scmversion/tag.h
- name: Write signing key
id: write_signing_key
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
uses: timheuer/base64-to-file@v1
with:
fileName: 'duckstation-uwp.pfx'
encodedString: ${{ secrets.UWP_PFX_KEY }}
- name: Copy signing key
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
shell: cmd
run: |
copy ${{ steps.write_signing_key.outputs.filePath }} src\duckstation-uwp\duckstation-uwp.pfx
- name: Disable AppX signing
if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev'
shell: powershell
run: |
(gc .\src\duckstation-uwp\duckstation-uwp.vcxproj) -replace '<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>', '<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>' | Out-File -encoding ASCII .\src\duckstation-uwp\duckstation-uwp.vcxproj
- name: Restore nuget packages
shell: cmd
run: |
nuget restore duckstation-uwp.sln
- name: Compile x64 release build without bundle
if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev'
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
msbuild duckstation-uwp.sln /p:Configuration="ReleaseUWP" /p:Platform="x64" /t:Build
- name: Compile x64 release build with bundle
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
msbuild duckstation-uwp.sln /p:AppxBundle=Always /p:AppxPackageIsForStore=true /p:BuildAppxUploadPackageForUap=true /p:AppxBundlePlatforms="x64" /p:Configuration="ReleaseUWP" /p:Platform="x64" /t:Build
- name: Grab AppX package
shell: cmd
run: |
copy build\ReleaseUWP-x64\duckstation-uwp\duckstation-uwp_1.0.0.0_Bundle\duckstation-uwp_1.0.0.0_x64_ReleaseUWP.appx duckstation-uwp.appx
- name: Export certificate
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
shell: powershell
run: |
Get-PfxCertificate -FilePath .\src\duckstation-uwp\duckstation-uwp.pfx | Export-Certificate -FilePath duckstation-uwp.der -Type CERT
- name: Upload AppX package
uses: actions/upload-artifact@v1
with:
name: "windows-uwp"
path: "duckstation-uwp.appx"
- name: Upload certificate
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
uses: actions/upload-artifact@v1
with:
name: "windows-uwp"
path: "duckstation-uwp.der"
# windows-uwp-build:
# runs-on: windows-2022
# steps:
# - uses: actions/checkout@v2.3.1
# with:
# fetch-depth: 0
# submodules: false
#
# - name: Tag as preview build
# if: github.ref == 'refs/heads/master'
# shell: cmd
# run: |
# echo #pragma once > src/scmversion/tag.h
# echo #define SCM_RELEASE_ASSET "duckstation-windows-x64-release.zip" >> src/scmversion/tag.h
# echo #define SCM_RELEASE_TAGS {"latest", "preview"} >> src/scmversion/tag.h
# echo #define SCM_RELEASE_TAG "preview" >> src/scmversion/tag.h
#
#
# - name: Tag as dev build
# if: github.ref == 'refs/heads/dev'
# shell: cmd
# run: |
# echo #pragma once > src/scmversion/tag.h
# echo #define SCM_RELEASE_ASSET "duckstation-windows-x64-release.zip" >> src/scmversion/tag.h
# echo #define SCM_RELEASE_TAGS {"latest", "preview"} >> src/scmversion/tag.h
# echo #define SCM_RELEASE_TAG "latest" >> src/scmversion/tag.h
#
# - name: Write signing key
# id: write_signing_key
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
# uses: timheuer/base64-to-file@v1
# with:
# fileName: 'duckstation-uwp.pfx'
# encodedString: ${{ secrets.UWP_PFX_KEY }}
#
# - name: Copy signing key
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
# shell: cmd
# run: |
# copy ${{ steps.write_signing_key.outputs.filePath }} src\duckstation-uwp\duckstation-uwp.pfx
#
# - name: Disable AppX signing
# if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev'
# shell: powershell
# run: |
# (gc .\src\duckstation-uwp\duckstation-uwp.vcxproj) -replace '<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>', '<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>' | Out-File -encoding ASCII .\src\duckstation-uwp\duckstation-uwp.vcxproj
#
# - name: Restore nuget packages
# shell: cmd
# run: |
# nuget restore duckstation-uwp.sln
#
# - name: Compile x64 release build without bundle
# if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev'
# shell: cmd
# run: |
# call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
# msbuild duckstation-uwp.sln /p:Configuration="ReleaseUWP" /p:Platform="x64" /t:Build
#
# - name: Compile x64 release build with bundle
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
# shell: cmd
# run: |
# call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
# msbuild duckstation-uwp.sln /p:AppxBundle=Always /p:AppxPackageIsForStore=true /p:BuildAppxUploadPackageForUap=true /p:AppxBundlePlatforms="x64" /p:Configuration="ReleaseUWP" /p:Platform="x64" /t:Build
#
# - name: Grab AppX package
# shell: cmd
# run: |
# copy build\ReleaseUWP-x64\duckstation-uwp\duckstation-uwp_1.0.0.0_Bundle\duckstation-uwp_1.0.0.0_x64_ReleaseUWP.appx duckstation-uwp.appx
#
# - name: Export certificate
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
# shell: powershell
# run: |
# Get-PfxCertificate -FilePath .\src\duckstation-uwp\duckstation-uwp.pfx | Export-Certificate -FilePath duckstation-uwp.der -Type CERT
#
# - name: Upload AppX package
# uses: actions/upload-artifact@v1
# with:
# name: "windows-uwp"
# path: "duckstation-uwp.appx"
#
# - name: Upload certificate
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
# uses: actions/upload-artifact@v1
# with:
# name: "windows-uwp"
# path: "duckstation-uwp.der"
linux-build:
@ -263,79 +263,93 @@ jobs:
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install cmake ninja-build ccache libsdl2-dev libgtk-3-dev qtbase5-dev qtbase5-dev-tools qtbase5-private-dev qt5-default qttools5-dev qtwayland5 libegl1-mesa-dev libevdev-dev libgbm-dev libdrm-dev libqt5waylandclient5-dev libqt5waylandcompositor5-dev libwayland-dev libwayland-egl-backend-dev extra-cmake-modules libcurl4-gnutls-dev libxrandr-dev
sudo apt-get -y install cmake ninja-build ccache libsdl2-dev libgtk-3-dev libegl1-mesa-dev libevdev-dev libgbm-dev libdrm-dev libwayland-dev libwayland-egl-backend-dev extra-cmake-modules libcurl4-gnutls-dev libxrandr-dev llvm-12 lld-12 clang-12
- name: Cache Dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: ~/deps
key: deps ${{ hashFiles('scripts/build-dependencies.sh') }}
- name: Build Dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: scripts/build-dependencies.sh
- name: Compile build
shell: bash
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=ON -DBUILD_QT_FRONTEND=ON -DUSE_DRMKMS=ON -DUSE_EGL=ON -DUSE_SDL2=ON -DUSE_WAYLAND=ON -DUSE_X11=ON -G Ninja ..
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_DRMKMS=ON -DUSE_EGL=ON -DUSE_SDL2=ON -DUSE_WAYLAND=ON -DUSE_X11=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_PREFIX_PATH=$HOME/deps -DCMAKE_TOOLCHAIN_FILE=../scripts/clang-toolchain.cmake ..
cmake --build . --parallel
../scripts/generate_appimages.sh $(pwd)
cd ..
scripts/make-appimage.sh $(realpath ./build) $(realpath .) $HOME/deps DuckStation-x64
- name: Upload NoGUI AppImage
uses: actions/upload-artifact@v1
with:
name: "linux-x64-appimage-nogui"
path: "build/duckstation-nogui-x64.AppImage"
- name: Upload NoGUI AppImage zsync
uses: actions/upload-artifact@v1
with:
name: "linux-x64-appimage-nogui-zsync"
path: "build/duckstation-nogui-x64.AppImage.zsync"
# - name: Upload NoGUI AppImage
# uses: actions/upload-artifact@v1
# with:
# name: "linux-x64-appimage-nogui"
# path: "build/duckstation-nogui-x64.AppImage"
#
# - name: Upload NoGUI AppImage zsync
# uses: actions/upload-artifact@v1
# with:
# name: "linux-x64-appimage-nogui-zsync"
# path: "build/duckstation-nogui-x64.AppImage.zsync"
- name: Upload Qt AppImage
uses: actions/upload-artifact@v1
with:
name: "linux-x64-appimage-qt"
path: "build/duckstation-qt-x64.AppImage"
path: "DuckStation-x64.AppImage"
- name: Upload Qt AppImage zsync
uses: actions/upload-artifact@v1
with:
name: "linux-x64-appimage-qt-zsync"
path: "build/duckstation-qt-x64.AppImage.zsync"
# - name: Upload Qt AppImage zsync
# uses: actions/upload-artifact@v1
# with:
# name: "linux-x64-appimage-qt-zsync"
# path: "build/duckstation-qt-x64.AppImage.zsync"
macos-build:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2.3.1
with:
fetch-depth: 0
- name: Install packages
shell: bash
run: |
brew install qt5 sdl2 curl ninja
- name: Clone mac externals
shell: bash
run: |
git clone https://github.com/stenzek/duckstation-ext-mac.git dep/mac
- name: Compile and zip .app
shell: bash
run: |
mkdir build
cd build
export MACOSX_DEPLOYMENT_TARGET=10.14
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DQt5_DIR=/usr/local/opt/qt@5/lib/cmake/Qt5 -G Ninja ..
cmake --build . --parallel
cd bin
zip -r duckstation-mac-release.zip DuckStation.app/
- name: Upload macOS .app
uses: actions/upload-artifact@v1
with:
name: "macos-x64"
path: "build/bin/duckstation-mac-release.zip"
# Disabled until we switch to macdeployqt
# macos-build:
# runs-on: macos-11
# steps:
# - uses: actions/checkout@v2.3.1
# with:
# fetch-depth: 0
#
# - name: Install packages
# shell: bash
# run: |
# brew install qt6 sdl2 curl ninja
#
# - name: Clone mac externals
# shell: bash
# run: |
# git clone https://github.com/stenzek/duckstation-ext-mac.git dep/mac
#
# - name: Compile and zip .app
# shell: bash
# run: |
# mkdir build
# cd build
# ls -lh /usr/local/opt
# export MACOSX_DEPLOYMENT_TARGET=10.14
# cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DQt6_DIR=/usr/local/opt/qt@6/lib/cmake/Qt6 -G Ninja ..
# cmake --build . --parallel
# cd bin
# zip -r duckstation-mac-release.zip DuckStation.app/
#
# - name: Upload macOS .app
# uses: actions/upload-artifact@v1
# with:
# name: "macos-x64"
# path: "build/bin/duckstation-mac-release.zip"
create-release:
needs: [windows-build, windows-arm64-build, linux-build, windows-uwp-build]
#needs: [windows-build, windows-arm64-build, linux-build, windows-uwp-build]
needs: [windows-build, windows-arm64-build, linux-build]
runs-on: "ubuntu-20.04"
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
steps:
@ -349,30 +363,30 @@ jobs:
with:
name: "windows-arm64"
- name: Download Windows UWP Artifact
uses: actions/download-artifact@v1
with:
name: "windows-uwp"
- name: Download NoGUI AppImage Artifact
uses: actions/download-artifact@v1
with:
name: "linux-x64-appimage-nogui"
- name: Download NoGUI AppImage zsync Artifact
uses: actions/download-artifact@v1
with:
name: "linux-x64-appimage-nogui-zsync"
# - name: Download Windows UWP Artifact
# uses: actions/download-artifact@v1
# with:
# name: "windows-uwp"
#
# - name: Download NoGUI AppImage Artifact
# uses: actions/download-artifact@v1
# with:
# name: "linux-x64-appimage-nogui"
#
# - name: Download NoGUI AppImage zsync Artifact
# uses: actions/download-artifact@v1
# with:
# name: "linux-x64-appimage-nogui-zsync"
- name: Download Qt AppImage Artifact
uses: actions/download-artifact@v1
with:
name: "linux-x64-appimage-qt"
- name: Download Qt AppImage zsync Artifact
uses: actions/download-artifact@v1
with:
name: "linux-x64-appimage-qt-zsync"
# - name: Download Qt AppImage zsync Artifact
# uses: actions/download-artifact@v1
# with:
# name: "linux-x64-appimage-qt-zsync"
- name: Create preview release
if: github.ref == 'refs/heads/master'
@ -387,12 +401,13 @@ jobs:
windows/duckstation-windows-x64-release-symbols.zip
windows-arm64/duckstation-windows-arm64-release.zip
windows-arm64/duckstation-windows-arm64-release-symbols.zip
windows-uwp/duckstation-uwp.appx
windows-uwp/duckstation-uwp.der
linux-x64-appimage-nogui/duckstation-nogui-x64.AppImage
linux-x64-appimage-nogui-zsync/duckstation-nogui-x64.AppImage.zsync
linux-x64-appimage-qt/duckstation-qt-x64.AppImage
linux-x64-appimage-qt-zsync/duckstation-qt-x64.AppImage.zsync
linux-x64-appimage-qt/DuckStation-x64
# linux-x64-appimage-qt/duckstation-qt-x64.AppImage
# linux-x64-appimage-qt-zsync/duckstation-qt-x64.AppImage.zsync
# windows-uwp/duckstation-uwp.appx
# windows-uwp/duckstation-uwp.der
# linux-x64-appimage-nogui/duckstation-nogui-x64.AppImage
# linux-x64-appimage-nogui-zsync/duckstation-nogui-x64.AppImage.zsync
- name: Create dev release
if: github.ref == 'refs/heads/dev'
@ -407,9 +422,10 @@ jobs:
windows/duckstation-windows-x64-release-symbols.zip
windows-arm64/duckstation-windows-arm64-release.zip
windows-arm64/duckstation-windows-arm64-release-symbols.zip
windows-uwp/duckstation-uwp.appx
windows-uwp/duckstation-uwp.der
linux-x64-appimage-nogui/duckstation-nogui-x64.AppImage
linux-x64-appimage-nogui-zsync/duckstation-nogui-x64.AppImage.zsync
linux-x64-appimage-qt/duckstation-qt-x64.AppImage
linux-x64-appimage-qt-zsync/duckstation-qt-x64.AppImage.zsync
linux-x64-appimage-qt/DuckStation-x64
# linux-x64-appimage-qt/duckstation-qt-x64.AppImage
# linux-x64-appimage-qt-zsync/duckstation-qt-x64.AppImage.zsync
# windows-uwp/duckstation-uwp.appx
# windows-uwp/duckstation-uwp.der
# linux-x64-appimage-nogui/duckstation-nogui-x64.AppImage
# linux-x64-appimage-nogui-zsync/duckstation-nogui-x64.AppImage.zsync

130
scripts/build-dependencies.sh Executable file
View file

@ -0,0 +1,130 @@
#!/usr/bin/env bash
set -e
sudo apt-get install -y build-essential git cmake ccache ninja-build libclang-dev libclang-11-dev libclang-12-dev patchelf \
libglib2.0-dev libfontconfig1-dev libharfbuzz-dev libjpeg-dev libpng-dev libfreetype-dev libinput-dev libxcb-*-dev \
libxkbcommon-dev libxkbcommon-x11-dev libxrender-dev libwayland-dev libgl1-mesa-dev libegl-dev libegl1-mesa-dev \
libgl1-mesa-dev libssl-dev
INSTALLDIR="$HOME/deps"
NPROCS="$(getconf _NPROCESSORS_ONLN)"
SDL=SDL2-2.0.22
QT=6.3.1
mkdir -p deps-build
cd deps-build
cat > SHASUMS <<EOF
fe7cbf3127882e3fc7259a75a0cb585620272c51745d3852ab9dd87960697f2e $SDL.tar.gz
0a64421d9c2469c2c48490a032ab91d547017c9cc171f3f8070bc31888f24e03 qtbase-everywhere-src-6.3.1.tar.xz
7b19f418e6f7b8e23344082dd04440aacf5da23c5a73980ba22ae4eba4f87df7 qtsvg-everywhere-src-6.3.1.tar.xz
c412750f2aa3beb93fce5f30517c607f55daaeb7d0407af206a8adf917e126c1 qttools-everywhere-src-6.3.1.tar.xz
d7bdd55e2908ded901dcc262157100af2a490bf04d31e32995f6d91d78dfdb97 qttranslations-everywhere-src-6.3.1.tar.xz
6f14fea2d172a5b4170be3efcb0e58535f6605b61bcd823f6d5c9d165bb8c0f0 qtwayland-everywhere-src-6.3.1.tar.xz
EOF
curl -L \
-O "https://libsdl.org/release/$SDL.tar.gz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtbase-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtwayland-everywhere-src-$QT.tar.xz"
shasum -a 256 --check SHASUMS
echo "Building SDL..."
tar xf "$SDL.tar.gz"
cd "$SDL"
./configure --prefix "$INSTALLDIR" --disable-dbus --without-x --disable-video-opengl --disable-video-opengles --disable-video-vulkan --disable-wayland-shared --disable-ime --disable-oss --disable-alsa --disable-jack --disable-esd --disable-pipewire --disable-pulseaudio --disable-arts --disable-nas --disable-sndio --disable-fusionsound --disable-diskaudio
make "-j$NPROCS"
make install
cd ..
# Couple notes:
# -fontconfig is needed otherwise Qt Widgets render only boxes.
# -qt-doubleconversion avoids a dependency on libdouble-conversion.
# ICU avoids pulling in a bunch of large libraries, and hopefully we can get away without it.
# OpenGL is needed to render window decorations in Wayland, apparently.
echo "Building Qt Base..."
tar xf "qtbase-everywhere-src-$QT.tar.xz"
cd "qtbase-everywhere-src-$QT"
mkdir build
cd build
../configure -prefix "$INSTALLDIR" -release -no-dbus -gui -widgets -fontconfig -qt-doubleconversion -openssl-runtime -opengl desktop -qpa xcb,wayland -xkbcommon -- -DFEATURE_dbus=OFF -DFEATURE_icu=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF
cmake --build . --parallel
cmake --install .
cd ../../
echo "Building Qt SVG..."
tar xf "qtsvg-everywhere-src-$QT.tar.xz"
cd "qtsvg-everywhere-src-$QT"
mkdir build
cd build
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel
cmake --install .
cd ../../
echo "Building Qt Wayland..."
tar xf "qtwayland-everywhere-src-$QT.tar.xz"
cd "qtwayland-everywhere-src-$QT"
# Fix QML dependency on QtWayland.
patch -u src/compositor/CMakeLists.txt <<EOF
--- src/compositor/CMakeLists.bak 2022-07-21 19:15:19.469344818 +1000
+++ src/compositor/CMakeLists.txt 2022-07-21 19:15:34.948567707 +1000
@@ -46,7 +46,6 @@
global/qtwaylandcompositorglobal.h
global/qtwaylandqmlinclude.h
global/qwaylandcompositorextension.cpp global/qwaylandcompositorextension.h global/qwaylandcompositorextension_p.h
- global/qwaylandquickextension.cpp global/qwaylandquickextension.h
global/qwaylandutils_p.h
hardware_integration/qwlclientbufferintegration.cpp hardware_integration/qwlclientbufferintegration_p.h
wayland_wrapper/qwlbuffermanager.cpp wayland_wrapper/qwlbuffermanager_p.h
EOF
mkdir build
cd build
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel
cmake --install .
cd ../../
echo "Installing Qt Tools..."
tar xf "qttools-everywhere-src-$QT.tar.xz"
cd "qttools-everywhere-src-$QT"
# From Mac build-dependencies.sh:
# Linguist relies on a library in the Designer target, which takes 5-7 minutes to build on the CI
# Avoid it by not building Linguist, since we only need the tools that come with it
patch -u src/linguist/CMakeLists.txt <<EOF
--- src/linguist/CMakeLists.txt
+++ src/linguist/CMakeLists.txt
@@ -14,7 +14,7 @@
add_subdirectory(lrelease-pro)
add_subdirectory(lupdate)
add_subdirectory(lupdate-pro)
-if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND NOT no-png)
+if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND TARGET Qt::PrintSupport AND NOT no-png)
add_subdirectory(linguist)
endif()
EOF
mkdir build
cd build
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=OFF -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF ..
cmake --build . --parallel
cmake --install .
cd ../../
echo "Installing Qt Translations..."
tar xf "qttranslations-everywhere-src-$QT.tar.xz"
cd "qttranslations-everywhere-src-$QT"
mkdir build
cd build
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel
cmake --install .
cd ../../
echo "Cleaning up..."
cd ..
rm -r deps-build

View file

@ -0,0 +1,5 @@
set(CMAKE_C_COMPILER /usr/bin/clang-12)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld")

260
scripts/make-appimage.sh Executable file
View file

@ -0,0 +1,260 @@
#!/usr/bin/env bash
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
if [ "$#" -ne 4 ]; then
echo "Syntax: $0 <path to build directory> <path to root directory> <deps prefix> <output name>"
exit 1
fi
BUILDDIR=$1
ROOTDIR=$2
DEPSDIR=$3
NAME=$4
BINDIR="$DSDIR/bin"
BINARY=duckstation-qt
APPDIRNAME=DuckStation.AppDir
STRIP=llvm-strip-12
declare -a SYSLIBS=(
"libz.so.1"
"libuuid.so.1"
"libapparmor.so.1"
"libblkid.so.1"
"libbsd.so.0"
"libdbus-1.so.3"
"libgcrypt.so.20"
"liblzma.so.5"
"libmount.so.1"
"libnsl.so.1"
"libpcre.so.3"
"libselinux.so.1"
"libsystemd.so.0"
"libudev.so.1"
"libwrap.so.0"
"libharfbuzz.so.0"
"libFLAC.so.8"
"libXau.so.6"
"libXcomposite.so.1"
"libXcursor.so.1"
"libXdamage.so.1"
"libXdmcp.so.6"
"libXext.so.6"
"libXfixes.so.3"
"libXi.so.6"
"libXinerama.so.1"
"libXrandr.so.2"
"libXrender.so.1"
"libXxf86vm.so.1"
"libasyncns.so.0"
"libcrypto.so.1.1"
"liblz4.so.1"
"libpulse.so.0"
"libxcb.so.1"
"libxcb-render.so.0"
"libxcb-shm.so.0"
"libxkbcommon.so.0"
"libxkbcommon-x11.so.0"
"pulseaudio/libpulsecommon-13.99.so"
"libfreetype.so.6"
"libpcre2-16.so.0"
"libexpat.so.1"
"libffi.so.7"
"libgraphite2.so.3"
"libresolv.so.2"
"libgpg-error.so.0"
"libpcre2-16.so.0"
"libxcb-icccm.so.4"
"libxcb-image.so.0"
"libxcb-keysyms.so.1"
"libxcb-randr.so.0"
"libxcb-render.so.0"
"libxcb-render-util.so.0"
"libxcb-shape.so.0"
"libxcb-sync.so.1"
"libxcb-util.so.1"
"libxcb-xfixes.so.0"
"libxcb-xkb.so.1"
"libevdev.so.2"
"libgudev-1.0.so.0"
"libinput.so.10"
"libjpeg.so.8"
"libmtdev.so.1"
"libpng16.so.16"
"libuuid.so.1"
)
declare -a DEPLIBS=(
"libSDL2-2.0.so.0"
)
declare -a QTLIBS=(
"libQt6Core.so.6"
"libQt6Gui.so.6"
"libQt6Network.so.6"
"libQt6OpenGL.so.6"
"libQt6Svg.so.6"
"libQt6WaylandClient.so.6"
"libQt6WaylandCompositor.so.6"
"libQt6WaylandEglClientHwIntegration.so.6"
"libQt6WaylandEglCompositorHwIntegration.so.6"
"libQt6Widgets.so.6"
"libQt6XcbQpa.so.6"
)
declare -a QTPLUGINS=(
"plugins/iconengines"
"plugins/imageformats"
"plugins/platforms"
#"plugins/platformthemes" # Enable this if we want to ship GTK+ themes at any point.
"plugins/wayland-decoration-client"
"plugins/wayland-graphics-integration-client"
"plugins/wayland-graphics-integration-server"
"plugins/wayland-shell-integration"
"plugins/xcbglintegrations"
)
set -e
if [ ! -f appimagetool-x86_64.AppImage ]; then
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
fi
OUTDIR=$(realpath "./$APPDIRNAME")
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
rm -fr "$OUTDIR"
mkdir "$OUTDIR"
mkdir -p "$OUTDIR/usr/bin" "$OUTDIR/usr/lib" "$OUTDIR/usr/lib/pulseaudio"
echo "Copying binary and resources..."
cp -a "$BUILDDIR/bin"/* "$OUTDIR/usr/bin"
# We don't need tests
rm -f "$OUTDIR/usr/bin/*-tests"
# Patch RPATH so the binary goes hunting for shared libraries in the AppDir instead of system.
echo "Patching RPATH in ${BINARY}..."
patchelf --set-rpath '$ORIGIN/../lib' "$OUTDIR/usr/bin/$BINARY"
# Currently we leave the main binary unstripped, uncomment if this is not desired.
#$STRIP "$OUTDIR/usr/bin/$BINARY"
# Libraries we pull in from the system.
echo "Copying system libraries..."
for lib in "${SYSLIBS[@]}"; do
blib=$(basename "$lib")
if [ -f "/lib/x86_64-linux-gnu/$lib" ]; then
cp "/lib/x86_64-linux-gnu/$lib" "$OUTDIR/usr/lib/$blib"
elif [ -f "$CHROOT/usr/lib/x86_64-linux-gnu/$lib" ]; then
cp "$CHROOT/usr/lib/x86_64-linux-gnu/$lib" "$OUTDIR/usr/lib/$blib"
elif [ -f "$CHROOT/lib/$lib" ]; then
cp "$CHROOT/lib/$lib" "$OUTDIR/usr/lib/$blib"
elif [ -f "$CHROOT/usr/lib/$lib" ]; then
cp "$CHROOT/usr/lib/$lib" "$OUTDIR/usr/lib/$blib"
else
echo "*** Failed to find '$blib'"
exit 1
fi
$STRIP "$OUTDIR/usr/lib/$blib"
done
# Dependencies we built, at this point it's just SDL.
echo "Copying dependency libraries..."
for lib in "${DEPLIBS[@]}"; do
blib=$(basename "$lib")
if [ -f "$DEPSDIR/lib/$lib" ]; then
cp "$DEPSDIR/lib/$lib" "$OUTDIR/usr/lib/$blib"
else
echo "*** Failed to find '$blib'"
exit 1
fi
$STRIP "$OUTDIR/usr/lib/$blib"
done
echo "Copying Qt libraries..."
for lib in "${QTLIBS[@]}"; do
cp -aL "$DEPSDIR/lib/$lib" "$OUTDIR/usr/lib"
$STRIP "$OUTDIR/usr/lib/$lib"
done
echo "Copying Qt plugins..."
mkdir -p "$OUTDIR/usr/lib/plugins"
for plugin in "${QTPLUGINS[@]}"; do
mkdir -p "$OUTDIR/usr/lib/$plugin"
cp -aL "$DEPSDIR/$plugin"/*.so "$OUTDIR/usr/lib/$plugin/"
done
for so in $(find "$OUTDIR/usr/lib/plugins" -iname '*.so'); do
# This is ../../ because it's usually plugins/group/name.so
echo "Patching RPATH in ${so}..."
patchelf --set-rpath '$ORIGIN/../..' "$so"
$STRIP "$so"
done
for so in $(find "$OUTDIR/usr/lib" -maxdepth 1); do
if [ -f "$so" ]; then
echo "Patching RPATH in ${so}"
patchelf --set-rpath '$ORIGIN' "$so"
fi
done
echo "Creating qt.conf..."
cat > "$OUTDIR/usr/bin/qt.conf" << EOF
[Paths]
Plugins = ../lib/plugins
EOF
echo "Creating desktop..."
cat > "$OUTDIR/duckstation-qt.desktop" << EOF
[Desktop Entry]
Type=Application
Name=DuckStation
GenericName=PlayStation 1 Emulator
Comment=Fast PlayStation 1 emulator
Icon=duckstation-qt
TryExec=duckstation-qt
Exec=duckstation-qt %f
Categories=Game;Emulator;Qt;
EOF
cp "$ROOTDIR/extras/icons/icon-256px.png" "$OUTDIR/duckstation-qt.png"
echo "Creating AppRun..."
cat > "$OUTDIR/AppRun" << EOF
#!/bin/sh
cd "\$(dirname "\$0")"
exec ./usr/bin/$BINARY "\$@"
EOF
chmod +x "$OUTDIR/AppRun"
echo "Generate AppImage"
./appimagetool-x86_64.AppImage -v "$OUTDIR" "$NAME.AppImage"