summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-office')
-rw-r--r--app-office/gnucash/files/gnucash-5.10-guile-load-path.patch96
-rw-r--r--app-office/gnucash/gnucash-5.10.ebuild33
2 files changed, 120 insertions, 9 deletions
diff --git a/app-office/gnucash/files/gnucash-5.10-guile-load-path.patch b/app-office/gnucash/files/gnucash-5.10-guile-load-path.patch
new file mode 100644
index 000000000000..0a488817f547
--- /dev/null
+++ b/app-office/gnucash/files/gnucash-5.10-guile-load-path.patch
@@ -0,0 +1,96 @@
+From 59c0a848aeab5a600f40962b359395e4dca57537 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Thu, 26 Dec 2024 09:55:15 +0000
+Subject: [PATCH] Don't use installed copy of gnucash for build or tests
+
+Per https://www.gnu.org/software/guile/manual/html_node/Foreign-Libraries.html,
+newer guile (>= 3.0.6) will respect GUILE_EXTENSIONS_PATH when looking up paths for
+`dlopen` for `load-extension` -> `load-foreign-library`. Older guiles will use
+`LTDL_LIBRARY_PATH` instead.
+
+Without this set, the system paths are checked instead (maybe falling back
+to another variable if not found on the system, unclear), and we end up
+with build failures when we try to mix system and just-built gnucash (this
+is also obviously a problem for testing as well).
+
+For tests, we additionally have to do a "fake install" in ${BUILD_DIR}/whatever
+and we set the path to that in the ebuild with GENTOO_TEMPORARY_TEST_INSTALLDIR.
+
+https://www.gnu.org/software/guile/manual/html_node/Load-Paths.html and
+https://www.gnu.org/software/guile/manual/html_node/Environment-Variables.html were
+also a lot of help.
+
+(When testing w/ guile-2.2 briefly, it didn't seem that we needed
+to set LTDL_LIBRARY_PATH, but someone can add that if it turns out to be
+needed, or I may later.)
+
+(With regard to GUILE_AUTO_COMPILE=0, dropped that as it doesn't seem
+necessary. Plan is to also add GUILE_AUTO_COMPILE=fresh to the eclass,
+am discussing it w/ Arsen.)
+
+Bug: https://bugs.gnucash.org/show_bug.cgi?id=799159
+Bug: https://bugs.gentoo.org/359033
+Bug: https://bugs.gentoo.org/371264
+Bug: https://bugs.gentoo.org/734286
+Bug: https://bugs.gentoo.org/946927
+Closes: https://bugs.gentoo.org/941426
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ common/cmake_modules/GncAddSchemeTargets.cmake | 2 ++
+ common/cmake_modules/GncAddTest.cmake | 6 ++++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/common/cmake_modules/GncAddSchemeTargets.cmake b/common/cmake_modules/GncAddSchemeTargets.cmake
+index 9a038de..bab89bf 100644
+--- a/common/cmake_modules/GncAddSchemeTargets.cmake
++++ b/common/cmake_modules/GncAddSchemeTargets.cmake
+@@ -253,6 +253,7 @@ function(gnc_add_scheme_targets _TARGET)
+ make_win32_path_list(LIBRARY_PATH)
+ else()
+ set (LIBRARY_PATH "LD_LIBRARY_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:$ENV{LD_LIBRARY_PATH}")
++ set (GUILE_EXTENSIONS_PATH "GUILE_EXTENSIONS_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:$ENV{GUILE_EXTENSIONS_PATH}")
+ endif()
+ if (APPLE)
+ set (LIBRARY_PATH "DYLD_LIBRARY_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:$ENV{DYLD_LIBRARY_PATH}")
+@@ -281,6 +282,7 @@ function(gnc_add_scheme_targets _TARGET)
+ #We quote the arguments to stop CMake stripping the path separators.
+ set (GUILE_ENV
+ "${LIBRARY_PATH}"
++ "${GUILE_EXTENSIONS_PATH}"
+ "GNC_UNINSTALLED=YES"
+ "GNC_BUILDDIR=${CMAKE_BINARY_DIR}"
+ "GUILE_LOAD_PATH=${_GUILE_LOAD_PATH}"
+diff --git a/common/cmake_modules/GncAddTest.cmake b/common/cmake_modules/GncAddTest.cmake
+index ce12e8b..9ab2cc2 100644
+--- a/common/cmake_modules/GncAddTest.cmake
++++ b/common/cmake_modules/GncAddTest.cmake
+@@ -13,6 +13,7 @@ function(get_guile_env)
+ endif()
+ if (UNIX)
+ list(APPEND env "LD_LIBRARY_PATH=${_GNC_MODULE_PATH}:$ENV{LD_LIBRARY_PATH}")
++ list(APPEND env "GUILE_EXTENSIONS_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:$ENV{GUILE_EXTENSIONS_PATH}")
+ endif()
+ if (MINGW64)
+ set(fpath "")
+@@ -32,6 +33,8 @@ function(get_guile_env)
+ list(APPEND env "GUILE=${GUILE_EXECUTABLE}")
+
+ set(guile_load_paths "")
++ list(APPEND guile_load_paths "$ENV{GENTOO_TEMPORARY_TEST_INSTALLDIR}/${GUILE_REL_SITEDIR}")
++ list(APPEND guile_load_paths "$ENV{GENTOO_TEMPORARY_TEST_INSTALLDIR}/${GUILE_REL_SITEDIR}/gnucash/deprecated") # Path to gnucash' deprecated modules
+ list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}")
+ list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/deprecated") # Path to gnucash' deprecated modules
+ if (GUILE_COVERAGE)
+@@ -46,6 +49,9 @@ function(get_guile_env)
+ set(guile_load_path "${guile_load_paths}")
+
+ set(guile_load_compiled_paths "")
++ list(APPEND guile_load_compiled_paths "$ENV{GENTOO_TEMPORARY_TEST_INSTALLDIR}/${GUILE_REL_SITECCACHEDIR}")
++ list(APPEND guile_load_compiled_paths "$ENV{GENTOO_TEMPORARY_TEST_INSTALLDIR}/${GUILE_REL_SITECCACHEDIR}/gnucash/deprecated")
++ list(APPEND guile_load_compiled_paths "$ENV{GENTOO_TEMPORARY_TEST_INSTALLDIR}/${GUILE_REL_SITECCACHEDIR}/tests")
+ list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
+ list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}/gnucash/deprecated")
+ list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}/tests")
+--
+2.47.1
+
diff --git a/app-office/gnucash/gnucash-5.10.ebuild b/app-office/gnucash/gnucash-5.10.ebuild
index bd528c080bdd..f258c56acd5f 100644
--- a/app-office/gnucash/gnucash-5.10.ebuild
+++ b/app-office/gnucash/gnucash-5.10.ebuild
@@ -18,12 +18,11 @@ LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~riscv ~x86"
IUSE="aqbanking debug doc examples gnome-keyring +gui mysql nls ofx postgres python quotes smartcard sqlite test"
-
-# Currently restricting due to the following:
-# https://bugs.gnucash.org/show_bug.cgi?id=799159#c1
-#
-# Tests can be run but must first unmerge any existing GnuCash installation.
-RESTRICT="test"
+# Tests were previously restricted because guile would try to use installed,
+# not just-built modules. See https://bugs.gnucash.org/show_bug.cgi?id=799159#c1.
+# TODO: as of 5.10, the ebuild should handle this OK. If no issues come up,
+# need to forward those findings (and tidy up the patch for) upstream.
+RESTRICT="!test? ( test )"
# Examples doesn't build unless GUI is also built
REQUIRED_USE="
@@ -119,6 +118,7 @@ PATCHES=(
# https://bugs.gentoo.org/893676
"${FILESDIR}/${PN}-5.0-webkit2gtk-4.1.patch"
"${FILESDIR}/${P}-import-qif.patch"
+ "${FILESDIR}/${PN}-5.10-guile-load-path.patch"
)
pkg_setup() {
@@ -149,13 +149,16 @@ src_prepare() {
libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
libgnucash/backend/xml/test/test-xml-pricedb.cpp
)
+ local x
for x in "${fixtestfiles[@]}"; do
sed -i -e "s|\"/tmp/|\"${T}/|g" "${S}/${x}" || die "sed of ${S}/${x} failed"
done
}
src_configure() {
- export GUILE_AUTO_COMPILE=0
+ # Used in src_test but the value has to be available at `cmake`
+ # generation time.
+ export GENTOO_TEMPORARY_TEST_INSTALLDIR="${BUILD_DIR}/test_install"
local sql_on_off="OFF"
if use mysql || use postgres || use sqlite ; then
@@ -197,8 +200,20 @@ src_test() {
fi
cd "${BUILD_DIR}" || die "Failed to enter ${BUILD_DIR}"
- XDG_DATA_HOME="${T}/$(whoami)" eninja check
- cmake_src_test
+
+ # We need e.g. `options.scm` to be available for loading by tests
+ # and the compiled `options.go` isn't enough. Do a temporary install
+ # for the benefit of the testsuite.
+ DESTDIR="${GENTOO_TEMPORARY_TEST_INSTALLDIR}" cmake_build install
+ # This is needed for `load-path` to be correct, as it lacks `/usr` in there.
+ local dir
+ for dir in bin include "$(get_libdir)" share ; do
+ ln -s "${GENTOO_TEMPORARY_TEST_INSTALLDIR}/usr/${dir}" "${GENTOO_TEMPORARY_TEST_INSTALLDIR}/${dir}" || die
+ done
+
+ # Avoid cmake_src_test as we don't get the test binaries built first
+ # and get various failures as a result. Copy what upstream do in CI.
+ eninja check
}
src_install() {