build(linux): consolidate appstream metainfo (#3954)

This commit is contained in:
ReenigneArcher 2025-06-09 12:39:57 -04:00 committed by GitHub
commit c9a06fd8a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 118 additions and 100 deletions

View file

@ -264,6 +264,8 @@ jobs:
build_linux:
name: Linux ${{ matrix.type }}
env:
APP_ID: dev.lizardbyte.app.Sunshine
runs-on: ubuntu-${{ matrix.dist }}
needs: setup_release
strategy:
@ -364,7 +366,7 @@ jobs:
chmod +x ./AppDir/AppRun
# variables
DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}"
DESKTOP_FILE="${DESKTOP_FILE:-${APP_ID}.desktop}"
ICON_FILE="${ICON_FILE:-sunshine.png}"
# AppImage

View file

@ -133,30 +133,11 @@ jobs:
xml_file="flathub/${{ env.FLATHUB_PKG }}/${{ env.FLATHUB_PKG }}.metainfo.xml"
# Extract release information
version="${{ github.event.release.tag_name }}" && version="${version#v}"
date="${{ github.event.release.published_at }}" && date="${date%%T*}"
changelog="${{ github.event.release.body }}" && changelog="${changelog//&/&}" && \
changelog="${changelog//</&lt;}" && changelog="${changelog//>/&gt;}"
# Store the old release information into a temp file to be used for precise replacement
tmpfile=$(mktemp)
# Match the existing <release> block, replace it with the new data
awk -v version="$version" -v date="$date" -v changelog="$changelog" '
BEGIN { replaced = 0 }
/<release version=.*>/ {
if (!replaced) {
print " <release version=\"" version "\" date=\"" date "\">"
print " <description><p>" changelog "</p></description>"
print " </release>"
replaced = 1
}
}
!/<release version=.*>/ && !/<\/release>/ { print $0 }
' "$xml_file" > "$tmpfile"
# Move the updated file back to the original location
mv "$tmpfile" "$xml_file"
# Replace changelog placeholder with actual changelog
sed -i "s|<!-- changelog -->|$changelog|g" "$xml_file"
- name: Update submodule
if: >-

View file

@ -136,26 +136,13 @@ if(${SUNSHINE_TRAY} STREQUAL 1)
endif()
# desktop file
# todo - validate desktop files with `desktop-file-validate`
if(NOT ${SUNSHINE_BUILD_FLATPAK})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.desktop"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_FQDN}.desktop"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.desktop"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
RENAME "${PROJECT_FQDN}.desktop")
endif()
if(NOT ${SUNSHINE_BUILD_APPIMAGE} AND NOT ${SUNSHINE_BUILD_FLATPAK})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine_terminal.desktop"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_FQDN}.terminal.desktop"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
endif()
# metadata file
# todo - validate file with `appstream-util validate-relax`
if(NOT ${SUNSHINE_BUILD_FLATPAK})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.appdata.xml"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_FQDN}.metainfo.xml"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
endif()

View file

@ -54,3 +54,34 @@ else()
MESSAGE(WARNING ": Git not found, cannot find git version")
endif()
endif()
# set date variables
set(PROJECT_YEAR "1990")
set(PROJECT_MONTH "01")
set(PROJECT_DAY "01")
# Extract year, month, and day
if(PROJECT_VERSION MATCHES "^([0-9]{4})[.]([0-9]{3,4})")
# First capture group is the year
set(PROJECT_YEAR "${CMAKE_MATCH_1}")
# Second capture group is month/day
set(MONTH_DAY "${CMAKE_MATCH_2}")
string(LENGTH "${MONTH_DAY}" MONTH_DAY_LENGTH)
if(MONTH_DAY_LENGTH EQUAL 3)
string(SUBSTRING "${MONTH_DAY}" 0 1 PROJECT_MONTH)
string(SUBSTRING "${MONTH_DAY}" 1 2 PROJECT_DAY)
elseif(MONTH_DAY_LENGTH EQUAL 4)
string(SUBSTRING "${MONTH_DAY}" 0 2 PROJECT_MONTH)
string(SUBSTRING "${MONTH_DAY}" 2 2 PROJECT_DAY)
endif()
# Ensure month is two digits
if(PROJECT_MONTH LESS 10 AND NOT PROJECT_MONTH MATCHES "^0")
set(PROJECT_MONTH "0${PROJECT_MONTH}")
endif()
# Ensure day is two digits
if(PROJECT_DAY LESS 10 AND NOT PROJECT_DAY MATCHES "^0")
set(PROJECT_DAY "0${PROJECT_DAY}")
endif()
endif()

