-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build: Add Flatpak manifest and scripts
- Loading branch information
Showing
10 changed files
with
281 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.flatpak-builder/ | ||
build/ | ||
repo/ | ||
org.duckstation.duckstation.metainfo.xml | ||
*.flatpak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}") | ||
|
||
if [[ $# -lt 1 ]]; then | ||
echo "Output file must be provided as a parameter" | ||
exit 1 | ||
fi | ||
|
||
OUTFILE=$1 | ||
GIT_DATE=$(git log -1 --pretty=%cd --date=short) | ||
GIT_VERSION=$(git tag --points-at HEAD) | ||
GIT_HASH=$(git rev-parse HEAD) | ||
|
||
if [[ "${GIT_VERSION}" == "" ]]; then | ||
GIT_VERSION=$(git describe --tags --dirty --exclude latest --exclude preview --exclude legacy --exclude previous-latest | tr -d '\r\n') | ||
if [[ "${GIT_VERSION}" == "" ]]; then | ||
GIT_VERSION=$(git rev-parse HEAD) | ||
fi | ||
fi | ||
|
||
echo "GIT_DATE: ${GIT_DATE}" | ||
echo "GIT_VERSION: ${GIT_VERSION}" | ||
echo "GIT_HASH: ${GIT_HASH}" | ||
|
||
cp "${SCRIPTDIR}"/org.duckstation.duckstation.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}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
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 | ||
} | ||
|
||
ARCH=x86_64 | ||
KDE_BRANCH=6.5 | ||
BRANCH=22.08 | ||
FLAT_MANAGER_CLIENT_DIR="$HOME/.local/bin" | ||
|
||
# Build packages. Mostly needed for flat-manager-client. | ||
declare -a BUILD_PACKAGES=( | ||
"flatpak" | ||
"flatpak-builder" | ||
"appstream-util" | ||
"python3-aiohttp" | ||
"python3-tenacity" | ||
"python3-gi" | ||
"gobject-introspection" | ||
"libappstream-glib8" | ||
"libappstream-glib-dev" | ||
"libappstream-dev" | ||
"gir1.2-ostree-1.0" | ||
) | ||
|
||
# Flatpak runtimes and SDKs. | ||
declare -a FLATPAK_PACKAGES=( | ||
"org.kde.Platform/${ARCH}/${KDE_BRANCH}" | ||
"org.kde.Sdk/${ARCH}/${KDE_BRANCH}" | ||
"org.freedesktop.Sdk.Extension.llvm16/${ARCH}/${BRANCH}" | ||
"org.freedesktop.appstream-glib/${ARCH}/stable" | ||
) | ||
|
||
retry_command sudo apt-get -qq update | ||
|
||
# Install packages needed for building | ||
echo "Will install the following packages for building - ${BUILD_PACKAGES[*]}" | ||
retry_command sudo apt-get -y install "${BUILD_PACKAGES[@]}" | ||
|
||
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | ||
|
||
# Install packages needed for building | ||
echo "Will install the following packages for building - ${FLATPAK_PACKAGES[*]}" | ||
retry_command sudo flatpak -y install "${FLATPAK_PACKAGES[@]}" | ||
|
||
echo "Downloading flat-manager-client" | ||
mkdir -p "$FLAT_MANAGER_CLIENT_DIR" | ||
pushd "$FLAT_MANAGER_CLIENT_DIR" | ||
aria2c -Z "https://raw.githubusercontent.com/flatpak/flat-manager/9401efbdc0d6bd489507d8401c567ba219d735d5/flat-manager-client" | ||
chmod +x flat-manager-client | ||
echo "$FLAT_MANAGER_CLIENT_DIR" >> $GITHUB_PATH | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "sdl2", | ||
"buildsystem": "autotools", | ||
"no-autogen": true, | ||
"config-opts": [ | ||
"--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" | ||
], | ||
"build-options": { | ||
"strip": true | ||
}, | ||
"sources": [ | ||
{ | ||
"type": "archive", | ||
"url": "https://libsdl.org/release/SDL2-2.28.2.tar.gz", | ||
"sha256": "64b1102fa22093515b02ef33dd8739dee1ba57e9dbba6a092942b8bbed1a1c5e" | ||
} | ||
], | ||
"cleanup": [ | ||
"/bin", | ||
"/include", | ||
"/lib/*.a", | ||
"/lib/*.la", | ||
"/lib/cmake", | ||
"/lib/pkgconfig", | ||
"/share/aclocal" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"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": "ad106d5fdd5d960bd33fae1c48a351af567fd075" | ||
} | ||
], | ||
"cleanup": [ | ||
"/include", | ||
"/lib/*.a", | ||
"/lib/*.la" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"app-id": "org.duckstation.duckstation", | ||
"runtime": "org.kde.Platform", | ||
"runtime-version": "6.5", | ||
"sdk": "org.kde.Sdk", | ||
"sdk-extensions": [ | ||
"org.freedesktop.Sdk.Extension.llvm16" | ||
], | ||
"command": "duckstation-qt", | ||
"finish-args": [ | ||
"--device=all", | ||
"--share=network", | ||
"--share=ipc", | ||
"--socket=fallback-x11", | ||
"--socket=wayland", | ||
"--socket=pulseaudio", | ||
"--filesystem=host:ro", | ||
"--talk-name=org.freedesktop.ScreenSaver" | ||
], | ||
"modules": [ | ||
"modules/20-sdl2.json", | ||
"modules/21-libbacktrace.json", | ||
{ | ||
"name": "duckstation", | ||
"buildsystem": "cmake", | ||
"build-options": { | ||
"strip": false, | ||
"no-debuginfo": true, | ||
"config-opts": [ | ||
"-DCMAKE_BUILD_TYPE=Release", | ||
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON", | ||
"-DBUILD_NOGUI_FRONTEND=OFF", | ||
"-DBUILD_QT_FRONTEND=ON", | ||
"-DBUILD_TESTS=OFF", | ||
"-DCMAKE_C_COMPILER=/usr/lib/sdk/llvm16/bin/clang", | ||
"-DCMAKE_CXX_COMPILER=/usr/lib/sdk/llvm16/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": [ | ||
"cp -a \"${FLATPAK_BUILDER_BUILDDIR}/bin\" ${FLATPAK_DEST}", | ||
"install -Dm644 data/resources/images/duck.png ${FLATPAK_DEST}/share/icons/hicolor/512x512/apps/org.duckstation.duckstation.png", | ||
"install -Dm644 scripts/flatpak/duckstation-qt.desktop ${FLATPAK_DEST}/share/applications/org.duckstation.duckstation.desktop", | ||
"desktop-file-edit --set-key=Icon --set-value=org.duckstation.duckstation ${FLATPAK_DEST}/share/applications/org.duckstation.duckstation.desktop", | ||
"install -Dm644 scripts/flatpak/org.duckstation.duckstation.metainfo.xml ${FLATPAK_DEST}/share/metainfo/org.duckstation.duckstation.metainfo.xml" | ||
] | ||
} | ||
] | ||
} |
34 changes: 34 additions & 0 deletions
34
scripts/flatpak/org.duckstation.duckstation.metainfo.xml.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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>GPL-3.0</project_license> | ||
<name>DuckStation</name> | ||
<developer_name>DuckStation</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> | ||
<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> | ||
</screenshot> | ||
<screenshot> | ||
<image>https://raw.githubusercontent.com/stenzek/duckstation/md-images/bigduck.png</image> | ||
</screenshot> | ||
</screenshots> | ||
<content_rating type="oars-1.1"/> | ||
<update_contact>stenzek_AT_gmail.com</update_contact> | ||
<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.json</value> | ||
</custom> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters