[pkg-lua-devel] Bug#1024721: dh-lua: stop using libtool-bin
Helmut Grohne
helmut at subdivi.de
Wed Nov 23 20:07:25 GMT 2022
Source: dh-lua
Version: 27+nmu1
Tags: patch
X-Debbugs-Cc: debian-cross at 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
-------------- next part --------------
diff --minimal -Nru dh-lua-27+nmu1/Makefile dh-lua-27+nmu2/Makefile
--- dh-lua-27+nmu1/Makefile 2020-06-30 18:22:21.000000000 +0200
+++ dh-lua-27+nmu2/Makefile 2022-11-23 16:21:50.000000000 +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.ac 1970-01-01 01:00:00.000000000 +0100
+++ dh-lua-27+nmu2/data/configure.ac 2022-11-23 16:21:50.000000000 +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.000000000 +0200
+++ dh-lua-27+nmu2/debian/changelog 2022-11-23 16:21:50.000000000 +0100
@@ -1,3 +1,10 @@
+dh-lua (27+nmu2) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Stop using libtool-bin. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de> 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.000000000 +0200
+++ dh-lua-27+nmu2/debian/control 2022-11-23 16:21:50.000000000 +0100
@@ -11,7 +11,7 @@
Package: dh-lua
Architecture: all
-Depends: ${misc:Depends}, ${perl:Depends}, debhelper (>= 8.0.0), dctrl-tools, libtool, libtool-bin, pkg-config, libfile-find-rule-perl,
+Depends: ${misc:Depends}, ${perl:Depends}, debhelper (>= 8.0.0), dctrl-tools, libtool, pkg-config, libfile-find-rule-perl,
liblua5.4-dev, lua5.4,
liblua5.3-dev, lua5.3,
liblua5.2-dev, lua5.2,
diff --minimal -Nru dh-lua-27+nmu1/make/dh-lua.Makefile.single dh-lua-27+nmu2/make/dh-lua.Makefile.single
--- dh-lua-27+nmu1/make/dh-lua.Makefile.single 2022-09-03 11:25:39.000000000 +0200
+++ dh-lua-27+nmu2/make/dh-lua.Makefile.single 2022-11-23 16:21:50.000000000 +0100
@@ -2,6 +2,9 @@
# License: MIT/X
# vim: foldmethod=marker:ft=make
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
+
# override for more verbose output
ifeq "$(DH_VERBOSE)-$(findstring verbose,$(DH_LUA_OPTS))" "-"
H=@
@@ -44,7 +47,9 @@
LUA=lua$(LUA_VERSION)
C_TEST_FILE=$(DH_LUA_SUPPORT_FILES)test/$(LUA_VERSION)/app.c
PREFIX=$(DESTDIR)/usr/
-LBTL=libtool --tag=CC
+LBTL_DIR=$(CURDIR)/debian/.dh_lua-libtool
+LBTL_EXE=$(LBTL_DIR)/libtool
+LBTL=$(LBTL_EXE) --tag=CC
ifeq "$(LUA_SOURCES_MANGLER)" ""
LUA_SOURCES_MANGLER:=cat
endif
@@ -52,13 +57,13 @@
# .pc
PKG_CONF_NAME=$(LUA)-$(PKG_NAME_DASH).pc
DEB_PKGCONFIG_TEMPL=$(DH_LUA_SUPPORT_FILES)/template/pkg-config.pc.in
-PKGCONF=pkg-config $(LUA) --define-variable=prefix=$(PREFIX)
+PKGCONF=$(PKG_CONFIG) $(LUA) --define-variable=prefix=$(PREFIX)
ifeq "$(PKG_VERSION)" ""
PKG_VERSION=$(shell dpkg-parsechangelog|grep ^Ver|cut -d ' ' -f 2|cut -d '-' -f 1)
endif
# sanity check
-ifneq "$(shell pkg-config $(LUA) --exists; echo $$?)" "0"
+ifneq "$(shell $(PKG_CONFIG) $(LUA) --exists; echo $$?)" "0"
$(error "pkg-config file for $(LUA) not found")
endif
@@ -83,7 +88,6 @@
# /usr/lib/, /usr/lib/lua/5.1, /usr/share/lua/5.1/
LUA_CPATH:=$(shell $(PKGCONF) --define-variable=abiver=$(LUA_VERSION) --variable=INSTALL_CMOD)
LUA_SPATH:=$(shell $(PKGCONF) --define-variable=abiver=$(LUA_VERSION) --variable=INSTALL_LMOD)
-DEB_HOST_MULTIARCH:=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LUA_LPATH=$(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
# /usr/include/lua5.1
@@ -129,10 +133,6 @@
# where to find stuff
LUA_INIT=' package.path="$(UID)/?.lua;$(UID)/?/init.lua;"..package.path; package.cpath="$(UID)/?.so;"..package.cpath; '
-# to help crosscompiling
-DEB_BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
-DEB_HOST_ARCH:=$(shell dpkg-architecture -qDEB_HOST_ARCH)
-
# lua5.2 specific
ifeq "$(LUA_VERSION)" "5.2"
LUA_TEST := $(subst /usr/bin/shake,,$(LUA_TEST))
@@ -173,6 +173,7 @@
clean: sanity
$(H)$(RM) -rf $(UID)/
$(H)$(call empty_trash)
+ $(H)$(RM) -rf $(LBTL_DIR)
# fix for leftovers of dh-lua < 14
$(H)$(RM) -f debian/backup
autopkgtest: sanity test-lua-dynamic-apkgt-$(LUA_TEST_KIND)
@@ -185,6 +186,11 @@
exit 1;\
fi
+$(LBTL_EXE):
+ $(H)mkdir -p $(LBTL_DIR)
+ $(H)cp /usr/share/dh-lua/configure.ac $(LBTL_DIR)/configure.ac
+ $(H)cd $(LBTL_DIR) && LIBTOOLIZE='libtoolize -i' autoreconf -f -i
+ $(H)dh_auto_configure --buildsystem=autoconf --sourcedirectory=$(LBTL_DIR)
# }}}
# {{{ helper macros
@@ -331,7 +337,7 @@
$(H)$(call run_multiple_tests,$(LUA_TEST),$(UID)/app-static)
@echo "**************************************************"
-test-app-dynamic-real: $(UID)/app-dynamic
+test-app-dynamic-real: $(UID)/app-dynamic $(LBTL_EXE)
@echo "********************** app dynamic ($(LUA_VERSION)) *********"
$(H)$(call run_multiple_tests,$(LUA_TEST),\
$(LBTL) --mode=execute -dlopen $(UID)/$(LIBNAME).la \
@@ -368,7 +374,7 @@
# ------------------------- Installation ---------------------------------------
# {{{ install static and dynamic libraries for module to global location
-installso: $(UID)/$(LIBNAME).la $(UID)/$(PKG_CONF_NAME) $(LUA_HEADER)
+installso: $(UID)/$(LIBNAME).la $(UID)/$(PKG_CONF_NAME) $(LUA_HEADER) $(LBTL_EXE)
# .so
$(H)echo Installing $(LIBNAME)
$(H)mkdir -p $(LUA_CPATH)
@@ -435,10 +441,10 @@
# ------------------------- C compilation --------------------------------------
# {{{ compilation rules: .lo .la app
-$(UID)/%.lo: %.c
+$(UID)/%.lo: %.c $(LBTL_EXE)
$(LBTL) --mode=compile $(CC) -c $(CFLAGS) -o $@ $<
-$(UID)/$(LIBNAME).la $(UID)/$(LUA_MODNAME_PATH).so: $(addprefix $(UID)/,$(CLIB_OBJS))
+$(UID)/$(LIBNAME).la $(UID)/$(LUA_MODNAME_PATH).so: $(addprefix $(UID)/,$(CLIB_OBJS)) $(LBTL_EXE)
$(LBTL) --mode=link $(CC) \
-rpath $(LUA_LPATH) -version-info $(VERSION_INFO) -Wl,--no-add-needed \
-o $(UID)/$(LIBNAME).la \
@@ -449,14 +455,14 @@
$(UID)/$(LUA_MODNAME_PATH).so
ldd $(UID)/$(LUA_MODNAME_PATH).so
-$(UID)/app-static: $(UID)/$(LIBNAME).la
+$(UID)/app-static: $(UID)/$(LIBNAME).la $(LBTL_EXE)
$(LBTL) --mode=link $(CC) $(CFLAGS) -Wl,--no-add-needed \
-static -o $@ -I . -I $(UID)/ \
$(C_TEST_FILE) $(UID)/$(LIBNAME).la \
$(LDFLAGS_STATIC) $(LUA_LBTL_S)
ldd $(UID)/app-static
-$(UID)/app-dynamic: $(UID)/$(LIBNAME).la
+$(UID)/app-dynamic: $(UID)/$(LIBNAME).la $(LBTL_EXE)
$(LBTL) --mode=link $(CC) $(CFLAGS) -Wl,--no-add-needed \
-o $@ -I . -I $(UID)/ \
$(C_TEST_FILE) $(UID)/$(LIBNAME).la \
More information about the pkg-lua-devel
mailing list