View file

@ -12,19 +12,17 @@ elseif(UNIX)
# configure the .desktop file
set(SUNSHINE_DESKTOP_ICON "sunshine")
if(${SUNSHINE_BUILD_APPIMAGE})
configure_file(packaging/linux/AppImage/sunshine.desktop sunshine.desktop @ONLY)
configure_file(packaging/linux/AppImage/${PROJECT_FQDN}.desktop ${PROJECT_FQDN}.desktop @ONLY)
elseif(${SUNSHINE_BUILD_FLATPAK})
set(SUNSHINE_DESKTOP_ICON "${PROJECT_FQDN}")
configure_file(packaging/linux/flatpak/sunshine.desktop sunshine.desktop @ONLY)
configure_file(packaging/linux/flatpak/${PROJECT_FQDN}.metainfo.xml
${PROJECT_FQDN}.metainfo.xml @ONLY)
configure_file(packaging/linux/flatpak/${PROJECT_FQDN}.desktop ${PROJECT_FQDN}.desktop @ONLY)
else()
configure_file(packaging/linux/sunshine.desktop sunshine.desktop @ONLY)
configure_file(packaging/linux/sunshine_terminal.desktop sunshine_terminal.desktop @ONLY)
configure_file(packaging/linux/${PROJECT_FQDN}.desktop ${PROJECT_FQDN}.desktop @ONLY)
configure_file(packaging/linux/${PROJECT_FQDN}.terminal.desktop ${PROJECT_FQDN}.terminal.desktop @ONLY)
endif()
# configure metadata file
configure_file(packaging/linux/sunshine.appdata.xml sunshine.appdata.xml @ONLY)
configure_file(packaging/linux/${PROJECT_FQDN}.metainfo.xml ${PROJECT_FQDN}.metainfo.xml @ONLY)
# configure service
configure_file(packaging/linux/sunshine.service.in sunshine.service @ONLY)
@ -38,8 +36,6 @@ elseif(UNIX)
# configure the flatpak manifest
if(${SUNSHINE_CONFIGURE_FLATPAK_MAN})
configure_file(packaging/linux/flatpak/${PROJECT_FQDN}.yml ${PROJECT_FQDN}.yml @ONLY)
configure_file(packaging/linux/flatpak/${PROJECT_FQDN}.metainfo.xml
${PROJECT_FQDN}.metainfo.xml @ONLY)
file(COPY packaging/linux/flatpak/deps/ DESTINATION ${CMAKE_BINARY_DIR})
file(COPY packaging/linux/flatpak/modules DESTINATION ${CMAKE_BINARY_DIR})
file(COPY generated-sources.json DESTINATION ${CMAKE_BINARY_DIR})

View file

@ -1,13 +1,13 @@
[Desktop Entry]
Type=Application
Name=@PROJECT_NAME@
Exec=sunshine
Version=1.0
Categories=RemoteAccess;Network;
Comment=@PROJECT_DESCRIPTION@
Exec=sunshine
Icon=sunshine
Keywords=gamestream;stream;moonlight;remote play;
Categories=AudioVideo;Network;RemoteAccess;
Name=@PROJECT_NAME@
Terminal=true
Type=Application
Version=1.0
X-AppImage-Arch=x86_64
X-AppImage-Name=sunshine
X-AppImage-Version=@PROJECT_VERSION@
X-AppImage-Arch=x86_64

View file

