gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Sat Feb 8 08:32:03 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/1ccea05b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/cce69e37 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8243496e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f27cbd4a (commit)
	from  https://github.com/Gnucash/gnucash/commit/e90e9cbd (commit)



commit 1ccea05b6e3bc8019af493c041318ae8bceef920
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Feb 8 13:54:28 2020 +0100

    CMake - drop LC_ALL=C for generation of appdata and desktop files
    
    It doesn't seem to have any noticable effect.

diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt
index 3a96d9169..9fd607d2e 100644
--- a/gnucash/gnome/CMakeLists.txt
+++ b/gnucash/gnome/CMakeLists.txt
@@ -160,11 +160,9 @@ if (NOT BUILDING_FROM_VCS)
     # intermediate appdata file in the dist tarball.
     set (GNC_APPDATA_IN ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in)
 elseif (TRANSLATE_GNUCASH_APPDATA)
-    # FIXME: where does LC_ALL=C come from?
     add_custom_command (
         OUTPUT ${GNC_APPDATA_IN}
         COMMAND ${CMAKE_COMMAND} -E env
-            LC_ALL=C
             ${GETTEXT_MSGFMT_EXECUTABLE}
                 --xml --template ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.in
                 -d ${CMAKE_SOURCE_DIR}/po
@@ -209,7 +207,6 @@ elseif (TRANSLATE_GNUCASH_DESKTOP)
     add_custom_command (
         OUTPUT ${GNC_DESKTOP_IN}
         COMMAND ${CMAKE_COMMAND} -E env
-            LC_ALL=C
             ${GETTEXT_MSGFMT_EXECUTABLE}
                 --desktop --template ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.desktop.in.in
                 -d ${CMAKE_SOURCE_DIR}/po

commit cce69e37d27d2a48e1bd4f2b9e0ed2d4ebaaeaf5
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Feb 8 11:44:40 2020 +0100

    Rework appdata and desktop file generation
    
    - attempt to merge in translations before merging in version data
    - add the intermediate file (with translations) to the dist tarball
    - dist builds no longer have to run the translation merge, but can instead
      use the included intermediate file. This accomodates distros with
      older gettext versions.

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 453550802..a72d38f80 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -9,6 +9,6 @@ endif()
 
 
 set_dist_list(cmake_DIST CMakeLists.txt README_CMAKE.txt cmake_uninstall.cmake.in
-    configure-appdata.cmake configure-manpage.cmake git2version-info.cmake
+    insert-vcs-data.cmake configure-manpage.cmake git2version-info.cmake
     version-info2env.cmake
 )
diff --git a/cmake/configure-appdata.cmake b/cmake/insert-vcs-data.cmake
similarity index 96%
rename from cmake/configure-appdata.cmake
rename to cmake/insert-vcs-data.cmake
index 11cc7b765..2e0ce92ca 100644
--- a/cmake/configure-appdata.cmake
+++ b/cmake/insert-vcs-data.cmake
@@ -13,4 +13,4 @@
 
 include (${SRC_DIR}/cmake/version-info2env.cmake)
 versioninfo2env (${VCS_INFO_FILE})
-configure_file(${SRC} ${DST} )
+configure_file(${SRC} ${DST})
diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt
index 7a05b38b0..3a96d9169 100644
--- a/gnucash/gnome/CMakeLists.txt
+++ b/gnucash/gnome/CMakeLists.txt
@@ -153,62 +153,91 @@ install(TARGETS gnc-gnome
 
 # No headers to install
 
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
-DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.in ${VCS_INFO_FILE}
-    COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.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 (TRANSLATE_GNUCASH_APPDATA)
+set (GNC_APPDATA_IN ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in)
+if (NOT BUILDING_FROM_VCS)
+    # We're building from a dist tarball.
+    # As a convenience to packagers we have included a pretranslated
+    # intermediate appdata file in the dist tarball.
+    set (GNC_APPDATA_IN ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in)
+elseif (TRANSLATE_GNUCASH_APPDATA)
     # FIXME: where does LC_ALL=C come from?
     add_custom_command (
-        OUTPUT gnucash.appdata.xml
+        OUTPUT ${GNC_APPDATA_IN}
         COMMAND ${CMAKE_COMMAND} -E env
             LC_ALL=C
             ${GETTEXT_MSGFMT_EXECUTABLE}
-                --xml --template ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
+                --xml --template ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.in
                 -d ${CMAKE_SOURCE_DIR}/po
-                -o gnucash.appdata.xml
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in ${VCS_INFO_FILE})
+                -o ${GNC_APPDATA_IN}
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.in)
 else()
-    # Gettext is too old to be able to merge an appdata file.
+    # Gettext is too old to be able to merge a desktop file
+    # and we're building from git.
     # Fall back to providing an unmerged (and hence untranslated) appdata file.
+    # Note the build system won't allow generating a dist tarball in this scenario.
     add_custom_command (
-        OUTPUT gnucash.appdata.xml
+        OUTPUT ${GNC_APPDATA_IN}
         COMMAND ${CMAKE_COMMAND} -E copy_if_different
-           ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
-           ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml
-
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in ${VCS_INFO_FILE})
+            ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.in
+            ${GNC_APPDATA_IN}
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.in)
 endif()
 
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml
+    DEPENDS ${GNC_APPDATA_IN} ${VCS_INFO_FILE}
+    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 PROJECT_VERSION=${PROJECT_VERSION}
+                             -D SRC_DIR=${CMAKE_SOURCE_DIR}
+                             -P ${CMAKE_SOURCE_DIR}/cmake/insert-vcs-data.cmake)
+
 add_custom_target(gnucash-appdata ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml)
 
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml DESTINATION  ${CMAKE_INSTALL_DATADIR}/metainfo)
 
 #=======
 
-configure_file(gnucash.desktop.in.in gnucash.desktop.in)
-
-if (TRANSLATE_GNUCASH_DESKTOP)
+set (GNC_DESKTOP_IN ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop.in)
+if (NOT BUILDING_FROM_VCS)
+    # We're building from a dist tarball.
+    # As a convenience to packagers we have included a pretranslated
+    # intermediate desktop file in the dist tarball.
+    set (GNC_DESKTOP_IN ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.desktop.in)
+elseif (TRANSLATE_GNUCASH_DESKTOP)
     add_custom_command (
-        OUTPUT gnucash.desktop
+        OUTPUT ${GNC_DESKTOP_IN}
         COMMAND ${CMAKE_COMMAND} -E env
             LC_ALL=C
             ${GETTEXT_MSGFMT_EXECUTABLE}
-                --desktop --template gnucash.desktop.in
+                --desktop --template ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.desktop.in.in
                 -d ${CMAKE_SOURCE_DIR}/po
-                -o gnucash.desktop
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop.in)
+                -o ${GNC_DESKTOP_IN}
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.desktop.in.in)
 else()
-    # Gettext is too old to be able to merge a desktop file.
+    # Gettext is too old to be able to merge a desktop file
+    # and we're building from git.
     # Fall back to providing an unmerged (and hence untranslated) desktop file.
-    configure_file (${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop.in
-                    ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop COPYONLY)
+    # Note the build system won't allow generating a dist tarball in this scenario.
+    add_custom_command (
+        OUTPUT ${GNC_DESKTOP_IN}
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different
+            ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.desktop.in.in
+            ${GNC_DESKTOP_IN}
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.desktop.in.in)
 endif()
 
+add_custom_command (
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop
+    DEPENDS ${GNC_DESKTOP_IN} ${VCS_INFO_FILE}
+    COMMAND ${CMAKE_COMMAND} -D SRC=${GNC_DESKTOP_IN}
+                             -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop
+                             -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)
+
 add_custom_target(gnucash-desktop ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop)
 
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION  ${CMAKE_INSTALL_DATADIR}/applications)
@@ -216,3 +245,4 @@ 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})
+dist_add_generated(${BUILDING_FROM_VCS} gnucash.appdata.xml.in gnucash.desktop.in)

