331.7. gnucash-5.17
Double-entry accounting — personal and small-business books, invoices, reports
| Version | 5.17, release 1 |
| Shelf | office — Office suites, word processors, spreadsheets, presentations, accounting and finance, and office-format import libraries |
| Phase | 44_apps (Applications), 316 of 422 in build order |
| Licence | GPL-2.0-or-later AND (GPL-2.0-only OR GPL-3.0-only) |
| Homepage | https://www.gnucash.org/ |
| Build time | 11.7 SBU |
| Installed size | 51.2 MiB in 1126 files |
| Recipe | ports/core/office/gnucash/kpkgbuild |
About
GnuCash is a double-entry accounting program for personal and small-business books: accounts, transactions, scheduled entries, invoices, customers and vendors, and reports. Its engine is a C and C++ library with Scheme (guile) on top, the interface is GTK 3, and the reports are HTML drawn by webkitgtk through its 4.1 API. A book here is kept as an XML file.
Sources
gnucash-5.17.tar.bz2(14.9 MiB)
sha2563d18a88f5b8230f01e04c2d2d73bf95e7dcd3bf8d8cee6ffa54bb24dee58b85f
upstream: https://github.com/Gnucash/gnucash/releases/download/5.17/gnucash-5.17.tar.bz2
archive copy: sources-3/office--gnucash-5.17.tar.bz2
Dependencies
Depends on: cmake, ninja, pkgconf, perl, swig, gettext, glib, gtk3, webkitgtk, libxml2, libxslt, zlib, icu, boost, guile, libsecret, libofx, gtest.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
install-rpath.patch— drops${CMAKE_INSTALL_FULL_LIBDIR}from the run path GnuCash gives its installed programs and libraries, keeping only/usr/lib/gnucash, where its own modules are. The loader searches/usr/libanyway, and the package lint reports a plain/usr/librun-path entry.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install gnucash'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/office/gnucash.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/office/gnucash
echo '3d18a88f5b8230f01e04c2d2d73bf95e7dcd3bf8d8cee6ffa54bb24dee58b85f gnucash-5.17.tar.bz2' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/gnucash
SRC=$SRC_ROOT/gnucash-5.17
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gnucash-5.17.tar.bz2 -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 --no-backup-if-mismatch -i "$PORT_SRC/install-rpath.patch"
export CFLAGS="$CFLAGS -Wno-error"
export CXXFLAGS="$CXXFLAGS -Wno-error"
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=ON \
-D WITH_GNUCASH=ON \
-D WITH_SQL=OFF \
-D WITH_AQBANKING=OFF \
-D WITH_OFX=ON \
-D WITH_PYTHON=OFF \
-D DISABLE_NLS=ON \
-D COMPILE_GSCHEMAS=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
chmod 755 "$PKG/usr/bin/gnucash-valgrind"
The switches, and why each is set:
CFLAGS="$CFLAGS -Wno-error"— with the same forCXXFLAGS. GnuCash’sCMakeLists.txtputs-Werrorin front of the compiler flags on every Unix build, so a warning that a newer compiler adds stops the build.-Wno-errorcomes later on the command line and wins.-D WITH_GNUCASH=ON,-D BUILD_SHARED_LIBS=ON— Build the whole program, not only the engine library, with shared libraries. Both are upstream’s settings, written out.-D WITH_SQL=OFF— No SQLite, MySQL or PostgreSQL backends for the book. They go through libdbi, which is not a port, so books are XML files.-D WITH_AQBANKING=OFF— No AqBanking, which provides online banking (HBCI/FinTS) and several file import formats. AqBanking and its Gwenhywfar library are not ports.-D WITH_OFX=ON— OFX statement import through libofx. QIF and CSV import are built in regardless.-D WITH_PYTHON=OFF— No Python bindings or Python plugin; upstream’s default.-D DISABLE_NLS=ON— No translations. The packager removes every non-English catalogue in any case (see Size and language policy), so the switch only saves build time.-D COMPILE_GSCHEMAS=OFF— Do not runglib-compile-schemasat install time. The GSettings schema cache is shared by every package, and kpkg rebuilds it after an install as one of its shared indexes.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/gnucash, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf gnucash-5.17-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/gnucash, and runs the triggers its paths call for.
Contents
Installed programs: finance-quote-wrapper, gnc-fq-update, gnucash, gnucash-cli, gnucash-valgrind.
Installed libraries: libgnc-app-utils.so, libgnc-backend-xml-utils.so, libgnc-core-utils.so, libgnc-engine.so, libgnc-expressions-guile.so, libgnc-expressions.so, libgnc-generic-import.so, libgnc-gnome.so, libgnc-locale-tax.so, libgnc-module.so, libgnucash-guile.so.
Installed directories: /etc/gnucash, /usr/include/gnucash, /usr/lib/gnucash, /usr/lib/guile/3.0/site-ccache, /usr/share/doc/gnucash, /usr/share/gnucash, /usr/share/guile/site, /usr/share/licenses/gnucash.
Short descriptions
finance-quote-wrapper |
internal interface between gnucash and Finance::Quote |
gnucash |
personal finance manager |
gnucash-cli |
command line tool to go with GnuCash |
Notes
The CMake configuration stops with GTEST not found unless GoogleTest (gtest) is installed, whether or not the tests are run, so it is a dependency.
gnucash-valgrind, a script that starts GnuCash under Valgrind, is installed by an install(FILES ...) rule, which gives it mode 644; build.sh makes it executable.
Online price quotes (the Price Database’s Get Quotes button and gnucash-cli --quotes) run finance-quote-wrapper, a Perl script that needs the Finance::Quote and JSON::Parse modules, neither of which is a port. GnuCash itself starts; a quote fetch reports that Perl is missing those modules and fetches nothing.