gnucash stable: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Sat Jun 8 12:07:49 EDT 2024


Updated	 via  https://github.com/Gnucash/gnucash/commit/fbb08c9d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/bd6e79b4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3f8b97bb (commit)
	from  https://github.com/Gnucash/gnucash/commit/e1b3c9ef (commit)



commit fbb08c9db9fe613ca204b5d6b7a651bf505aca1c
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Jun 8 18:06:01 2024 +0200

    Clean up some obsolete tools and references to non-git vcs's

diff --git a/.gitignore b/.gitignore
index 8b6aa164f1..f2706c5eeb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -150,7 +150,6 @@ gnucash/gnome/gnucash
 gnucash/gnome/gnucash.desktop
 gnucash/gnome/gnucash.desktop.in
 gnucash/gnome-utils/gnucash
-gnucash/gnome-utils/gnc-svninfo.h
 gnucash/gnome-utils/gnc-version.h
 gnucash/gnome-utils/gnucash
 gnucash/gnome-utils/test/test-gnc-dialog
diff --git a/gnucash/gnucash-core-app.cpp b/gnucash/gnucash-core-app.cpp
index e35055a274..c9a3715c7d 100644
--- a/gnucash/gnucash-core-app.cpp
+++ b/gnucash/gnucash-core-app.cpp
@@ -59,7 +59,7 @@ static QofLogModule log_module = GNC_MOD_GUI;
 #include <locale.h>
 #include <gnc-locale-utils.hpp>
 
-/* GNC_VCS is defined whenever we're building from an svn/svk/git/bzr tree */
+/* GNC_VCS is defined whenever we're building from a git work tree */
 #ifdef GNC_VCS
 constexpr int is_development_version = TRUE;
 #else
diff --git a/util/git-backport.sh b/util/git-backport.sh
deleted file mode 100755
index 5c65ec9cbd..0000000000
--- a/util/git-backport.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-REV=$1
-: ${ORIGBRANCH=trunk}
-: ${WHOAMI=`whoami`}
-
-TMPFILE=tmplog.tmp
-#TMPFILE2=tmplog2.tmp
-
-# Cherry-pick the other commit
-ORIGID=`git svn find-rev r${REV} ${ORIGBRANCH}`
-if [ -z "${ORIGID}" ] ; then
-    echo "Revision ${REV} not found in branch ${ORIGBRANCH}"
-    exit 1
-fi
-git cherry-pick ${ORIGID}
-
-# Create new log message by modifying the old one
-git log --pretty=format:"[$REV] %s%n%n%b" HEAD^..HEAD \
-    | grep -v '^BP$' | grep -v 'git-svn-id:' > ${TMPFILE}
-OTHERAUTHOR=`git log --pretty=format:"%an" HEAD^..HEAD`
-if [ "${WHOAMI}" != "${OTHERAUTHOR}" ]; then
-    echo -e "\nOriginal commit by ${OTHERAUTHOR}." >> ${TMPFILE}
-fi
-
-# Commit new log message
-git commit --amend -F ${TMPFILE}
-
-# Clean up temporary files
-rm -f ${TMPFILE}
diff --git a/util/glade-fixup b/util/glade-fixup
deleted file mode 100755
index ffa1a05caa..0000000000
--- a/util/glade-fixup
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-#
-# Remove entries that are for post-gtk2.8 attributes.  Glade on a
-# gtk2.8 system will complain when unknown attributes are present on a
-# widget.
-#
-# This script should be run from the top-level source directory before
-# committing changed glade files.
-#
-
-if test -d src ; then
-    SEARCHDIRS=src
-else
-    SEARCHDIRS=.
-fi
-
-find ${SEARCHDIRS} -name \*.glade | xargs \
-  sed -i -e '/name="image_position"/d' \
-         -e '/name="inner_border"/d'
-
-# GTK 2.6 (now allowed)
-#	add_tearoffs
-#	angle
-#	ellipsize
-#	focus_on_map
-#	hover_expand
-#	hover_selection
-#	single_line_mode
-#	width_chars
-#
-# GTK 2.8 (now allowed)
-#	child_pack_direction
-#	pack_direction
-#	urgency_hint
-#
-# GTK 2.10
-#	image_position
-#   inner_border
diff --git a/util/gnc-vcs-info b/util/gnc-vcs-info
index a24b4be051..0e38e784a3 100755
--- a/util/gnc-vcs-info
+++ b/util/gnc-vcs-info
@@ -10,7 +10,7 @@
 # With -t prints the vcs type that was detected to stdout and exits 0
 #         on success.
 #
