gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Wed Mar 17 11:25:03 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/5bf3bfc6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fbabcd58 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b9208ecc (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e973a1b6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d7e348a1 (commit)
	from  https://github.com/Gnucash/gnucash/commit/e27851d6 (commit)



commit 5bf3bfc6b6edf69da4138abe6c38eafa5c20a215
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Mar 17 16:19:07 2021 +0100

    Bug 797691 - Tip of the day is not rebuilt when the source file changes
    
    Changes to tip_of_the_day.list.c will now properly trigger a rebuild.
    
    Plus a few minor assorted fixes and changes to generating the man pages
    - only generate the final files in share/gnucash, not in the build directory
    - gnucash-cli.1 was not installed, gnucash.1 twice

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index c8aa8da9f..3d460e2f7 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -10,5 +10,5 @@ endif()
 
 set_dist_list(cmake_DIST CMakeLists.txt README_CMAKE.txt cmake_uninstall.cmake.in
     configure-appdata.cmake configure-gnucash-desktop.cmake configure-manpage.cmake
-    git2version-info.cmake version-info2env.cmake
+    configure-totd.cmake git2version-info.cmake version-info2env.cmake
 )
diff --git a/cmake/configure-manpage.cmake b/cmake/configure-manpage.cmake
index 9e1a21c51..fe09f265d 100644
--- a/cmake/configure-manpage.cmake
+++ b/cmake/configure-manpage.cmake
@@ -12,5 +12,4 @@
 
 include (${SRC_DIR}/cmake/version-info2env.cmake)
 versioninfo2env (${VCS_INFO_FILE})
-configure_file(${SRC} ${DST} )
-configure_file(${DST} ${DATADIR_BUILD}/gnucash/${DST} COPYONLY)
+configure_file(${SRC} ${DATADIR_BUILD}/gnucash/${DST} )
diff --git a/cmake/configure-totd.cmake b/cmake/configure-totd.cmake
new file mode 100644
index 000000000..f4906c4df
--- /dev/null
+++ b/cmake/configure-totd.cmake
@@ -0,0 +1,24 @@
+# Command to configure the gnucash man page
+# These commands are store 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 (source code directory containing tip_of_the_day.list.c)
+# - DST_DIR (build dir to write tip_of_the_day.list to)
+# - SRC (full path to tip_of_the_day.list.c)
+# - DST (target filename)
+# - CMAKE_C_COMPILER (path to C compiler, used to parse the input file)
+file(REMOVE ${DST_DIR}/${TOTD})
+execute_process(
+    COMMAND ${CMAKE_C_COMPILER} -E -P -x c -DN_\(x\)=x -o ${TOTD}.tmp ${SRC}
+)
+
+file(STRINGS ${TOTD}.tmp TIP_OF_THE_DAY_LINES)
+set(TOTD_OUTPUT "")
+foreach(line ${TIP_OF_THE_DAY_LINES})
+  string(REGEX REPLACE "^ *\"" "" line2 "${line}")
+  string(REGEX REPLACE "\" *$" "" line3 "${line2}")
+  file(APPEND ${DST_DIR}/${TOTD} "${line3}\n")
+endforeach()
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index b7e83f123..91104cdf1 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -19,40 +19,35 @@ endforeach()
 
 # Generate the tip of the day file.
 
-execute_process(
-    COMMAND ${CMAKE_C_COMPILER} -E -P -x c -DN_\(x\)=x -o ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list.tmp ${CMAKE_CURRENT_SOURCE_DIR}/tip_of_the_day.list.c
+set (totd "tip_of_the_day.list")
+add_custom_command(OUTPUT ${DATADIR_BUILD}/gnucash/${totd}
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${totd}.c
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMAND ${CMAKE_COMMAND}
+        -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/${totd}.c
+        -D TOTD=${totd}
+        -D DST_DIR=${DATADIR_BUILD}/gnucash
+        -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+        -P ${CMAKE_SOURCE_DIR}/cmake/configure-totd.cmake
 )
+add_custom_target(totd ALL DEPENDS ${DATADIR_BUILD}/gnucash/${totd})
 
-file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list.tmp TIP_OF_THE_DAY_LINES)
+install(FILES ${DATADIR_BUILD}/gnucash/tip_of_the_day.list DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash)
 
-set(TOTD_OUTPUT "")
-foreach(line ${TIP_OF_THE_DAY_LINES})
-  string(REGEX REPLACE "^ *\"" "" line2 "${line}")
-  string(REGEX REPLACE "\" *$" "" line3 "${line2}")
-  list(APPEND TOTD_OUTPUT "${line3}\n")
-endforeach()
-
-string(CONCAT FINAL_TOTD ${TOTD_OUTPUT})
-
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list "${FINAL_TOTD}")
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash)
-
-file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list
-  DESTINATION ${DATADIR_BUILD}/gnucash)
+# Generate manpages.
 
 foreach (manpage gnucash gnucash-cli)
