Bug#1024721: [pkg-lua-devel] Bug#1024721: dh-lua: stop using libtool-bin

2023-01-05 Thread Helmut Grohne
Hi Sergei,

On Thu, Jan 05, 2023 at 03:26:14PM +0300, Sergei Golovan wrote:
> Sorry for a delay.

Thank you for following anyway and more for this level of detail!

> I support the idea of dropping the libtool-bin dependency for dh-lua.

Thank you!

> As far as I can see, the common problem with the patch is that it picks the
> CFLAGS and LDFLAGS environment variables (created by the make tool
> from CLIB_CFLAGS and CLIB_LDFLAGS, which are set in the dh-lib.conf).
> 
> These variables are used in an additional call of dh_auto_configure
> which is necessary
> to generate the libtool binary.
> 
> But are these variables necessary in this dh_auto_configure call? Maybe we can
> just clear them before the call?
> 
> I've tried to use
> $(H)dh_auto_configure --buildsystem=autoconf
> --sourcedirectory=$(LBTL_DIR) -- "CFLAGS='' LDFLAGS=''
> LDFLAGS_STATIC=''
> and got almost all the broken builds succeed (the nested
> dh_auto_configure sees the cleared variables, after that the newly
> created
> libtool builds the library just fine). One exception is hamlib. It
> remains broken, I can't figure out what's wrong.

I agree with this adaption. The /usr/bin/libtool from libtool-bin does
not pick up these flags either, so they are inserted elsewhere if
needed. Skipping them here avoids using those flags twice.

> Unfortunately, hamlib can't be fixed so easily. Something remains wrong.

hamlib is a relatively simple matter. It happens to use /usr/bin/libtool
for other things and was relying on dh-lua having a dependency on
libtool-bin. Now that dh-lua drops it, hamlib needs to gain it directly.
Once added, it builds successfully.

Of course, this approach goes against the original goal of getting rid
of libtool-bin, but it lets us split the problem into ever shrinking
pieces. dh-lua certainly is the biggest piece left.

> After adding the clearing of CFLAGS and LDFLAGS the patch "almost
> doesn't break anything". If we figure out how to fix the hamlib build,
> I'll gladly apply the changes in the next upload.

Please go ahead.

Helmut



Bug#1024721: [pkg-lua-devel] Bug#1024721: dh-lua: stop using libtool-bin

2023-01-05 Thread Sergei Golovan
Hi Helmut,

Sorry for a delay.

On Wed, Nov 23, 2022 at 11:09 PM Helmut Grohne  wrote:
>
> I would like to delete the libtool-bin package. The next paragraph
> explains why. You may skip it if you don't care.

I support the idea of dropping the libtool-bin dependency for dh-lua.

>
> I've come up with a patch that creates a libtool when needed in
> debian/.dh_lua-libtool. With this patch applied, I can drop the
> libtool-bin dependency. I've done a test build of lua-geoip using this
> the patched dh-lua and see that it builds successfully without pulling
> the libtool-bin package.
>
> So I went ahead and used ratt to check for possible failures in those
> 103 reverse dependencies and found the following failures:
>  - axtls is broken by my patch, because it injects -laxtls into compiler
>flags picked up by configure.
>  - elektra #956949
>  - hamlib is broken by my patch, because it injects a non-existent
>object file into compiler flags picked up by configure.
>  - libguestfs FTBFS on buildds
>  - lua-apr #935271
>  - lua-cyrussasl is broken by my patch, because it injects shell code
>into compiler flags picked up by configure and configure passes that
>code to the compiler verbatim.
>  - lua-zip is broken by my patch, because it injects shell code
>into compiler flags picked up by configure and configure passes that
>code to the compiler verbatim.
>  - luasocket is broken by my patch, because of a quoting issue in the
>generated configure arising from LTCFGFLAGS containing quotes.
>  - neomutt #1023767
>  - rrdtool is broken by my patch, because it injects -lrrd into compiler
>flags picked up by configure.

As far as I can see, the common problem with the patch is that it picks the
CFLAGS and LDFLAGS environment variables (created by the make tool
from CLIB_CFLAGS and CLIB_LDFLAGS, which are set in the dh-lib.conf).

These variables are used in an additional call of dh_auto_configure
which is necessary
to generate the libtool binary.

But are these variables necessary in this dh_auto_configure call? Maybe we can
just clear them before the call?

I've tried to use
$(H)dh_auto_configure --buildsystem=autoconf
--sourcedirectory=$(LBTL_DIR) -- "CFLAGS='' LDFLAGS=''
LDFLAGS_STATIC=''
and got almost all the broken builds succeed (the nested
dh_auto_configure sees the cleared variables, after that the newly
created
libtool builds the library just fine). One exception is hamlib. It
remains broken, I can't figure out what's wrong.

>
> So applying this patch would make six additional packages FTBFS. Of
> those, axtls and rrdtool try adding their library via CLIB_LDFLAGS. Both
> of them use a relative path with -L, which becomes invalid in configure.
> Adding $(CURDIR) may be a way to go here. hamlib could likewise prefix

Unfortunately, hamlib can't be fixed so easily. Something remains wrong.

> its object file with $(CURDIR). cyrus-sasl should use $(shell ...)
> instead of $$(...) to perform the shell evaluation. Likewise, lua-zip
> should use $(shell ...) in place of `...`. Finally, luasocket is
> difficult. Getting the quoting through the flags seems next to
> impossible, so I'd suggest moving the affected macros to a file and pass
> an -include flag via CFLAGS.
>
> Does this sound like we can move forward with this patch? I know it is
> not of the "it just works" kind.

After adding the clearing of CFLAGS and LDFLAGS the patch "almost
doesn't break anything". If we figure out how to fix the hamlib build,
I'll gladly apply the changes in the next upload.

