CI: Merge all packaging scripts to one directory

This commit is contained in:
Stenzek
2024-12-01 14:08:59 +10:00
parent c6746e76f1
commit 42c5f9169f
21 changed files with 16 additions and 21 deletions

View File

@@ -0,0 +1,9 @@
if [[ -z "$I_WANT_A_BROKEN_WAYLAND_UI" ]]; then
echo "Forcing X11 instead of Wayland, due to various protocol limitations"
echo "and Qt issues. If you want to use Wayland, launch DuckStation with"
echo "I_WANT_A_BROKEN_WAYLAND_UI=YES set."
export QT_QPA_PLATFORM=xcb
else
echo "Wayland is not being disabled. Do not complain when things break."
fi

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
function retry_command {
# Package servers tend to be unreliable at times..
# Retry a bunch of times.
local RETRIES=10
for i in $(seq 1 "$RETRIES"); do
"$@" && break
if [ "$i" == "$RETRIES" ]; then
echo "Command \"$@\" failed after ${RETRIES} retries."
exit 1
fi
done
}
# Workaround for https://github.com/actions/runner-images/issues/675
retry_command wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
retry_command sudo apt-add-repository -n 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
retry_command sudo apt-get update
retry_command sudo apt-get -y install \
build-essential clang-18 cmake curl extra-cmake-modules git libasound2-dev libcurl4-openssl-dev libdbus-1-dev libdecor-0-dev libegl-dev libevdev-dev \
libfontconfig-dev libfreetype-dev libfuse2 libgtk-3-dev libgudev-1.0-dev libharfbuzz-dev libinput-dev libopengl-dev libpipewire-0.3-dev libpulse-dev \
libssl-dev libudev-dev libva-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev \
libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev \
libxcb-shape0-dev libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinput-dev libxcb-xkb-dev libxext-dev libxkbcommon-x11-dev \
libxrandr-dev lld-18 llvm-18 nasm ninja-build patchelf pkg-config zlib1g-dev

View File

@@ -0,0 +1,199 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
function retry_command {
# Package servers tend to be unreliable at times..
# Retry a bunch of times.
local RETRIES=10
for i in $(seq 1 "$RETRIES"); do
"$@" && break
if [ "$i" == "$RETRIES" ]; then
echo "Command \"$@\" failed after ${RETRIES} retries."
exit 1
fi
done
}
if [ "$#" -ne 4 ]; then
echo "Syntax: $0 <path to duckstation directory> <path to build directory> <deps prefix> <output name>"
exit 1
fi
ROOTDIR=$1
BUILDDIR=$2
DEPSDIR=$3
NAME=$4
BINARY=duckstation-qt
APPDIRNAME=DuckStation.AppDir
STRIP=strip
declare -a MANUAL_LIBS=(
"libavcodec.so.61"
"libavformat.so.61"
"libavutil.so.59"
"libswscale.so.8"
"libswresample.so.5"
"libdiscord-rpc.so"
"libfreetype.so.6"
"libshaderc_ds.so"
"libspirv-cross-c-shared.so.0"
)
declare -a MANUAL_QT_LIBS=(
"libQt6WaylandEglClientHwIntegration.so.6"
)
declare -a MANUAL_QT_PLUGINS=(
"wayland-decoration-client"
"wayland-graphics-integration-client"
"wayland-shell-integration"
)
declare -a REMOVE_LIBS=(
'libwayland-client.so*'
'libwayland-cursor.so*'
'libwayland-egl.so*'
)
set -e
LINUXDEPLOY=./linuxdeploy-x86_64
LINUXDEPLOY_PLUGIN_QT=./linuxdeploy-plugin-qt-x86_64
APPIMAGETOOL=./appimagetool-x86_64
APPIMAGERUNTIME=./runtime-x86_64
PATCHELF=patchelf
if [ ! -f "$LINUXDEPLOY" ]; then
retry_command wget -O "$LINUXDEPLOY" https://github.com/stenzek/duckstation-ext-qt-minimal/releases/download/linux/linuxdeploy-x86_64.AppImage
chmod +x "$LINUXDEPLOY"
fi
if [ ! -f "$LINUXDEPLOY_PLUGIN_QT" ]; then
retry_command wget -O "$LINUXDEPLOY_PLUGIN_QT" https://github.com/stenzek/duckstation-ext-qt-minimal/releases/download/linux/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x "$LINUXDEPLOY_PLUGIN_QT"
fi
if [ ! -f "$APPIMAGETOOL" ]; then
retry_command wget -O "$APPIMAGETOOL" https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x "$APPIMAGETOOL"
fi
if [ ! -f "$APPIMAGERUNTIME" ]; then
retry_command wget -O "$APPIMAGERUNTIME" https://github.com/stenzek/type2-runtime/releases/download/continuous/runtime-x86_64
fi
OUTDIR=$(realpath "./$APPDIRNAME")
rm -fr "$OUTDIR"
echo "Locating extra libraries..."
EXTRA_LIBS_ARGS=()
for lib in "${MANUAL_LIBS[@]}"; do
srcpath=$(find "$DEPSDIR" -name "$lib")
if [ ! -f "$srcpath" ]; then
echo "Missinge extra library $lib. Exiting."
exit 1
fi
echo "Found $lib at $srcpath."
EXTRA_LIBS_ARGS+=("--library=$srcpath")
done
# Why the nastyness? linuxdeploy strips our main binary, and there's no option to turn it off.
# It also doesn't strip the Qt libs. We can't strip them after running linuxdeploy, because
# patchelf corrupts the libraries (but they still work), but patchelf+strip makes them crash
# on load. So, make a backup copy, strip the original (since that's where linuxdeploy finds
# the libs to copy), then swap them back after we're done.
# Isn't Linux packaging amazing?
rm -fr "$DEPSDIR.bak"
cp -a "$DEPSDIR" "$DEPSDIR.bak"
IFS="
"
for i in $(find "$DEPSDIR" -iname '*.so'); do
echo "Stripping deps library ${i}"
strip "$i"
done
echo "Running linuxdeploy to create AppDir..."
EXTRA_QT_PLUGINS="core;gui;svg;waylandclient;widgets;xcbqpa" \
EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so" \
DEPLOY_PLATFORM_THEMES="1" \
QMAKE="$DEPSDIR/bin/qmake" \
NO_STRIP="1" \
$LINUXDEPLOY --plugin qt --appdir="$OUTDIR" --executable="$BUILDDIR/bin/duckstation-qt" ${EXTRA_LIBS_ARGS[@]} \
--desktop-file="$ROOTDIR/scripts/packaging/org.duckstation.DuckStation.desktop" \
--icon-file="$ROOTDIR/scripts/packaging/org.duckstation.DuckStation.png" \
echo "Copying resources into AppDir..."
cp -a "$BUILDDIR/bin/resources" "$OUTDIR/usr/bin"
# LinuxDeploy's Qt plugin doesn't include Wayland support. So manually copy in the additional Wayland libraries.
echo "Copying Qt Wayland libraries..."
for lib in "${MANUAL_QT_LIBS[@]}"; do
srcpath="$DEPSDIR/lib/$lib"
dstpath="$OUTDIR/usr/lib/$lib"
echo " $srcpath -> $dstpath"
cp "$srcpath" "$dstpath"
$PATCHELF --set-rpath '$ORIGIN' "$dstpath"
done
# .. and plugins.
echo "Copying Qt Wayland plugins..."
for GROUP in "${MANUAL_QT_PLUGINS[@]}"; do
srcpath="$DEPSDIR/plugins/$GROUP"
dstpath="$OUTDIR/usr/plugins/$GROUP"
echo " $srcpath -> $dstpath"
mkdir -p "$dstpath"
for srcsopath in $(find "$DEPSDIR/plugins/$GROUP" -iname '*.so'); do
# This is ../../ because it's usually plugins/group/name.so
soname=$(basename "$srcsopath")
dstsopath="$dstpath/$soname"
echo " $srcsopath -> $dstsopath"
cp "$srcsopath" "$dstsopath"
$PATCHELF --set-rpath '$ORIGIN/../../lib:$ORIGIN' "$dstsopath"
done
done
# Why do we have to manually remove these libs? Because the linuxdeploy Qt plugin
# copies them, not the "main" linuxdeploy binary, and plugins don't inherit the
# include list...
for lib in "${REMOVE_LIBS[@]}"; do
for libpath in $(find "$OUTDIR/usr/lib" -name "$lib"); do
echo " Removing problematic library ${libpath}."
rm -f "$libpath"
done
done
# Restore unstripped deps (for cache).
rm -fr "$DEPSDIR"
mv "$DEPSDIR.bak" "$DEPSDIR"
# Fix up translations.
rm -fr "$OUTDIR/usr/bin/translations"
mv "$OUTDIR/usr/translations" "$OUTDIR/usr/bin"
cp -a "$BUILDDIR/bin/translations" "$OUTDIR/usr/bin"
# Generate AppStream meta-info.
echo "Generating AppStream metainfo..."
mkdir -p "$OUTDIR/usr/share/metainfo"
"$SCRIPTDIR/../generate-metainfo.sh" "$OUTDIR/usr/share/metainfo"
# Copy in AppRun hooks.
echo "Copying AppRun hooks..."
mkdir -p "$OUTDIR/apprun-hooks"
for hookpath in "$SCRIPTDIR/apprun-hooks"/*; do
hookname=$(basename "$hookpath")
cp -v "$hookpath" "$OUTDIR/apprun-hooks/$hookname"
sed -i -e 's/exec /source "$this_dir"\/apprun-hooks\/"'"$hookname"'"\nexec /' "$OUTDIR/AppRun"
done
echo "Generating AppImage..."
rm -f "$NAME.AppImage"
"$APPIMAGETOOL" -v --runtime-file "$APPIMAGERUNTIME" "$OUTDIR" "$NAME.AppImage"

5
scripts/packaging/flatpak/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
.flatpak-builder/
build/
repo/
org.duckstation.DuckStation.metainfo.xml
*.flatpak

View File

@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# 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

View File

@@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# 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: "9c8b818a1de143a4a8ee445351fb8f92115e33e1"
cleanup:
- /bin
- /include
- /lib/*.a
- /lib/*.la
- /lib/cmake
- /lib/pkgconfig
- /share

View File

@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0
name: sdl2
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: true
sources:
- type: archive
url: "https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-2.30.9.tar.gz"
sha256: "24b574f71c87a763f50704bbb630cbe38298d544a1f890f099a4696b1d6beba4"
cleanup:
- /bin
- /include
- /lib/*.a
- /lib/*.la
- /lib/cmake
- /lib/pkgconfig
- /share/aclocal

View File

@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# 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: "1c0d3d18819aa75ec74f1fbd9ff0461e1b69a4d6"
cleanup:
- /bin
- /include
- /lib/*.a
- /lib/*.la
- /lib/cmake
- /lib/pkgconfig

View File

@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# 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.3.290.0"
commit: "5d127b917f080c6f052553c47170ec0ba702e54f"
cleanup:
- /bin
- /include
- /lib/*.a
- /lib/*.la
- /lib/cmake
- /lib/pkgconfig
- /share

View File

@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# 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: "7524ad504fdcfcf75a18a133da6abd75c5d48053"
cleanup:
- /bin
- /include
- /lib/*.a
- /lib/*.la
- /lib/cmake
- /lib/pkgconfig
- /share

View File

@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# 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

View File

@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# 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/llvm18/bin/clang"
- "-DCMAKE_CXX_COMPILER=/usr/lib/sdk/llvm18/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

View File

@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0
name: lunasvg
buildsystem: cmake-ninja
builddir: true
config-opts:
- "-DCMAKE_BUILD_TYPE=Release"
- "-DBUILD_SHARED_LIBS=ON"
- "-DLUNASVG_BUILD_EXAMPLES=OFF"
build-options:
strip: true
sources:
- type: git
url: "https://github.com/stenzek/lunasvg.git"
commit: "9af1ac7b90658a279b372add52d6f77a4ebb482c"
cleanup:
- /bin
- /include
- /lib/*.a
- /lib/*.la
- /lib/cmake
- /lib/pkgconfig
- /share

View File

@@ -0,0 +1,101 @@
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0
app-id: "org.duckstation.DuckStation"
runtime: "org.kde.Platform"
runtime-version: "6.8"
sdk: "org.kde.Sdk"
sdk-extensions:
- "org.freedesktop.Sdk.Extension.llvm18"
add-extensions:
"org.freedesktop.Platform.ffmpeg-full":
directory: "lib/ffmpeg"
version: "24.08"
add-ld-path: "."
autodownload: true
command: "duckstation-qt"
finish-args:
- "--device=all"
- "--allow=bluetooth"
- "--share=network"
- "--share=ipc"
- "--socket=pulseaudio"
- "--talk-name=org.freedesktop.ScreenSaver"
# Wayland is disabled due to various QtWayland issues, causing broken UI.
- "--socket=x11"
- "--env=QT_QPA_PLATFORM=xcb"
modules:
# Dependencies.
- "modules/10-libbacktrace.yaml"
- "modules/11-libzip.yaml"
- "modules/20-sdl2.yaml"
- "modules/21-shaderc.yaml"
- "modules/22-spirv-cross.yaml"
- "modules/23-cpuinfo.yaml"
- "modules/24-discord-rpc.yaml"
- "modules/25-soundtouch.yaml"
- "modules/26-lunasvg.yaml"
# Main module.
- name: duckstation
buildsystem: cmake-ninja
builddir: true
build-options:
# Preserve debug information, it is needed for backtraces.
strip: false
no-debuginfo: true
# Prevent flatpak defaults of fortify etc from creeping in.
cflags: ""
cflags-override: true
cxxflags: ""
cxxflags-override: true
config-opts:
# Flatpak build does not appear to default to Release.
- "-DCMAKE_BUILD_TYPE=Release"
# We're not running tests as part of the flatpak build.
- "-DBUILD_TESTS=OFF"
# Install to /app/bin, use /app/lib for dependencies.
- "-DALLOW_INSTALL=ON"
- "-DINSTALL_SELF_CONTAINED=OFF"
# 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.
- "-DHOST_MIN_PAGE_SIZE=4096"
- "-DHOST_MAX_PAGE_SIZE=16384"
# Make sure we're using ThinLTO.
- "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON"
- "-DCMAKE_C_COMPILER=/usr/lib/sdk/llvm18/bin/clang"
- "-DCMAKE_CXX_COMPILER=/usr/lib/sdk/llvm18/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"
sources:
- type: dir
path: ../../..
post-install:
# Manually copy desktop file/metadata, it's not done as part of the regular build.
- >-
install -Dm644
"${FLATPAK_BUILDER_BUILDDIR}/scripts/packaging/org.duckstation.DuckStation.png"
"${FLATPAK_DEST}/share/icons/hicolor/512x512/apps/org.duckstation.DuckStation.png"
- >-
install -Dm644
"${FLATPAK_BUILDER_BUILDDIR}/scripts/packaging/org.duckstation.DuckStation.desktop"
"${FLATPAK_DEST}/share/applications/org.duckstation.DuckStation.desktop"
- >-
install -Dm644
"${FLATPAK_BUILDER_BUILDDIR}/scripts/packaging/flatpak/org.duckstation.DuckStation.metainfo.xml"
"${FLATPAK_DEST}/share/metainfo/org.duckstation.DuckStation.metainfo.xml"
# Ensure ffmpeg-full mount point exists.
- "mkdir -p \"${FLATPAK_DEST}/lib/ffmpeg\""

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
if [[ $# -lt 1 ]]; then
echo "Output directory must be provided as a parameter"
exit 1
fi
APPID="org.duckstation.DuckStation"
OUTDIR=$(realpath "$1")
OUTFILE="${OUTDIR}/${APPID}.metainfo.xml"
pushd "${SCRIPTDIR}" >/dev/null
GIT_DATE=$(git log -1 --pretty=%cd --date=short)
GIT_HASH=$(git rev-parse HEAD)
GIT_VERSION=$(git describe --dirty | tr -d '\r\n')
if [[ "${GIT_VERSION}" == "" ]]; then
GIT_VERSION=$(git rev-parse HEAD)
fi
popd >/dev/null
echo "GIT_DATE: ${GIT_DATE}"
echo "GIT_VERSION: ${GIT_VERSION}"
echo "GIT_HASH: ${GIT_HASH}"
cp "${SCRIPTDIR}/${APPID}.metainfo.xml.in" "${OUTFILE}"
sed -i -e "s/@GIT_VERSION@/${GIT_VERSION}/" "${OUTFILE}"
sed -i -e "s/@GIT_DATE@/${GIT_DATE}/" "${OUTFILE}"
sed -i -e "s/@GIT_HASH@/${GIT_HASH}/" "${OUTFILE}"

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=DuckStation
GenericName=PlayStation 1 Emulator
Comment=Fast PlayStation 1 emulator
Icon=org.duckstation.DuckStation
TryExec=duckstation-qt
Exec=duckstation-qt %f
Categories=Game;Emulator;Qt;

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.duckstation.DuckStation</id>
<launchable type="desktop-id">org.duckstation.DuckStation.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>CC-BY-NC-ND-4.0</project_license>
<name>DuckStation</name>
<developer_name>Stenzek</developer_name>
<summary>PlayStation Emulator</summary>
<description>
<p>DuckStation is an simulator/emulator of the Sony PlayStation(TM) console, focusing on playability, speed, and long-term maintainability. The goal is to be as accurate as possible while maintaining performance suitable for low-end devices.</p>
<p>"Hack" options are discouraged, the default configuration should support all playable games with only some of the enhancements having compatibility issues.</p>
<p>"PlayStation" and "PSX" are registered trademarks of Sony Interactive Entertainment Europe Limited. This project is not affiliated in any way with Sony Interactive Entertainment.</p>
</description>
<content_rating type="oars-1.1"/>
<update_contact>stenzek_AT_gmail.com</update_contact>
<url type="homepage">https://www.duckstation.org/</url>
<url type="help">https://github.com/stenzek/duckstation</url>
<url type="vcs-browser">https://github.com/stenzek/duckstation</url>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/stenzek/duckstation/md-images/main-qt.png</image>
<caption>Desktop Interface</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/stenzek/duckstation/md-images/bigduck.png</image>
<caption>Big Picture Mode Interface</caption>
</screenshot>
</screenshots>
<releases>
<release version="@GIT_VERSION@" date="@GIT_DATE@" />
</releases>
<custom>
<value key="flathub::manifest">https://raw.githubusercontent.com/stenzek/duckstation/@GIT_HASH@/scripts/flatpak/org.duckstation.DuckStation.yaml</value>
</custom>
</component>

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB