From 6c4300c6c77742381ce45653c0c89a86e669f5af Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 26 Jul 2025 16:26:01 +1000 Subject: [PATCH] CI/Flatpak: Simplify deps build I'll probably drop it in the future since there was only one or two people who indicated that they're using it. But at least now I don't have another file I need to keep up to date. So consider the Flatpak package as deprecated. --- CMakeModules/DuckStationUtils.cmake | 11 +++++ .../flatpak/modules/10-libbacktrace.yaml | 17 -------- .../packaging/flatpak/modules/11-libzip.yaml | 37 ---------------- .../packaging/flatpak/modules/20-shaderc.yaml | 24 ----------- .../flatpak/modules/21-spirv-cross.yaml | 34 --------------- .../packaging/flatpak/modules/22-cpuinfo.yaml | 31 ------------- .../flatpak/modules/23-discord-rpc.yaml | 23 ---------- .../flatpak/modules/24-soundtouch.yaml | 30 ------------- .../flatpak/modules/25-plutosvg.yaml | 25 ----------- .../packaging/flatpak/modules/30-sdl3.yaml | 27 ------------ .../flatpak/org.duckstation.DuckStation.yaml | 43 ++++++++++++++----- src/util/CMakeLists.txt | 5 +-- 12 files changed, 44 insertions(+), 263 deletions(-) delete mode 100644 scripts/packaging/flatpak/modules/10-libbacktrace.yaml delete mode 100644 scripts/packaging/flatpak/modules/11-libzip.yaml delete mode 100644 scripts/packaging/flatpak/modules/20-shaderc.yaml delete mode 100644 scripts/packaging/flatpak/modules/21-spirv-cross.yaml delete mode 100644 scripts/packaging/flatpak/modules/22-cpuinfo.yaml delete mode 100644 scripts/packaging/flatpak/modules/23-discord-rpc.yaml delete mode 100644 scripts/packaging/flatpak/modules/24-soundtouch.yaml delete mode 100644 scripts/packaging/flatpak/modules/25-plutosvg.yaml delete mode 100644 scripts/packaging/flatpak/modules/30-sdl3.yaml diff --git a/CMakeModules/DuckStationUtils.cmake b/CMakeModules/DuckStationUtils.cmake index d7ea0b096..f6357b93c 100644 --- a/CMakeModules/DuckStationUtils.cmake +++ b/CMakeModules/DuckStationUtils.cmake @@ -249,6 +249,17 @@ endfunction() function(install_imported_dep_library name) get_target_property(SONAME "${name}" IMPORTED_SONAME_RELEASE) get_target_property(LOCATION "${name}" IMPORTED_LOCATION_RELEASE) + + # Only install if it's not a system library. + foreach(path ${CMAKE_PREFIX_PATH}) + string(FIND "${LOCATION}" "${path}" out) + if (NOT "${out}" EQUAL 0) + message(STATUS "Not installing imported system library ${name}") + return() + endif() + endforeach() + + message(STATUS "Installing imported library ${SONAME}") install(FILES "${LOCATION}" RENAME "${SONAME}" DESTINATION "${CMAKE_INSTALL_LIBDIR}") endfunction() diff --git a/scripts/packaging/flatpak/modules/10-libbacktrace.yaml b/scripts/packaging/flatpak/modules/10-libbacktrace.yaml deleted file mode 100644 index 643a3b645..000000000 --- a/scripts/packaging/flatpak/modules/10-libbacktrace.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: libbacktrace -buildsystem: autotools -no-autogen: true -build-options: - strip: false - no-debuginfo: true -sources: - - type: git - url: "https://github.com/ianlancetaylor/libbacktrace.git" - commit: "86885d14049fab06ef8a33aac51664230ca09200" -cleanup: - - /include - - /lib/*.a - - /lib/*.la diff --git a/scripts/packaging/flatpak/modules/11-libzip.yaml b/scripts/packaging/flatpak/modules/11-libzip.yaml deleted file mode 100644 index 902502b1f..000000000 --- a/scripts/packaging/flatpak/modules/11-libzip.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: libzip -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - "-DBUILD_SHARED_LIBS=ON" - - "-DENABLE_COMMONCRYPTO=OFF" - - "-DENABLE_GNUTLS=OFF" - - "-DENABLE_MBEDTLS=OFF" - - "-DENABLE_OPENSSL=OFF" - - "-DENABLE_WINDOWS_CRYPTO=OFF" - - "-DENABLE_BZIP2=OFF" - - "-DENABLE_LZMA=OFF" - - "-DENABLE_ZSTD=ON" - - "-DLIBZIP_DO_INSTALL=ON" - - "-DBUILD_TOOLS=OFF" - - "-DBUILD_REGRESS=OFF" - - "-DBUILD_OSSFUZZ=OFF" - - "-DBUILD_EXAMPLES=OFF" - - "-DBUILD_DOC=OFF" -build-options: - strip: true -sources: - - type: git - url: "https://github.com/nih-at/libzip.git" - commit: "f30f5290de485348442d168cd7b2eb714d1f20f9" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig - - /share diff --git a/scripts/packaging/flatpak/modules/20-shaderc.yaml b/scripts/packaging/flatpak/modules/20-shaderc.yaml deleted file mode 100644 index dafcb6525..000000000 --- a/scripts/packaging/flatpak/modules/20-shaderc.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: shaderc -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - "-DSHADERC_SKIP_TESTS=ON" - - "-DSHADERC_SKIP_EXAMPLES=ON" - - "-DSHADERC_SKIP_COPYRIGHT_CHECK=ON" -build-options: - strip: true -sources: - - type: git - url: "https://github.com/stenzek/shaderc.git" - commit: "4daf9d466ad00897f755163dd26f528d14e1db44" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig diff --git a/scripts/packaging/flatpak/modules/21-spirv-cross.yaml b/scripts/packaging/flatpak/modules/21-spirv-cross.yaml deleted file mode 100644 index e7743d5d9..000000000 --- a/scripts/packaging/flatpak/modules/21-spirv-cross.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: spirv-cross -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - "-DSPIRV_CROSS_SHARED=ON" - - "-DSPIRV_CROSS_STATIC=OFF" - - "-DSPIRV_CROSS_CLI=OFF" - - "-DSPIRV_CROSS_ENABLE_TESTS=OFF" - - "-DSPIRV_CROSS_ENABLE_GLSL=ON" - - "-DSPIRV_CROSS_ENABLE_HLSL=OFF" - - "-DSPIRV_CROSS_ENABLE_MSL=OFF" - - "-DSPIRV_CROSS_ENABLE_CPP=OFF" - - "-DSPIRV_CROSS_ENABLE_REFLECT=OFF" - - "-DSPIRV_CROSS_ENABLE_C_API=ON" - - "-DSPIRV_CROSS_ENABLE_UTIL=ON" -build-options: - strip: true -sources: - - type: git - url: "https://github.com/KhronosGroup/SPIRV-Cross.git" - tag: "vulkan-sdk-1.4.309.0" - commit: "2c32b6bf86f3c4a5539aa1f0bacbd59fe61759cf" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig - - /share diff --git a/scripts/packaging/flatpak/modules/22-cpuinfo.yaml b/scripts/packaging/flatpak/modules/22-cpuinfo.yaml deleted file mode 100644 index 679b1016c..000000000 --- a/scripts/packaging/flatpak/modules/22-cpuinfo.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: cpuinfo -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - "-DCPUINFO_LIBRARY_TYPE=shared" - - "-DCPUINFO_RUNTIME_TYPE=shared" - - "-DCPUINFO_LOG_LEVEL=error" - - "-DCPUINFO_LOG_TO_STDIO=ON" - - "-DCPUINFO_BUILD_TOOLS=OFF" - - "-DCPUINFO_BUILD_UNIT_TESTS=OFF" - - "-DCPUINFO_BUILD_MOCK_TESTS=OFF" - - "-DCPUINFO_BUILD_BENCHMARKS=OFF" - - "-DUSE_SYSTEM_LIBS=ON" -build-options: - strip: true -sources: - - type: git - url: "https://github.com/stenzek/cpuinfo.git" - commit: "3ebbfd45645650c4940bf0f3b4d25ab913466bb0" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig - - /share diff --git a/scripts/packaging/flatpak/modules/23-discord-rpc.yaml b/scripts/packaging/flatpak/modules/23-discord-rpc.yaml deleted file mode 100644 index 06d1dd88a..000000000 --- a/scripts/packaging/flatpak/modules/23-discord-rpc.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: discord-rpc -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - "-DBUILD_SHARED_LIBS=ON" -build-options: - strip: true -sources: - - type: git - url: "https://github.com/stenzek/discord-rpc.git" - commit: "144f3a3f1209994d8d9e8a87964a989cb9911c1e" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig - - /share diff --git a/scripts/packaging/flatpak/modules/24-soundtouch.yaml b/scripts/packaging/flatpak/modules/24-soundtouch.yaml deleted file mode 100644 index 9d86dcd1e..000000000 --- a/scripts/packaging/flatpak/modules/24-soundtouch.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: soundtouch -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - # Use clang with LTO for speed. - - "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" - - "-DCMAKE_C_COMPILER=/usr/lib/sdk/llvm19/bin/clang" - - "-DCMAKE_CXX_COMPILER=/usr/lib/sdk/llvm19/bin/clang++" - - "-DCMAKE_EXE_LINKER_FLAGS_INIT=-fuse-ld=lld" - - "-DCMAKE_MODULE_LINKER_FLAGS_INIT=-fuse-ld=lld" - - "-DCMAKE_SHARED_LINKER_FLAGS_INIT=-fuse-ld=lld" -build-options: - strip: true -sources: - - type: git - url: "https://github.com/stenzek/soundtouch.git" - commit: "463ade388f3a51da078dc9ed062bf28e4ba29da7" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig - - /share diff --git a/scripts/packaging/flatpak/modules/25-plutosvg.yaml b/scripts/packaging/flatpak/modules/25-plutosvg.yaml deleted file mode 100644 index 0c45037db..000000000 --- a/scripts/packaging/flatpak/modules/25-plutosvg.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: plutosvg -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - "-DBUILD_SHARED_LIBS=ON" - - "-DPLUTOSVG_ENABLE_FREETYPE=ON" - - "-DPLUTOSVG_BUILD_EXAMPLES=OFF" -build-options: - strip: true -sources: - - type: git - url: "https://github.com/stenzek/plutosvg.git" - commit: "bc845bb6b6511e392f9e1097b26f70cf0b3c33be" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig - - /share diff --git a/scripts/packaging/flatpak/modules/30-sdl3.yaml b/scripts/packaging/flatpak/modules/30-sdl3.yaml deleted file mode 100644 index a0384b3a8..000000000 --- a/scripts/packaging/flatpak/modules/30-sdl3.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin -# SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -name: sdl3 -buildsystem: cmake-ninja -builddir: true -config-opts: - - "-DCMAKE_BUILD_TYPE=Release" - - "-DBUILD_SHARED_LIBS=ON" - - "-DSDL_SHARED=ON" - - "-DSDL_STATIC=OFF" - - "-DSDL_TESTS=OFF" -build-options: - strip: false - no-debuginfo: true -sources: - - type: archive - url: "https://github.com/libsdl-org/SDL/releases/download/release-3.2.16/SDL3-3.2.16.tar.gz" - sha256: "6340e58879b2d15830c8460d2f589a385c444d1faa2a4828a9626c7322562be8" -cleanup: - - /bin - - /include - - /lib/*.a - - /lib/*.la - - /lib/cmake - - /lib/pkgconfig - - /share/aclocal diff --git a/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml b/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml index 0223e19e5..9e4835734 100644 --- a/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml +++ b/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml @@ -22,15 +22,29 @@ finish-args: modules: # Dependencies. - - "modules/10-libbacktrace.yaml" - - "modules/11-libzip.yaml" - - "modules/20-shaderc.yaml" - - "modules/21-spirv-cross.yaml" - - "modules/22-cpuinfo.yaml" - - "modules/23-discord-rpc.yaml" - - "modules/24-soundtouch.yaml" - - "modules/25-plutosvg.yaml" - - "modules/30-sdl3.yaml" + - name: duckstation-deps + buildsystem: simple + sources: + - type: file + path: ../../deps/build-dependencies-linux.sh + build-options: + # Don't need debug info for deps, match AppImage. + strip: true + no-debuginfo: true + + # Prevent flatpak defaults of fortify etc from creeping in. + cflags: "" + cflags-override: true + cxxflags: "" + cxxflags-override: true + + # Need network access to download sources. + build-args: + - "--share=network" + build-commands: + - "./build-dependencies-linux.sh -system-freetype -system-harfbuzz -system-libjpeg -system-libpng -system-libwebp -system-zlib -system-zstd -system-qt /app/deps" + cleanup: + - "*" # Main module. - name: duckstation @@ -51,12 +65,19 @@ modules: # Flatpak build does not appear to default to Release. - "-DCMAKE_BUILD_TYPE=Release" + # Self-contained install, need to change the directory. + # Typical flatpak garbage makes it a pain to change the path from /app/bin... + - "-DCMAKE_INSTALL_PREFIX=/app/bin" + + # Dependencies path. + - "-DCMAKE_PREFIX_PATH=/app/deps" + # We're not running tests as part of the flatpak build. - "-DBUILD_TESTS=OFF" - # Install to /app/bin, use /app/lib for dependencies. + # Install to /app. - "-DALLOW_INSTALL=ON" - - "-DINSTALL_SELF_CONTAINED=OFF" + - "-DINSTALL_SELF_CONTAINED=ON" # Set the page range to 4K-16K. This has no effect on X86, but is required for # ARM builds, as some devices are now shipping with 16K kernels. diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index acfbfdba1..cb5043cf8 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -332,10 +332,7 @@ function(add_util_resources target) install_imported_dep_library(spirv-cross-c-shared) install_imported_dep_library(SoundTouch::SoundTouchDLL) install_imported_dep_library(plutosvg::plutosvg) - else() - # Prevent CMake from overriding the RPATH in the binary. i.e. use the build locations. - # This is needed for Flatpak builds, since the libs are in /app. - set_target_properties(${target} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) + install_imported_dep_library(libzip::zip) endif() endif() endfunction()