On 3/6/24 12:26 AM, Collin Funk wrote:
> gnulib-tool.py --create-testdir --dir test-python readme-release
> gnulib-tool --create-testdir --dir test-shell readme-release
> git diff --no-index test-python/gltests/Makefile.am 
> test-shell/gltests/Makefile.am

While running that I noticed this in gltests/Makefile.am:

-LDADD = ../gllib/libgnu.a libtests.a ../gllib/libgnu.a
+LDADD = ../gllib/libgnu.a

I've copied the logic for this from gnulib-tool and the attached patch
fixes this.

Also I've just noticed that GLImport has an exit() call that prevents
the advice for headers and such from being printed [1]. It is also
documented in gnulib-tool.py.TODO [2]. Is there a reason for this? The
git history doesn't seem to say much and it worked fine when I tried
it _once_. Just seems sort of strange LOL

[1] https://git.savannah.gnu.org/cgit/gnulib.git/tree/pygnulib/GLImport.py#n1337
[2] https://git.savannah.gnu.org/cgit/gnulib.git/tree/gnulib-tool.py.TODO#n29

Collin
From 6d2962ced49af6695e33365e78601988a5264979 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Wed, 6 Mar 2024 02:44:39 -0800
Subject: [PATCH 5/5] gnulib-tool.py: Fix value of LDADD for libtests.

* pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Fix value of LDADD
to match gnulib-tool.
---
 ChangeLog            |  6 ++++++
 pygnulib/GLEmiter.py | 15 ++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 44e86f7f52..076ad9c3ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-06  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Fix value of LDADD for libtests.
+	* pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Fix value of LDADD
+	to match gnulib-tool.
+
 2024-03-06  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Follow gnulib-tool changes, part 44.
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index 8316d0af5c..e0df1373c6 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -1154,8 +1154,6 @@ AC_DEFUN([%V1%_LIBSOURCES], [
         emit += '  -I%s/%s -I$(srcdir)/%s/%s\n' % (testsbase_inverse, sourcebase, testsbase_inverse, sourcebase)
         emit += '\n'
 
-        ldadd_before = ''
-        ldadd_after = ''
         if libtests:
             # All test programs need to be linked with libtests.a.
             # It needs to be passed to the linker before ${libname}.${libext},
@@ -1166,13 +1164,12 @@ AC_DEFUN([%V1%_LIBSOURCES], [
             # voluntarily omitted).
             # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it
             # does not matter.
-            ldadd_before = ' libtests.a'
-            ldadd_after = ' libtests.a $(LIBTESTS_LIBDEPS)'
-        emit += 'LDADD =%s %s/%s/%s.%s libtests.a %s/%s/%s.%s%s\n\n' \
-                % (ldadd_before,
-                   testsbase_inverse, sourcebase, libname, libext,
-                   testsbase_inverse, sourcebase, libname, libext,
-                   ldadd_after)
+            emit += ("LDADD = libtests.a %s/%s/%s.%s libtests.a %s/%s/%s.%s libtests.a $(LIBTESTS_LIBDEPS)\n"
+                     % (testsbase_inverse, sourcebase, libname, libext, testsbase_inverse, sourcebase, libname, libext))
+        else:
+            emit += ("LDADD = %s/%s/%s.%s\n"
+                     % (testsbase_inverse, sourcebase, libname, libext))
+        emit += '\n'
         if libtests:
             emit += 'libtests_a_SOURCES =\n'
             # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
-- 
2.44.0

Reply via email to