-    add_custom_command(OUTPUT ${manpage}.1
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in ${VCS_INFO_FILE}
-    COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in
-                            -D DST=${manpage}.1
-                            -D VCS_INFO_FILE=${VCS_INFO_FILE}
-                            -D DATADIR_BUILD=${DATADIR_BUILD}
-                            -D SRC_DIR=${CMAKE_SOURCE_DIR}
-                            -P ${CMAKE_SOURCE_DIR}/cmake/configure-manpage.cmake
+    add_custom_command(OUTPUT ${DATADIR_BUILD}/gnucash/${manpage}.1
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in ${VCS_INFO_FILE}
+        COMMAND ${CMAKE_COMMAND}
+            -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in
+            -D DST=${manpage}.1
+            -D VCS_INFO_FILE=${VCS_INFO_FILE}
+            -D DATADIR_BUILD=${DATADIR_BUILD}
+            -D SRC_DIR=${CMAKE_SOURCE_DIR}
+            -P ${CMAKE_SOURCE_DIR}/cmake/configure-manpage.cmake
     )
-    add_custom_target(${manpage}-manpage DEPENDS ${manpage}.1)
-    dist_add_generated (${BUILDING_FROM_VCS} ${manpage}.1)
+    add_custom_target(${manpage}-manpage ALL DEPENDS ${DATADIR_BUILD}/gnucash/${manpage}.1)
 
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.1 DESTINATION  ${CMAKE_INSTALL_MANDIR}/man1)
+    install(FILES ${DATADIR_BUILD}/gnucash/${manpage}.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 endforeach()
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index bc2ab97cd..1b52dd1f5 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -53,8 +53,6 @@ add_executable (gnucash
     ${gnucash_noinst_HEADERS}
 )
 
-add_dependencies (gnucash gnucash-manpage gnucash-cli-manpage)
-
 target_compile_definitions(gnucash PRIVATE -DG_LOG_DOMAIN=\"gnc.bin\")
 
 target_link_libraries (gnucash

commit fbabcd58e0c85d7e5d4296153edc6c7f61e5f699
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Feb 4 14:15:44 2021 +0100

    Remove dead code

diff --git a/libgnucash/app-utils/gnc-ui-util.c b/libgnucash/app-utils/gnc-ui-util.c
index 99e42eb65..8ab9dd7fb 100644
--- a/libgnucash/app-utils/gnc-ui-util.c
+++ b/libgnucash/app-utils/gnc-ui-util.c
@@ -1129,51 +1129,6 @@ gnc_account_create_opening_balance (Account *account,
     return TRUE;
 }
 
-#if 0 /* Not Used */
-static void
-gnc_lconv_set_utf8 (char **p_value, char *default_value)
-{
-    char *value = *p_value;
-    *p_value = NULL;
-
-    if ((value == NULL) || (value[0] == 0))
-        value = default_value;
-
-#ifdef G_OS_WIN32
-    {
-        /* get number of resulting wide characters */
-        size_t count = mbstowcs (NULL, value, 0);
-        if (count > 0)
-        {
-            /* malloc and convert */
-            wchar_t *wvalue = g_malloc ((count + 1) * sizeof(wchar_t));
-            count = mbstowcs (wvalue, value, count + 1);
-            if (count > 0)
-            {
-                *p_value = g_utf16_to_utf8 (wvalue, -1, NULL, NULL, NULL);
-            }
-            g_free (wvalue);
-        }
-    }
-#else /* !G_OS_WIN32 */
-    *p_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
-#endif
-
-    if (*p_value == NULL)
-    {
-        // The g_locale_to_utf8 conversion failed. FIXME: Should we rather
-        // use an empty string instead of the default_value? Not sure.
-        *p_value = default_value;
-    }
-}
-
-static void
-gnc_lconv_set_char (char *p_value, char default_value)
-{
-    if ((p_value != NULL) && (*p_value == CHAR_MAX))
-        *p_value = default_value;
-}
-#endif /* Not Used */
 
 gnc_commodity *
 gnc_locale_default_currency_nodefault (void)
@@ -1230,8 +1185,6 @@ gnc_default_currency_common (gchar *requested_currency,
     if (currency)
     {
         mnemonic = requested_currency;
-// ??? Does anyone know what this is supposed to be doing?
-//        requested_currency = g_strdup(gnc_commodity_get_mnemonic(currency));
         g_free(mnemonic);
     }
     return currency;

commit b9208eccbff001581b21cb41d5e26935bc8122ec
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Feb 4 14:09:43 2021 +0100

    Remove duplicate declaration
    
    The function is also declared and defined in gnc-locale-utils

diff --git a/libgnucash/app-utils/gnc-ui-util.h b/libgnucash/app-utils/gnc-ui-util.h
index 3e1c31c3f..40c99f7e1 100644
--- a/libgnucash/app-utils/gnc-ui-util.h
+++ b/libgnucash/app-utils/gnc-ui-util.h
@@ -244,9 +244,6 @@ gnc_commodity * gnc_locale_default_currency_nodefault (void);
  * "USD", but this will have nothing to do with the actual locale. */
 gnc_commodity * gnc_locale_default_currency (void);
 
-/* Returns the default ISO currency string of the current locale. */
-const char * gnc_locale_default_iso_currency_code (void);
-
 
 /** Return the default currency set by the user.  If the user's
  *  preference is invalid, then this routine will return the default

commit e973a1b60dae4c5c71588d4c825b4a8701a76267
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Feb 4 14:08:14 2021 +0100

    Drop default locale currency special case for euro
    
    The condition mentioned in the comment no longer applies.
    All European locales on Windows (MingW64) properly present EUR
    as currency these days

diff --git a/libgnucash/app-utils/gnc-ui-util.c b/libgnucash/app-utils/gnc-ui-util.c
index f03183d0d..99e42eb65 100644
--- a/libgnucash/app-utils/gnc-ui-util.c
+++ b/libgnucash/app-utils/gnc-ui-util.c
@@ -51,7 +51,6 @@
 #include "Transaction.h"
 #include "gnc-engine.h"
 #include "gnc-features.h"
-#include "gnc-euro.h"
 #include "gnc-hooks.h"
 #include "gnc-locale-tax.h"
 #include "gnc-session.h"
@@ -1188,13 +1187,6 @@ gnc_locale_default_currency_nodefault (void)
 
     currency = gnc_commodity_table_lookup (table, GNC_COMMODITY_NS_CURRENCY, code);
 
-    /* Some very old locales (notably on win32) still announce a euro
-       currency as default, although it has been replaced by EUR in
-       2001. We use EUR as default in that case, but the user can always
-       override from gsettings. */
-    if (gnc_is_euro_currency (currency))
-        currency = gnc_get_euro();
-
     return (currency ? currency : NULL);
 }
 

commit d7e348a1fe3e0af31225d8a940441330efac59b9
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Feb 6 19:35:51 2021 +0100

    Add whitespace in Objective C code to de-confuse the KDevelop code parser

diff --git a/gnucash/gnucash-core-app.cpp b/gnucash/gnucash-core-app.cpp
index 08aecad1f..c589caa59 100644
--- a/gnucash/gnucash-core-app.cpp
+++ b/gnucash/gnucash-core-app.cpp
@@ -233,7 +233,7 @@ set_mac_locale()
     {
         lang_str = [locale objectForKey: NSLocaleLanguageCode];
         country_str = [locale objectForKey: NSLocaleCountryCode];
-	locale_str = [[[lang_str stringByAppendingString: @"_"]
+	locale_str = [ [ [lang_str stringByAppendingString: @"_"]
 		      stringByAppendingString: country_str]
                       stringByAppendingString: @".UTF-8"];
     }



Summary of changes:
 cmake/CMakeLists.txt               |  2 +-
 cmake/configure-manpage.cmake      |  3 +--
 cmake/configure-totd.cmake         | 24 +++++++++++++++++
 doc/CMakeLists.txt                 | 53 +++++++++++++++++-------------------
 gnucash/CMakeLists.txt             |  2 --
 gnucash/gnucash-core-app.cpp       |  2 +-
 libgnucash/app-utils/gnc-ui-util.c | 55 --------------------------------------
 libgnucash/app-utils/gnc-ui-util.h |  3 ---
 8 files changed, 51 insertions(+), 93 deletions(-)
 create mode 100644 cmake/configure-totd.cmake



More information about the gnucash-changes mailing list