Tweak appdata file generation some more

Should make it easier for packagers to provide their own releases data.
This commit is contained in:
Geert Janssens 2020-02-17 14:13:18 +01:00
parent 7a16e04822
commit dd18128927
7 changed files with 53 additions and 13 deletions

View File

@ -62,9 +62,15 @@ option (DISABLE_DEPRECATED_GNOME "don't use deprecated gnome functions" OFF)
# Use gsettings-desktop-schemas for a better integration with GNOME
set(COMPILE_GSCHEMAS ON CACHE BOOL "Compile the GSettings schema")
set(GNUCASH_BUILD_ID "" CACHE STRING "Overrides the GnuCash build identification (Build ID) which defaults to a description of the vcs commit from which gnucash is built. Distributions may want to insert a package management based version number instead")
# GENERATE_SWIG_WRAPPERS - Controls whether to generate the swig wrappers for guile and python. If not set the wrappers will only be generated when building from a git worktree, commented out here, but will be evaluated later on in this file
# Support for downstream packagers
set(GNUCASH_BUILD_ID "" CACHE STRING "Overrides the GnuCash build identification (Build ID) which defaults to a description of the vcs commit from which gnucash is built. Distributions may want to insert a package management based version number instead")
# In addition to the GNUCASH_BUILD_ID environment variable, packagers can overwrite
# gnucash/gnome/gnucash.releases.xml with (package) release details to be included
# in the appdata file. It should follow appdata <release> node conventions.
# Check that all of the absolute install paths are inside
# ${CMAKE_INSTALL_PREFIX}. If they're not, disable binreloc as it
# won't be able to find paths that aren't relative to the location of

View File

@ -9,6 +9,6 @@ endif()
set_dist_list(cmake_DIST CMakeLists.txt README_CMAKE.txt cmake_uninstall.cmake.in
insert-vcs-data.cmake configure-manpage.cmake git2version-info.cmake
version-info2env.cmake
configure-appdata.cmake configure-gnucash-desktop.cmake configure-manpage.cmake
git2version-info.cmake version-info2env.cmake
)

View File

@ -0,0 +1,33 @@
# Command to configure the gnucash appdata file
# These commands are stored in a separate cmake file as they have to be
# rerun depending on build conditions, not depending on cmake conditions
# (such as did the version string change or not)
#
# Logic is as follows:
# - the source file <current-source-dir>/releases.xml will be
# configured with version information found in gnc-vcs-info.h
# and an optional GNUCASH_BUILD_ID variable
# - the result of this configuration will be applied to the
# appdata input file
# The default releases.xml file will just be a single release line in
# appdata <release> node format. Handling this in a separate file allows
# packagers to override it to supply their own (package) release details.
#
# The following environment variables are used and should be properly set
# by the calling code:
# - SRC_DIR (top level source code directory)
# - SRC (full path to gnucash.appdata.xml.in)
# - DST (full path to destination for gnucash.appdata.xml)
# - REL_FILE (path to file containg (packaging) release info)
# - VCS_INFO_FILE (full path to gnc-vcs-info.h - can be in source tree (release builds) or build tree (git builds))
# - GNUCASH_BUILD_ID (optional, extra version information supplied by packagers)
include (${SRC_DIR}/cmake/version-info2env.cmake)
versioninfo2env (${VCS_INFO_FILE})
if (GNUCASH_BUILD_ID AND NOT "${GNUCASH_BUILD_ID}" STREQUAL "${GNC_VCS_REV}")
set (GNC_VCS_REV "${GNC_VCS_REV} (${GNUCASH_BUILD_ID})")
endif()
file (READ ${REL_FILE} REL_INFO_IN)
string(CONFIGURE "${REL_INFO_IN}" REL_INFO)
configure_file(${SRC} ${DST})

View File

@ -1,4 +1,4 @@
# Command to configure the gnucash appdata file
# Command to configure the gnucash desktop file
# These commands are stored in a separate cmake file as they have to be
# rerun depending on build conditions, not depending on cmake conditions
# (such as did the version string change or not)
@ -6,10 +6,10 @@
# The following environment variables are used and should be properly set
# by the calling code:
# - SRC_DIR (top level source code directory)
# - SRC (full path to gnc-vcs-info.h.in)
# - DST (full path to destination for gnc-vcs-info.h)
# - SRC (full path to gnucash.desktop.in)
# - DST (full path to destination for gnucash.desktop)
# - VCS_INFO_FILE (full path to gnc-vcs-info.h - can be in source tree (release builds) or build tree (git builds))
# - DATADIR_BUILD (path to applicication data directory, typically {CMAKE_BINARY_DIR}/share)
# - DATADIR_BUILD (path to application data directory, typically {CMAKE_BINARY_DIR}/share)
include (${SRC_DIR}/cmake/version-info2env.cmake)
versioninfo2env (${VCS_INFO_FILE})

View File

@ -183,14 +183,14 @@ endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml
DEPENDS ${GNC_APPDATA_IN} ${VCS_INFO_FILE}
DEPENDS ${GNC_APPDATA_IN} ${VCS_INFO_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.releases.xml
COMMAND ${CMAKE_COMMAND} -D SRC=${GNC_APPDATA_IN}
-D DST=${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml
-D VCS_INFO_FILE=${VCS_INFO_FILE}
-D GNUCASH_BUILD_ID=${GNUCASH_BUILD_ID}
-D PROJECT_VERSION=${PROJECT_VERSION}
-D SRC_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/cmake/insert-vcs-data.cmake)
-D REL_FILE=${CMAKE_CURRENT_SOURCE_DIR}/gnucash.releases.xml
-P ${CMAKE_SOURCE_DIR}/cmake/configure-appdata.cmake)
add_custom_target(gnucash-appdata ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml)
@ -234,7 +234,7 @@ add_custom_command (
-D VCS_INFO_FILE=${VCS_INFO_FILE}
-D PROJECT_VERSION=${PROJECT_VERSION}
-D SRC_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/cmake/insert-vcs-data.cmake)
-P ${CMAKE_SOURCE_DIR}/cmake/configure-gnucash-desktop.cmake)
add_custom_target(gnucash-desktop ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop)
@ -242,5 +242,5 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION ${CMAKE_I
set_dist_list(gnome_DIST
CMakeLists.txt gnome.i gnucash.appdata.xml.in.in gnucash.desktop.in.in
${gnc_gnome_noinst_HEADERS} ${gnc_gnome_SOURCES})
gnucash.releases.xml ${gnc_gnome_noinst_HEADERS} ${gnc_gnome_SOURCES})
dist_add_generated(${BUILDING_FROM_VCS} gnucash.appdata.xml.in gnucash.desktop.in)

View File

@ -35,7 +35,7 @@
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+</project_license>
<releases>
<release date="${GNC_VCS_REV_DATE}" version="${GNC_VCS_REV}" />
${REL_INFO}
</releases>
<screenshots>

View File

@ -0,0 +1 @@
<release date="${GNC_VCS_REV_DATE}" version="${GNC_VCS_REV}" />