commit 8243496ed0b3ea50d399422f0cc7ced713d2ea64
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Feb 7 21:56:21 2020 +0100

    Rework our gettext tests
    
    - only abort configuration if gettext is older than 0.18.1 (required for string extraction from scheme files)
    - otherwise always continue but disable a few other build steps depending on the gettext version
    - use feature variables to more clearly convey what is enabled or disabled

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07b71d945..fe7a38b8b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,6 @@ option (DISABLE_NLS "do not use Native Language Support" OFF)
 option (DISABLE_DEPRECATED_GLIB "don't use deprecated glib functions" OFF)
 option (DISABLE_DEPRECATED_GTK "don't use deprecated gtk, gdk or gdk-pixbuf functions" OFF)
 option (DISABLE_DEPRECATED_GNOME "don't use deprecated gnome functions" OFF)
-option (ALLOW_OLD_GETTEXT "allow to configure build with a gettext version older than 0.19.6. Some files will not be translated!" OFF)
 # ############################################################
 
 # These are also settable from the command line in a similar way.
@@ -269,26 +268,27 @@ find_path (REGEX_INCLUDE_PATH NAMES regex.h
 find_library (REGEX_LIBRARY NAMES regex)
 
 # I18N
-if (ALLOW_OLD_GETTEXT)
-    find_package (Gettext REQUIRED)
-else()
-    find_package (Gettext 0.20)
-    if (NOT GETTEXT_FOUND)
-        message (FATAL_ERROR "Note the build can be configured with an older version of gettext by setting ALLOW_OLD_GETTEXT=ON but then some files will not be translated:
-        - gnucash.desktop (requires at least gettext 0.19)
-        - gnucash.appdata.xml (requires at least gettext 0.19.6)
-        - tag developer_name from gnucash.appdata.xml (requires at least gettext 0.20)")
-    endif()
-endif()
+# Potfile generation will only be enabled if building from a git worktree
+set (BUILD_GNUCASH_POT ${BUILDING_FROM_VCS})
+set (TRANSLATE_GNUCASH_APPDATA ON)
+set (TRANSLATE_GNUCASH_DESKTOP ON)
 
-if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19)
-    message (WARNING "Got gettext version ${GETTEXT_VERSION_STRING}, however you need at least gettext version 0.19 in order to handle translation of the gnucash.desktop file. The build will be configured with an untranslated gnucash.desktop file.")
+find_package (Gettext 0.18.1 REQUIRED)
+if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.20)
+    message (WARNING "Gettext version 0.20 or more recent is required to translate the 'developer_name' tag in gnucash.appdata.xml. All but that tag will be translated in the generated file.")
+    if(BUILD_GNUCASH_POT)
+        # Only emit warning if potfile generation was enabled otherwise
+        message (WARNING "Gettext version 0.20 or more recent is required to extract all translatable strings. Potfile generation will be disabled.")
+    endif()
+    set (BUILD_GNUCASH_POT OFF)
 endif()
 if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19.6)
-    message (WARNING "Got gettext version ${GETTEXT_VERSION_STRING}, however you need at least gettext version 0.19.6 in order to handle translation of the gnucash.appdata file. The build will be configured with an untranslated gnucash.appdata file.")
+    set (TRANSLATE_GNUCASH_APPDATA OFF)
+    message (WARNING "Gettext version 0.19.6 or more recent is required to translate gnucash.appdata.xml. The build will be configured to generate an untranslated gnucash.appdata.xml.")
 endif()
