Bug 797353 - Add copyright and release info in appdata file

This also means the appdata file now requires preprocessing to set this info
automatically.
This commit is contained in:
Geert Janssens 2019-08-24 16:32:56 +02:00
parent c4a21bc9d4
commit 7dc59950a5
7 changed files with 51 additions and 14 deletions

View File

@ -152,7 +152,14 @@ if (GNC_VCS_INFO_RESULT EQUAL 0)
if (NOT GIT_FOUND)
message(SEND_ERROR "Looks like we're building from version control, but can't find git executable. Please set GIT_EXECUTABLE.")
endif()
set(VCS_INFO_BASE_DIR ${CMAKE_BINARY_DIR})
else()
set(VCS_INFO_BASE_DIR ${CMAKE_SOURCE_DIR})
endif()
# The location of gnc-vcs-info.h depends on whether we build from VCS or not
# And this file is needed in several other build rules, so we define its
# location once here.
set(VCS_INFO_FILE ${VCS_INFO_BASE_DIR}/libgnucash/core-utils/gnc-vcs-info.h)
# Determine whether to generate the swig wrappers.
# By default they will only be generated when building from a git worktree

View File

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

View File

@ -0,0 +1,16 @@
# 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)
#
# 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)
# - 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)
include (${SRC_DIR}/cmake/version-info2env.cmake)
versioninfo2env (${VCS_INFO_FILE})
configure_file(${SRC} ${DST} )

View File

@ -54,14 +54,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list DESTINATION ${CMA
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list
DESTINATION ${DATADIR_BUILD}/gnucash)
# ---
if (BUILDING_FROM_VCS)
set(VCS_INFO_BASE_DIR ${CMAKE_BINARY_DIR})
else()
set(VCS_INFO_BASE_DIR ${CMAKE_SOURCE_DIR})
endif()
set(VCS_INFO_FILE ${VCS_INFO_BASE_DIR}/libgnucash/core-utils/gnc-vcs-info.h)
add_custom_command(OUTPUT gnucash.1
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.1.in gnc-vcs-info
COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/gnucash.1.in

View File

@ -153,23 +153,30 @@ install(TARGETS gnc-gnome
# No headers to install
# FIXME: where does LC_ALL=C come from?
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in ${VCS_INFO_FILE}
COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
-D DST=${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
-D VCS_INFO_FILE=${VCS_INFO_FILE}
-D SRC_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/cmake/configure-appdata.cmake)
if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19.6)
# Gettext is too old to be able to merge an appdata file.
# Fall back to providing an unmerged (and hence untranslated) appdata file.
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
configure_file (${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml COPYONLY)
else()
# FIXME: where does LC_ALL=C come from?
add_custom_command (
OUTPUT gnucash.appdata.xml
COMMAND ${CMAKE_COMMAND} -E env
LC_ALL=C
${GETTEXT_MSGFMT_EXECUTABLE}
--xml --template ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
--xml --template ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
-d ${CMAKE_SOURCE_DIR}/po
-o gnucash.appdata.xml
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in gnc-vcs-info
)
endif()

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright ${GNC_VCS_REV_YEAR} Multiple Authors, see included AUTHORS file. -->
<component>
<id>org.gnucash.GnuCash</id>
<name>GnuCash</name>
@ -33,6 +34,10 @@
<launchable type="desktop-id">gnucash.desktop</launchable>
<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}" />
</releases>
<screenshots>
<screenshot type="default">
<image type="source" width="1049" height="590">https://www.gnucash.org/images/features/feature_accounts_lg.png</image>

View File

@ -41,6 +41,16 @@ set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
set(localedir "${CMAKE_INSTALL_FULL_DATAROOTDIR}/locale")
configure_file(gncla-dir.h.in gncla-dir.h)
# ---
if (BUILDING_FROM_VCS)
set(VCS_INFO_BASE_DIR ${CMAKE_BINARY_DIR})
else()
set(VCS_INFO_BASE_DIR ${CMAKE_SOURCE_DIR})
endif()
set(VCS_INFO_FILE ${VCS_INFO_BASE_DIR}/libgnucash/core-utils/gnc-vcs-info.h CACHE STRING "path to gnc-vcs-dir")
### Create gnc-vcs-info.h
# This can only be done when building from a vcs (git/svn/bzr/svk) working directory.
# This file is shipped in the distribution tarball, so no need to generate it in that case anyway.
@ -63,7 +73,7 @@ add_custom_target(gnc-vcs-info ALL
-P ${CMAKE_SOURCE_DIR}/cmake/git2version-info.cmake
)
else(BUILDING_FROM_VCS)
add_custom_target(gnc-vcs-info DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnc-vcs-info.h)
add_custom_target(gnc-vcs-info DEPENDS ${VCS_INFO_FILE})
endif(BUILDING_FROM_VCS)
dist_add_generated (${BUILDING_FROM_VCS} gnc-vcs-info.h)
### Compile library