@ -36,7 +36,10 @@ depends=(
)
makedepends=(
'appstream'
'appstream-glib'
'cmake'
'desktop-file-utils'
'cuda'
"gcc${_gcc_version}"
'git'
@ -86,6 +89,11 @@ build() {
-D SUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
-D SUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'
appstreamcli validate "build/dev.lizardbyte.app.Sunshine.metainfo.xml"
appstream-util validate "build/dev.lizardbyte.app.Sunshine.metainfo.xml"
desktop-file-validate "build/dev.lizardbyte.app.Sunshine.desktop"
desktop-file-validate "build/dev.lizardbyte.app.Sunshine.terminal.desktop"
make -C build
}

View file

@ -1,15 +1,15 @@
[Desktop Entry]
Type=Application
Name=@PROJECT_NAME@
Exec=/usr/bin/env systemctl start --u sunshine
Version=1.0
Actions=RunInTerminal;
Categories=RemoteAccess;Network;
Comment=@PROJECT_DESCRIPTION@
Exec=/usr/bin/env systemctl start --u sunshine
Icon=@SUNSHINE_DESKTOP_ICON@
Keywords=gamestream;stream;moonlight;remote play;
Categories=AudioVideo;Network;RemoteAccess;
Actions=RunInTerminal;
Name=@PROJECT_NAME@
Type=Application
Version=1.0
[Desktop Action RunInTerminal]
Name=Run in Terminal
Exec=gio launch @CMAKE_INSTALL_FULL_DATAROOTDIR@/applications/@PROJECT_FQDN@.terminal.desktop
Icon=application-x-executable
Exec=gio launch @CMAKE_INSTALL_FULL_DATAROOTDIR@/applications/sunshine_terminal.desktop
Name=Run in Terminal

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<component type="desktop">
<id>@PROJECT_FQDN@</id>
<name>@CMAKE_PROJECT_NAME@</name>
<name>@PROJECT_NAME@</name>
<summary>@PROJECT_BRIEF_DESCRIPTION@</summary>
<metadata_license>CC0-1.0</metadata_license>
@ -15,39 +15,49 @@
<control>gamepad</control>
</supports>
<url type="bugtracker">https://github.com/LizardByte/Sunshine/issues</url>
<url type="homepage">@PROJECT_HOMEPAGE_URL@</url>
<url type="bugtracker">https://github.com/LizardByte/Sunshine/issues</url>
<url type="faq">https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2troubleshooting.html</url>
<url type="help">https://docs.lizardbyte.dev/projects/sunshine</url>
<url type="donation">https://app.lizardbyte.dev/#Donate</url>
<url type="contact">https://app.lizardbyte.dev/support</url>
<url type="translate">https://translate.lizardbyte.dev</url>
<url type="contribute">https://docs.lizardbyte.dev</url>
<url type="vcs-browser">https://github.com/LizardByte/Sunshine</url>
<url type="contact">https://app.lizardbyte.dev/support</url>
<description>
<p>
@PROJECT_LONG_DESCRIPTION@
</p>
<p>NOTE: Sunshine requires additional installation steps.</p>
<p>NOTE: Sunshine requires additional installation steps (Flatpak).</p>
<p>
<code>flatpak run --command=additional-install.sh @PROJECT_FQDN@</code>
</p>
<p>NOTE: Sunshine uses a self-signed certificate. The web browser will report it as not secure, but it is safe.</p>
<p>NOTE: KMS Grab (Optional)</p>
<p>NOTE: KMS Grab (Flatpak)</p>
<p>
<code>sudo -i PULSE_SERVER=unix:/run/user/$(id -u $whoami)/pulse/native flatpak run @PROJECT_FQDN@</code>
</p>
</description>
<releases>
<release version="@PROJECT_VERSION@" date="1990-01-01"></release>
<release version="@PROJECT_VERSION@" date="@PROJECT_YEAR@-@PROJECT_MONTH@-@PROJECT_DAY@">
<description>
<p>
See the full changelog on GitHub
<!-- changelog -->
</p>
</description>
</release>
</releases>
<developer_name>LizardByte</developer_name>
<developer id="dev.lizardbyte">
<name>LizardByte</name>
</developer>
<screenshots>
<screenshot type="default">
<image>https://app.lizardbyte.dev/Sunshine/assets/img/banners/AdobeStock_305732536_1920x1280.jpg</image>
<caption>Sunshine</caption>
<image>https://app.lizardbyte.dev/Sunshine/assets/img/screenshots/01-sunshine-welcome-page.png</image>
<caption>Sunshine welcome page</caption>
</screenshot>
</screenshots>
<content_rating type="oars-1.0">

View file

@ -15,8 +15,11 @@ License: GPLv3-only
URL: https://github.com/LizardByte/Sunshine
Source0: tarball.tar.gz
BuildRequires: appstream
# BuildRequires: boost-devel >= 1.86.0
BuildRequires: cmake >= 3.25.0
BuildRequires: desktop-file-utils
BuildRequires: libappstream-glib
BuildRequires: libayatana-appindicator3-devel
BuildRequires: libcap-devel
BuildRequires: libcurl-devel
@ -197,6 +200,11 @@ cmake "${cmake_args[@]}"
make -j$(nproc) -C "%{_builddir}/Sunshine/build"
%check
# validate the metainfo file
appstreamcli validate %{buildroot}%{_metainfodir}/*.metainfo.xml
appstream-util validate %{buildroot}%{_metainfodir}/*.metainfo.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
# run tests
cd %{_builddir}/Sunshine/build
xvfb-run ./tests/test_sunshine
@ -252,14 +260,14 @@ rm -f /usr/lib/modules-load.d/uhid.conf
%{_modulesloaddir}/uhid.conf
# Desktop entries
%{_datadir}/applications/sunshine*.desktop
%{_datadir}/applications/*.desktop
# Icons
%{_datadir}/icons/hicolor/scalable/apps/sunshine.svg
%{_datadir}/icons/hicolor/scalable/status/sunshine*.svg
# Metainfo
%{_datadir}/metainfo/sunshine.appdata.xml
%{_datadir}/metainfo/*.metainfo.xml
# Assets
%{_datadir}/sunshine/**

View file

@ -1,5 +1,5 @@
[Desktop Entry]
Categories=AudioVideo;Network;RemoteAccess;
Categories=RemoteAccess;Network;
Comment=@PROJECT_DESCRIPTION@
Exec=sunshine.sh
Icon=@SUNSHINE_DESKTOP_ICON@

View file

@ -1,6 +1,6 @@
{
"dev.lizardbyte.app.Sunshine": [
"appstream-missing-screenshots",
"appstream-external-screenshot-url",
"appstream-screenshots-not-mirrored-in-ostree",
"external-gitmodule-url-found",
"finish-args-flatpak-spawn-access"

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>@PROJECT_NAME@</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>@PROJECT_LICENSE@</project_license>
<name>@PROJECT_NAME@</name>
<url type="homepage">@CMAKE_PROJECT_HOMEPAGE_URL@</url>
<summary>@PROJECT_BRIEF_DESCRIPTION@</summary>
<description>
<p>
@PROJECT_LONG_DESCRIPTION@
</p>
</description>
<launchable type="desktop-id">sunshine.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://app.lizardbyte.dev/Sunshine/assets/images/AdobeStock_305732536_1920x1280.jpg</image>
<caption>Sunshine</caption>
</screenshot>
</screenshots>
</component>

View file

@ -138,9 +138,12 @@ function add_arch_deps() {
function add_debian_based_deps() {
dependencies+=(
"appstream"
"appstream-util"
"bison" # required if we need to compile doxygen
"build-essential"
"cmake"
"desktop-file-utils"
"doxygen"
"flex" # required if we need to compile doxygen
"gcc-${gcc_version}"
@ -201,13 +204,16 @@ function add_ubuntu_deps() {
function add_fedora_deps() {
dependencies+=(
"appstream"
"cmake"
"desktop-file-utils"
"doxygen"
"gcc${gcc_version}"
"gcc${gcc_version}-c++"
"git"
"graphviz"
"libappindicator-gtk3-devel"
"libappstream-glib"
"libcap-devel"
"libcurl-devel"
"libdrm-devel"
@ -469,6 +475,16 @@ function run_install() {
echo "cmake args:"
echo "${cmake_args[@]}"
cmake "${cmake_args[@]}"
# Run appstream validation, etc.
appstreamcli validate "build/dev.lizardbyte.app.Sunshine.metainfo.xml"
appstream-util validate "build/dev.lizardbyte.app.Sunshine.metainfo.xml"
desktop-file-validate "build/dev.lizardbyte.app.Sunshine.desktop"
if [ "$appimage_build" == 0 ]; then
desktop-file-validate "build/dev.lizardbyte.app.Sunshine.terminal.desktop"
fi
# Build the project
ninja -C "build"
# Create the package