-if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.20)
-    message (WARNING "Got gettext version ${GETTEXT_VERSION_STRING}, however you need at least gettext version 0.20 in order to handle the translation of 'GnuCash Project' from the gnucash.appdata file. That message will be missing in gnucash.pot.")
+if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19)
+    set (TRANSLATE_GNUCASH_DESKTOP OFF)
+    message (WARNING "Gettext version 0.19 or more recent is required to translate gnucash.desktop. The build will be configured to generate an untranslated gnucash.desktop.")
 endif()
 
 find_path (LIBINTL_INCLUDE_PATH NAMES libintl.h
diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt
index 727f91df6..7a05b38b0 100644
--- a/gnucash/gnome/CMakeLists.txt
+++ b/gnucash/gnome/CMakeLists.txt
@@ -161,18 +161,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in.in ${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.
-    add_custom_command (
-        OUTPUT gnucash.appdata.xml
-        COMMAND ${CMAKE_COMMAND} -E copy_if_different
-           ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
-           ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml
-
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in ${VCS_INFO_FILE}
-        )
-else()
+if (TRANSLATE_GNUCASH_APPDATA)
     # FIXME: where does LC_ALL=C come from?
     add_custom_command (
         OUTPUT gnucash.appdata.xml
@@ -182,8 +171,17 @@ else()
                 --xml --template ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
                 -d ${CMAKE_SOURCE_DIR}/po
                 -o gnucash.appdata.xml
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in ${VCS_INFO_FILE}
-    )
+        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in ${VCS_INFO_FILE})
+else()
+    # Gettext is too old to be able to merge an appdata file.
+    # Fall back to providing an unmerged (and hence untranslated) appdata file.
+    add_custom_command (
+        OUTPUT gnucash.appdata.xml
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different
+           ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in
+           ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml
+
+        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in ${VCS_INFO_FILE})
 endif()
 
 add_custom_target(gnucash-appdata ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml)
@@ -194,12 +192,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml DESTINATION  ${CMA
 
 configure_file(gnucash.desktop.in.in gnucash.desktop.in)
 
-if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19)
-    # Gettext is too old to be able to merge a desktop file.
-    # Fall back to providing an unmerged (and hence untranslated) desktop file.
-    configure_file (${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop.in
-                    ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop COPYONLY)
-else()
+if (TRANSLATE_GNUCASH_DESKTOP)
     add_custom_command (
         OUTPUT gnucash.desktop
         COMMAND ${CMAKE_COMMAND} -E env
@@ -208,8 +201,12 @@ else()
                 --desktop --template gnucash.desktop.in
                 -d ${CMAKE_SOURCE_DIR}/po
                 -o gnucash.desktop
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop.in
-    )
+        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop.in)
+else()
+    # Gettext is too old to be able to merge a desktop file.
+    # Fall back to providing an unmerged (and hence untranslated) desktop file.
+    configure_file (${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop.in
+                    ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop COPYONLY)
 endif()
 
 add_custom_target(gnucash-desktop ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 25aa9a6a8..47092ce07 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -132,7 +132,7 @@ function(make_gnucash_potfiles)
   set(gnucash_pot_depends ${POTFILE_DEPS}  CACHE INTERNAL "List of files with translatable strings. If any of these change, gnucash.pot should be regenerated")
 endfunction()
 
-if(BUILDING_FROM_VCS)
+if(BUILD_GNUCASH_POT)
 
   make_gnucash_potfiles()
 

commit f27cbd4a11ec00b3929ec63dd03243eb308440fe
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Feb 8 11:54:53 2020 +0100

    Fix dist after renaming account directory hu_HU to hu

diff --git a/data/accounts/hu/CMakeLists.txt b/data/accounts/hu/CMakeLists.txt
index 6b2b3dc3b..0f9adf6d2 100644
--- a/data/accounts/hu/CMakeLists.txt
+++ b/data/accounts/hu/CMakeLists.txt
@@ -17,7 +17,7 @@ set(account_DATA
   acctchrt_spouseretire.gnucash-xea)
 
 
-set_dist_list(HU_HU_DIST ${account_DATA} CMakeLists.txt)
+set_dist_list(HU_DIST ${account_DATA} CMakeLists.txt)
 
 install(FILES ${account_DATA} DESTINATION ${ACCOUNTS_INSTALL_DIR}/hu)
 file(COPY ${account_DATA} DESTINATION ${ACCOUNTS_BUILD_DIR}/hu)



Summary of changes:
 CMakeLists.txt                                     |  34 +++----
 cmake/CMakeLists.txt                               |   2 +-
 ...nfigure-appdata.cmake => insert-vcs-data.cmake} |   2 +-
 data/accounts/hu/CMakeLists.txt                    |   2 +-
 gnucash/gnome/CMakeLists.txt                       | 106 +++++++++++++--------
 po/CMakeLists.txt                                  |   2 +-
 6 files changed, 86 insertions(+), 62 deletions(-)
 rename cmake/{configure-appdata.cmake => insert-vcs-data.cmake} (96%)



More information about the gnucash-changes mailing list