-# Exits with errorcode 1 if we're not in an bzr, svn, svk or git checkout
+# Exits with errorcode 1 if we're not in a git work tree
 #
 # Written By:  Derek Atkins <derek at ihtfp.com>
 # Updated By:  Geert Janssens <geert at kobaltwit.be>
@@ -33,9 +33,9 @@ if [ "$BUILDING_FROM_VCS" = "0" -o \
      "$BUILDING_FROM_VCS" = "no" -o \
      "$BUILDING_FROM_VCS" = "false" ]; then
   # Something outside of the Gnucash build system knows that we
-  # are NOT building from svn, svk or git checkout.
+  # are NOT building from a git work tree.
   # We should believe it (needed by packagers that maintain the
-  # packaging code in svn, svk or git too)
+  # packaging code in git too)
   echo "Environment variable BUILDING_FROM_VCS=$BUILDING_FROM_VCS" >&2
   exit 1
 fi
@@ -72,39 +72,7 @@ else
   real_srcdir="$srcdir"
 fi
 
-# Test if this code is an SVN Checkout
-#   If this is an svn checkout we assume you have svnversion!
-if test -d "${real_srcdir}"/.svn
-then
-  # If we're only interested in the vcs type, then we're done here
-  if [ "$request" = "type" ]
-  then
-    echo "svn"
-    exit 0
-  fi
-
-  if [ "$request" = "date" ]
-  then
-    echo $(svn info "$real_srcdir}" | awk '/Last Changed Date/ { print $4 }')
-    exit 0
-  fi
-
-  # svnversion without options returns the most recent revision in the repo
-  # at the time of the last svn update/checkout even if that revision
-  # didn't hold any changes in the current path. Not very useful as a
-  # reference. Better is to ask for the last changed revision with -c.
-  # BUT: -c option for some reason always considers svn working copy
-  # as having mixed sources. We're only interested in the last part so
-  # we strip the beginning revision if it's there.
-  # As a result if your WC really has mixed sources, that will not be
-  # visible in the version number...
-  svn_mixed_version=$(svnversion -c "$real_srcdir")
-  echo ${svn_mixed_version#*:}
-  exit $?
-fi
-
-# If we get here then this is NOT an svn checkout.
-# Maybe it's git?
+# Test if this code is in a git worktree
 real_gitdir="${real_srcdir}"/.git
 if test -d "${real_gitdir}" || test -e "${real_gitdir}"
 then
@@ -145,73 +113,6 @@ then
   else
     exit 1
   fi
-fi
-
-if test -d "${real_srcdir}"/.bzr ;
-then
-  # If we're only interested in the vcs type, then we're done here
-  if [ "$request" = "type" ]
-  then
-    echo "bzr"
-    exit 0
-  fi
-
-  if [ "$request" = "date" ]
-  then
-    # FIXME Don't know how to extract the commit's date from a bzr commit...
-    echo $(date +%Y-%m-%d)
-    exit 0
-  fi
-
-  bzrhead=`(cd "${real_srcdir}"; bzr version-info --custom --template='{revno}\n')`
-  if test $? = 0 ; then
-    echo "$bzrhead";
-    exit 0
-  else
-    exit 1
-  fi
-fi
-
-if test $OSTYPE -a $OSTYPE = "msys";
-then
-  svk_name="svk.bat"
-  svk_cmd="cmd \/c svk"
 else
-  svk_name="svk"
-  svk_cmd="svk"
-fi
-
-# Maybe it's SVK?  First, check if we've got 'svk' in the path.  If not,
-# then exit with an error code of 1..
-which $svk_name >/dev/null 2>&1
-if test $? != 0 ; then exit 1 ; fi
-
-# Okay, we have 'svk'.  Now see if $real_srcdir is an svk checkout
-# Note that the 'echo n' is to protect against having svk installed
-# without having configured the depotmap.
-svkinfo=`echo n | $svk_cmd info "$real_srcdir" 2>&1`
-if test $? != 0 ; then exit 1 ; fi
-
-# If we got here, then $real_srcdir is an svk checkout.
-# If we're only interested in the vcs type, then we're done here
-if [ "$request" = "type" ]
-then
-  echo "svk"
-  exit 0
-fi
-
-if [ "$request" = "date" ]
-then
-  # FIXME Don't know how to extract the commit's date from an svk commit...
-  echo $(date +%Y-%m-%d)
-  exit 0
+  exit 1
 fi
-
-
-# Parse out the revision info, print it out, and then output 0.  Just combine
-# all the revision numbers into a single string by combining them
-# with periods.
-svkinfo=`$svk_cmd info "$real_srcdir" | grep Rev | head -5 | sed -e 's/^.* \([0-9:]*\)$/\1/'`
-echo $svkinfo | sed -e 's/ /./g'
-
-exit 0
diff --git a/util/src-count/count.dat b/util/src-count/count.dat
deleted file mode 100644
index 05f24c0ec2..0000000000
--- a/util/src-count/count.dat
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# file: count.dat
-#
-# Raw data for the number of KLOC of code in gnucash,
-# as a function of date.  Taken from the web page
-# https://www.gnucash.org/en/sizing.phtml
-# format: day/month/year <tab> KLOC
-# plot this by saying "gnuplot count.gplot" at the command line
-#
-# xacc-0.9 Sept 97
-1/9/1997	8.8
-# xacc-0.9w Dec 97
-1/12/1997	16.2
-# xacc-1.0.17 Feb 98
-1/2/1998	18.3
-# gnucash-1.1.15 Aug 98
-1/8/1998	34.7
-# gnucash-1.2.2 Aug 99
-1/8/1999	39.0
-# gnucash-1.3.6 April 2000
-1/4/2000	95.1
-# gnucash-1.4.6 Sept 2000
-# 1/9/2000	101.9
-# gnucash-1.4.12 April 2001
-# 1/4/2001	108.2
-# gnucash-1.5.2 Sept 2000
-1/9/2000	114.2
-# gnucash-1.6.0 June 2001
-1/6/2001	193.9
-# gnucash-1.7.2 November 2002
-1/11/2002	297.1
-# gnucash-1.8.4 June 2003
-1/6/2003	385.5
diff --git a/util/src-count/count.gplot b/util/src-count/count.gplot
deleted file mode 100644
index 7c8816d335..0000000000
--- a/util/src-count/count.gplot
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# file: count.gplot
-# function: plot the number of lines of code in gnucash as function of date
-# To generate the graph, say "gnuplot count.gplot" at the command line
-#
-# history: created by Linas Vepstas July 2004
-#
-# set term x11
-# set term pbm
-# set term gif size 400,300
-set term pbm medium color
-set out 'count.png'
-set data style linespoints 
-set xdata time
-set timefmt "%d/%m/%Y"
-# set format x "%m/%y"
-set format x "%Y"
-set xrange ["01/09/1997":"01/12/2003"]
-set title "Number of Lines of code in GnuCash"
-set key right
-set xlabel "Year"
-set logscale y
-set ylabel "KLOC\nLogarithmic Scale"
-plot "count.dat" using 1:2	title "kloc"
-
-# pause 1000
diff --git a/util/src-count/count.sh b/util/src-count/count.sh
deleted file mode 100644
index a6a18922c4..0000000000
--- a/util/src-count/count.sh
+++ /dev/null
@@ -1,139 +0,0 @@
-#! /bin/sh
-#
-# Simple stupid utility to count lines of code
-# The output may deceive you, remember to subtract 1 from file count
-
-#
-# FIXME This script is very out of date. It doesn't count a number
-#       of source directories (such as gnome, ledger, engine,...)
-#
-
-SRC_DIR=$(dirname $0)/../../src
-
-cd $SRC_DIR
-
-echo 
-echo
-echo "app utils:"
-wc $(find app-utils core-utils calculation gnc-module tax \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort )
-wc $(find app-utils core-utils calculation gnc-module tax \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort ) | wc
-
-echo
-echo
-echo "import export:"
-wc $(find import-export \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort )
-wc $(find import-export \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort ) | wc
-
-echo
-echo
-echo "reports:"
-wc $(find report \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort )
-wc $(find report \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort ) | wc
-
-echo
-echo
-echo "scheme misc:"
-wc $(find scm \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort )
-wc $(find scm \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort ) |wc
-
-echo
-echo
-echo "Business:"
-wc $(find business \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort )
-wc $(find business \
-            \( -regex '.*test[^/]*' -prune \) -o \
-            \( -path '*.svn' -prune \)        -o \
-            \( \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort ) | wc
-
-echo
-echo
-echo "test:"
-wc $(find . \( -path '*.svn' -prune \)        -o \
-            \( -regex '.*/test.*/.*'      -a \
-               \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort )
-wc $(find . \( -path '*.svn' -prune \)        -o \
-            \( -regex '.*/test.*/.*'      -a \
-               \( -name '*.c'         -o \
-                  -name '*.h'         -o \
-                  -name '*.scm' \)        -a \
-               -print \) | sort ) | wc
-
-echo
-echo
-echo "internal docs"
-wc $(find .. \( -path '*.svn' -prune \) -o \
-            \( -name 'README*'             -o \
-               -name '*.txt'               -o \
-               -name '*.html'              -o \
-               -name '*.texinfo'           -o \
-               -name '*.dtd' \)                -a \
-             -print | sort )
-wc $(find .. \( -path '*.svn' -prune \) -o \
-            \( -name 'README*'             -o \
-               -name '*.txt'               -o \
-               -name '*.html'              -o \
-               -name '*.texinfo'           -o \
-               -name '*.dtd' \)                -a \
-             -print | sort ) | wc
-
-cd -
diff --git a/util/svnlog2ul/getlastcommit.xslt b/util/svnlog2ul/getlastcommit.xslt
deleted file mode 100644
index ec37f19e10..0000000000
--- a/util/svnlog2ul/getlastcommit.xslt
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!DOCTYPE xsl:stylesheet [
- <!ENTITY tab "	">
- <!ENTITY newl "
">
- <!ENTITY space " ">
-]>
-
-<xsl:stylesheet
-  version="1.0"
-  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  >
-
- <xsl:output
-   method="text"
-   encoding="utf-8"
-   media-type="text/plain"
-   omit-xml-declaration="yes"
-   standalone="yes"
-   indent="no" />
-
-  <xsl:template match="/">
-    <xsl:value-of select="info/entry/commit/attribute::revision" />
-  </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
diff --git a/util/svnlog2ul/log2ul.xslt b/util/svnlog2ul/log2ul.xslt
deleted file mode 100644
index 3e35f3ffbc..0000000000
--- a/util/svnlog2ul/log2ul.xslt
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!DOCTYPE xsl:stylesheet [
- <!ENTITY tab "	">
- <!ENTITY newl "
">
- <!ENTITY space " ">
-]>
-
-<xsl:stylesheet
-  version="1.0"
-  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  >
-  <xsl:output method="xml"
-              doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
-              doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-              indent="yes"/>
-
-  <xsl:template match="/">
-<html>
-<head>
-</head>
-<body>
-  <ul>
-    <xsl:apply-templates/>
-  </ul>
-</body>
-</html>
-  </xsl:template>
-
-  <xsl:template match="logentry">
-<li>
-<xsl:value-of select="msg" />
-</li>
-  </xsl:template>
-</xsl:stylesheet>
diff --git a/util/svnlog2ul/svnlog2ul.sh b/util/svnlog2ul/svnlog2ul.sh
deleted file mode 100755
index 6b4418c9f5..0000000000
--- a/util/svnlog2ul/svnlog2ul.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#! /bin/bash
-#
-# svnlog2ul.sh <prevrelease> <newrelease>
-#
-# This script will extract all the svn commit messages from the
-# repository between two releases or from a previous release and the
-# current checkout's HEAD.
-# The result will be printed on standard out as a
-# html unordered list ("bulleted list").
-#
-# Parameters:
-#
-#    <prevrelease> : the svn tag for the release to start
-#                    the commit message search
-#    <newrelease>  : the svn tag for the release to end
-#                    the commit message search
-#
-# The search will return all commit messages between
-# <prevrelease> and <newrelease>
-#
-# Examples:
-# This will compile the changes between two tagged releases:
-#    svnlog2ul.sh 2.3.7 2.3.8
-# This will compile the changes between the tagged release and the
-# current HEAD in checked out working copy:
-#    svnlog2ul.sh 2.4.7
-
-oldrelease=$1
-newrelease=$2
-
-dir=`dirname "$0"`
-
-oldrev=$(svn info --xml http://svn.gnucash.org/repo/gnucash/tags/$oldrelease | xsltproc "$dir/getlastcommit.xslt" -)
-if [ "x$2" == "x" ]
-then
-  newrev=$(svn info -r HEAD --xml | xsltproc "$dir/getlastcommit.xslt" -)
-  svn log -r$newrev:$oldrev --xml | xsltproc "$dir/log2ul.xslt" -
-else
-  newrev=$(svn info --xml http://svn.gnucash.org/repo/gnucash/tags/$newrelease | xsltproc "$dir/getlastcommit.xslt" -)
-  svn log -r$newrev:$oldrev --xml http://svn.gnucash.org/repo/gnucash/tags/$newrelease | xsltproc "$dir/log2ul.xslt" -
-fi
-

commit bd6e79b4d665b0616a80a2b084b81102bdf7cb6d
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Jun 4 09:27:14 2024 +0200

    Rework version-info rules to allow building from github downloaded zip archives

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cbbff4eb99..6446d06954 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,14 +154,23 @@ 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 install git or set GIT_EXECUTABLE.")
   endif()
+endif()
+
+# Determine whether or not we have to generate a gnc-vcs-info.h file
+# Distribution tarballs have this file in the source tree
+# Git checkouts or zipfiles downloaded straight from github won't have it
+# and require us to build it.
+if (BUILDING_FROM_VCS OR NOT EXISTS "${CMAKE_SOURCE_DIR}/libgnucash/core-utilsgnc-vcs-info.h")
   set(VCS_INFO_BASE_DIR ${CMAKE_BINARY_DIR})
+  set(GENERATE_VCS_INFO "Yes")
 else()
   set(VCS_INFO_BASE_DIR ${CMAKE_SOURCE_DIR})
+  set(GENERATE_VCS_INFO "No")
 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)
+# As the file's path is needed by several other build rules, we already define
+# that here. The actual build rules (if needed) are in libgnucash/core-utils.
+set(VCS_INFO_FILE ${VCS_INFO_BASE_DIR}/libgnucash/core-utils/gnc-vcs-info.h CACHE STRING "path to gnc-vcs-info.h file")
+
 
 if (WIN32)
   # Help Windows find the various dependencies. We assume here that the standard advice for building
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 3d460e2f79..bb2f449514 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -8,7 +8,15 @@ if (APPLE)
 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
-    configure-totd.cmake git2version-info.cmake version-info2env.cmake
+set_dist_list(cmake_DIST
+  CMakeLists.txt
+  README_CMAKE.txt
+  cmake_uninstall.cmake.in
+  configure-appdata.cmake
+  configure-gnucash-desktop.cmake
+  configure-manpage.cmake
+  configure-totd.cmake
+  git2version-info.cmake
+  no-vcs2version-info.cmake
+  version-info2env.cmake
 )
diff --git a/cmake/no-vcs2version-info.cmake b/cmake/no-vcs2version-info.cmake
new file mode 100644
index 0000000000..6d99fdece7
--- /dev/null
+++ b/cmake/no-vcs2version-info.cmake
@@ -0,0 +1,19 @@
+# Create the gnc-vcs-info.h file starting from a source directory that's
+# - not a git working directory
+# - not extracted from a distribution tarball
+# It currently sets four parameters
+# - GNC_VCS_REV
+# - GNC_VCS_REV_DATE
+# - GNC_VCS_REV_YEAR
+# - GNC_VCS_REV_Y_M
+# The following environment variables are used and should be properly set
+# by the calling code:
+# - PROJECT_VERSION
+# - SRC (full path to gnc-vcs-info.h.in)
+# - DST (full path to destination for gnc-vcs-info.h)
+
+set (GNC_VCS_REV "${PROJECT_VERSION}-unknown-commit")
+string (TIMESTAMP GNC_VCS_REV_DATE "%Y-%m-%d")
+string(SUBSTRING ${GNC_VCS_REV_DATE} 0 4 GNC_VCS_REV_YEAR)
+string(SUBSTRING ${GNC_VCS_REV_DATE} 0 7 GNC_VCS_REV_Y_M)
+configure_file(${SRC} ${DST} @ONLY)
diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt
index 67b9b2113a..b1eaed4a91 100644
--- a/gnucash/gnome/CMakeLists.txt
+++ b/gnucash/gnome/CMakeLists.txt
@@ -175,7 +175,7 @@ install(TARGETS gnc-gnome
 # No headers to install
 
 set (GNC_APPDATA_IN ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml.in)
-if (NOT BUILDING_FROM_VCS)
+if (NOT GENERATE_VCS_INFO)
     # We're building from a dist tarball.
     # As a convenience to packagers we have included a pretranslated
     # intermediate appdata file in the dist tarball.
@@ -255,7 +255,7 @@ set_local_dist(gnome_DIST_local
         CMakeLists.txt gnome.i gnucash.appdata.xml.in.in gnucash.desktop.in.in
         gnucash.releases.xml ${gnc_gnome_noinst_HEADERS} ${gnc_gnome_SOURCES} ${gnome_SCHEME})
 
-dist_add_generated(${BUILDING_FROM_VCS} gnucash.appdata.xml.in)
+dist_add_generated(${GENERATE_VCS_INFO} gnucash.appdata.xml.in)
 add_dependencies(gnucash-appdata dist-gnucash-gnome-gnucash-appdata-xml-in)
 
 set(gnome_DIST ${gnome_DIST_local} ${test_gnome_DIST} PARENT_SCOPE)
diff --git a/libgnucash/core-utils/CMakeLists.txt b/libgnucash/core-utils/CMakeLists.txt
index 773eb875dc..fc9e402abe 100644
--- a/libgnucash/core-utils/CMakeLists.txt
+++ b/libgnucash/core-utils/CMakeLists.txt
@@ -87,38 +87,41 @@ set(localedir "${CMAKE_INSTALL_FULL_DATAROOTDIR}/locale")
 configure_file(gncla-dir.h.in gncla-dir.h)
 
 
-### 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.
-# The meta-cmake gymnastics here come from https://cmake.org/pipermail/cmake/2010-July/038015.html
-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-info.h file")
-
-if (BUILDING_FROM_VCS)
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+### Build rules for gnc-vcs-info.h
+# When building from a distribution tarball simply use the one
+# found in the source tree.
+# When building from a git working directory extract the neede information from git.
+# Otherwise work from the PROJECT_VERSION variable and today's date, but annotate
+# the version info to indicate it's inaccurate.
+
+if (GENERATE_VCS_INFO)
+  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
 "/* Autogenerated. Do not change. */
 #define GNC_VCS_REV \"@GNC_VCS_REV@\"
 #define GNC_VCS_REV_DATE \"@GNC_VCS_REV_DATE@\"
 #define GNC_VCS_REV_YEAR \"@GNC_VCS_REV_YEAR@\"
-#define GNC_VCS_REV_Y_M \"@GNC_VCS_REV_Y_M@\"
-")
-
-add_custom_target(gnc-vcs-info ALL
-    BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
-    COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
-                             -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
-                             -D SRC_DIR=${CMAKE_SOURCE_DIR}
-                             -D SHELL="${SHELL}"
-                             -P ${CMAKE_SOURCE_DIR}/cmake/git2version-info.cmake
-)
+#define GNC_VCS_REV_Y_M \"@GNC_VCS_REV_Y_M@\"")
+
+  if (BUILDING_FROM_VCS)
+    add_custom_target(gnc-vcs-info ALL
+      BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+      COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+                               -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+                               -D SRC_DIR=${CMAKE_SOURCE_DIR}
+                               -D SHELL="${SHELL}"
+                               -P ${CMAKE_SOURCE_DIR}/cmake/git2version-info.cmake)
+  else()
+    add_custom_target(gnc-vcs-info ALL
+      BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+      COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+                               -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+                               -D PROJECT_VERSION=${PROJECT_VERSION}
+                               -P ${CMAKE_SOURCE_DIR}/cmake/no-vcs2version-info.cmake)
+  endif()
 else()
   add_custom_target(gnc-vcs-info DEPENDS ${VCS_INFO_FILE})
 endif()
-dist_add_generated (${BUILDING_FROM_VCS} gnc-vcs-info.h)
+dist_add_generated (${GENERATE_VCS_INFO} gnc-vcs-info.h)
 
 # Dist files
 set_local_dist(core_utils_DIST_local

commit 3f8b97bb2e0ca13f0656f3a6eda946f60f9a4b15
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Jun 4 09:26:00 2024 +0200

    Improve error messages

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33119ac3bd..cbbff4eb99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -134,7 +134,7 @@ else()
   if (BASH)
     set(SHELL ${BASH})
   else()
-    message(SEND_ERROR "Can't find a suitable bash executable. Please set GNC_SHELL.")
+    message(SEND_ERROR "Can't find a suitable bash executable. Please install bash or set GNC_SHELL.")
   endif()
 endif()
 
@@ -152,7 +152,7 @@ if (GNC_VCS_INFO_RESULT EQUAL 0)
   # if building from VCS, we need git
   find_package(Git)
   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.")
+    message(SEND_ERROR "Looks like we're building from version control, but can't find git executable. Please install git or set GIT_EXECUTABLE.")
   endif()
   set(VCS_INFO_BASE_DIR ${CMAKE_BINARY_DIR})
 else()



Summary of changes:
 .gitignore                           |   1 -
 CMakeLists.txt                       |  21 ++++--
 cmake/CMakeLists.txt                 |  14 +++-
 cmake/no-vcs2version-info.cmake      |  19 +++++
 gnucash/gnome/CMakeLists.txt         |   4 +-
 gnucash/gnucash-core-app.cpp         |   2 +-
 libgnucash/core-utils/CMakeLists.txt |  53 ++++++-------
 util/git-backport.sh                 |  30 --------
 util/glade-fixup                     |  38 ----------
 util/gnc-vcs-info                    | 109 ++-------------------------
 util/src-count/count.dat             |  33 ---------
 util/src-count/count.gplot           |  26 -------
 util/src-count/count.sh              | 139 -----------------------------------
 util/svnlog2ul/getlastcommit.xslt    |  25 -------
 util/svnlog2ul/log2ul.xslt           |  35 ---------
 util/svnlog2ul/svnlog2ul.sh          |  42 -----------
 16 files changed, 81 insertions(+), 510 deletions(-)
 create mode 100644 cmake/no-vcs2version-info.cmake
 delete mode 100755 util/git-backport.sh
 delete mode 100755 util/glade-fixup
 delete mode 100644 util/src-count/count.dat
 delete mode 100644 util/src-count/count.gplot
 delete mode 100644 util/src-count/count.sh
 delete mode 100644 util/svnlog2ul/getlastcommit.xslt
 delete mode 100644 util/svnlog2ul/log2ul.xslt
 delete mode 100755 util/svnlog2ul/svnlog2ul.sh



More information about the gnucash-changes mailing list