Cheers!
-- 
Sergei Golovan



Bug#1024721: dh-lua: stop using libtool-bin

2022-11-23 Thread Helmut Grohne
Source: dh-lua
Version: 27+nmu1
Tags: patch
X-Debbugs-Cc: debian-cr...@lists.debian.org

Hi,

I would like to delete the libtool-bin package. The next paragraph
explains why. You may skip it if you don't care.

libtool-bin used to be part of libtool. When we started cross building
stuff, we wanted to mark libtool Multi-Arch foreign, but it contained
/usr/bin/libtool which very much is architecture-dependent, so that was
wrong. The way forward was to move /usr/bin/libtool out of libtool into
a new package libtool-bin. Back then, we did an archive rebuild and lots
of places actually didn't need /usr/bin/libtool. Another pile was
converted to avoid needing libtool. The rest simply got a libtool-bin
dependency. Now /usr/bin/libtool is not how libtool is meant to be used.
In theory, you're supposed to libtoolize and create a libtool as part of
the build. In particular, /usr/bin/libtool cannot be used for cross
builds, but if you create a libtool during build, it will support cross
builds. Thus we want to remove the libtool-bin package and
/usr/bin/libtool from the archive.

I've come up with a patch that creates a libtool when needed in
debian/.dh_lua-libtool. With this patch applied, I can drop the
libtool-bin dependency. I've done a test build of lua-geoip using this
the patched dh-lua and see that it builds successfully without pulling
the libtool-bin package.

So I went ahead and used ratt to check for possible failures in those
103 reverse dependencies and found the following failures:
 - axtls is broken by my patch, because it injects -laxtls into compiler
   flags picked up by configure.
 - elektra #956949
 - hamlib is broken by my patch, because it injects a non-existent
   object file into compiler flags picked up by configure.
 - libguestfs FTBFS on buildds
 - lua-apr #935271
 - lua-cyrussasl is broken by my patch, because it injects shell code
   into compiler flags picked up by configure and configure passes that
   code to the compiler verbatim.
 - lua-zip is broken by my patch, because it injects shell code
   into compiler flags picked up by configure and configure passes that
   code to the compiler verbatim.
 - luasocket is broken by my patch, because of a quoting issue in the
   generated configure arising from LTCFGFLAGS containing quotes.
 - neomutt #1023767
 - rrdtool is broken by my patch, because it injects -lrrd into compiler
   flags picked up by configure.

So applying this patch would make six additional packages FTBFS. Of
those, axtls and rrdtool try adding their library via CLIB_LDFLAGS. Both
of them use a relative path with -L, which becomes invalid in configure.
Adding $(CURDIR) may be a way to go here. hamlib could likewise prefix
its object file with $(CURDIR). cyrus-sasl should use $(shell ...)
instead of $$(...) to perform the shell evaluation. Likewise, lua-zip
should use $(shell ...) in place of `...`. Finally, luasocket is
difficult. Getting the quoting through the flags seems next to
impossible, so I'd suggest moving the affected macros to a file and pass
an -include flag via CFLAGS.

Does this sound like we can move forward with this patch? I know it is
not of the "it just works" kind.

Helmut
diff --minimal -Nru dh-lua-27+nmu1/Makefile dh-lua-27+nmu2/Makefile
--- dh-lua-27+nmu1/Makefile 2020-06-30 18:22:21.0 +0200
+++ dh-lua-27+nmu2/Makefile 2022-11-23 16:21:50.0 +0100
@@ -31,6 +31,7 @@
cp test/5.2/* $(DESTDIR)/$(DH_LUA_HOME)/test/5.2/
cp test/5.3/* $(DESTDIR)/$(DH_LUA_HOME)/test/5.3/
cp test/5.4/* $(DESTDIR)/$(DH_LUA_HOME)/test/5.4/
+   cp data/configure.ac $(DESTDIR)/$(DH_LUA_HOME)/
cp debhelper7/buildsystem/* $(DESTDIR)/$(DH_HOME)/Buildsystem/
cp debhelper7/sequence/* $(DESTDIR)/$(DH_HOME)/Sequence/
cat doc/policy.txt | sed 's/@@V@@/$(POLICY_VERSION)/' \
diff --minimal -Nru dh-lua-27+nmu1/data/configure.ac 
dh-lua-27+nmu2/data/configure.ac
--- dh-lua-27+nmu1/data/configure.ac1970-01-01 01:00:00.0 +0100
+++ dh-lua-27+nmu2/data/configure.ac2022-11-23 16:21:50.0 +0100
@@ -0,0 +1,4 @@
+dnl this is a minimal configure.ac for creating a libtool
+AC_INIT([dummy],[1.0])
+LT_INIT
+AC_OUTPUT
diff --minimal -Nru dh-lua-27+nmu1/debian/changelog 
dh-lua-27+nmu2/debian/changelog
--- dh-lua-27+nmu1/debian/changelog 2022-09-03 11:25:48.0 +0200
+++ dh-lua-27+nmu2/debian/changelog 2022-11-23 16:21:50.0 +0100
@@ -1,3 +1,10 @@
+dh-lua (27+nmu2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Stop using libtool-bin. (Closes: #-1)
+
+ -- Helmut Grohne   Wed, 23 Nov 2022 16:21:50 +0100
+
 dh-lua (27+nmu1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --minimal -Nru dh-lua-27+nmu1/debian/control dh-lua-27+nmu2/debian/control
--- dh-lua-27+nmu1/debian/control   2020-06-30 18:22:21.0 +0200
+++ dh-lua-27+nmu2/debian/control   2022-11-23 16:21:50.0 +0100
@@ -11,7 +11,7 @@
 
 Package: dh-lua
 Architecture: all
-Depends: