Skip to content

Commit

Permalink
Bug 797353 - Add copyright and release info in appdata file
Browse files Browse the repository at this point in the history
This also means the appdata file now requires preprocessing to set this info
automatically.
  • Loading branch information
gjanssens committed Aug 24, 2019
1 parent c4a21bc commit 7dc5995
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Expand Up @@ -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
)
16 changes: 16 additions & 0 deletions cmake/configure-appdata.cmake
@@ -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} )
8 changes: 0 additions & 8 deletions doc/CMakeLists.txt
Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions gnucash/gnome/CMakeLists.txt
Expand Up @@ -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()

Expand Down
5 changes: 5 additions & 0 deletions gnucash/gnome/gnucash.appdata.xml.in
@@ -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>
Expand Down Expand Up @@ -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>
Expand Down
12 changes: 11 additions & 1 deletion libgnucash/core-utils/CMakeLists.txt
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 7dc5995

Please sign in to comment.