Flatpak: Use ScmRevGen to generate metainfo XML

This commit is contained in:
OatmealDome 2024-11-12 16:11:32 -05:00
parent 89016834cf
commit 4fc259710f
5 changed files with 16 additions and 15 deletions

View File

@ -30,6 +30,8 @@ if(GIT_FOUND)
ERROR_QUIET)
endif()
string(TIMESTAMP DOLPHIN_WC_BUILD_DATE "%Y-%m-%d" UTC)
# version number
set(DOLPHIN_VERSION_MAJOR "2412")
set(DOLPHIN_VERSION_MINOR "0")
@ -67,3 +69,7 @@ configure_source_file("Source/Core/Common/scmrev.h")
if(APPLE)
configure_source_file("Source/Core/VersionInfo.plist")
endif()
if(LINUX)
configure_source_file("Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml")
endif()

View File

@ -789,6 +789,13 @@ if(APPLE)
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Flatpak)
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml)
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml)
endif()
endif()
find_package(Git)
if(NOT GIT_FOUND)
set(GIT_EXECUTABLE "")
@ -796,7 +803,7 @@ endif()
add_custom_target(
dolphin_scmrev
${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DDISTRIBUTOR=${DISTRIBUTOR} -DDOLPHIN_DEFAULT_UPDATE_TRACK=${DOLPHIN_DEFAULT_UPDATE_TRACK} -DGIT_FOUND=${GIT_FOUND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DDOLPHIN_WC_REVISION=${DOLPHIN_WC_REVISION} -DDOLPHIN_WC_DESCRIBE=${DOLPHIN_WC_DESCRIBE} -DDOLPHIN_WC_BRANCH=${DOLPHIN_WC_BRANCH} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/ScmRevGen.cmake
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater/Info.plist"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml"
VERBATIM
)

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
DATE=$(git log -1 --pretty=%cd --date=iso8601 --date=format:'%Y-%m-%d')
sed -i -e "s/@DATE_PLACEHOLDER/${DATE}/" ../org.DolphinEmu.dolphin-emu.metainfo.xml
VERSION=$(git describe --tags | sed -E 's/^([0-9]+-[0-9]+).*/\1/')
sed -i -e "s/@VERSION_PLACEHOLDER/${VERSION}/" ../org.DolphinEmu.dolphin-emu.metainfo.xml

View File

@ -36,7 +36,7 @@
<id>dolphin-emu.desktop</id>
</provides>
<releases>
<release version="@VERSION_PLACEHOLDER" date="@DATE_PLACEHOLDER"/>
<release version="${DOLPHIN_WC_DESCRIBE}" date="${DOLPHIN_WC_BUILD_DATE}"/>
</releases>
<url type="homepage">https://dolphin-emu.org</url>
<url type="bugtracker">https://bugs.dolphin-emu.org/projects/emulator/issues</url>

View File

@ -63,16 +63,12 @@ modules:
- /share/man
post-install:
- install -D -t ${FLATPAK_DEST}/bin/ ../dolphin-emu-wrapper
- "${FLATPAK_BUILDER_BUILDDIR}/Flatpak/fill_release_node.sh"
- install -Dm644 -t ${FLATPAK_DEST}/share/metainfo/ ../org.DolphinEmu.dolphin-emu.metainfo.xml
- install -Dm644 -t ${FLATPAK_DEST}/share/metainfo/ Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml
- desktop-file-edit --set-key=Exec --set-value='/app/bin/dolphin-emu-wrapper'
/app/share/applications/dolphin-emu.desktop
sources:
- type: dir
path: ..
- type: file
path: org.DolphinEmu.dolphin-emu.metainfo.xml.in
dest-filename: org.DolphinEmu.dolphin-emu.metainfo.xml
- type: script
commands:
- |