Package: liblopsub-dev
Version: 1.0.5-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs
Control: affects -1 + src:tfortune

Hi,

thanks for having improved cross building on the tfortune side.
Unfortunately, it still doesn't cross. This time around, the problem is
to be found in liblopsub though. In order to build tfortune, we need the
liblopsub shared library (for the host architecture) and we also need to
run lopsubgen (as a build architecture executable). These things
currently reside in the same binary package, but for a cross build we
need them to be installed for different architectures.

I am proposing to split the liblopsub-dev package into a liblopsub-bin
package. Since the former depends on the latter, all existing uses will
continue to work as is. Things change when we attempt to cross build.
liblopsub-dev will continue to be installed for the host architecture.
liblopsub-bin will be installed for the build architecture though as it
will be marked Multi-Arch: foreign. That enables us to actually run
lopsubgen.

We also need a quick excursion into that Multi-Arch: foreign aspect.
That stanza is a strong assertion on how a package behaves. In essence,
it says that the architecture of the package does not matter for
interactions with it. Quite obviously the architecture of the shared
library matters and therefore liblopsub-dev must never be marked
Multi-Arch: foreign. For lopsubgen, we are in a convenient situation.
All formats that it deals with are textual (e.g. C source code as output
format). Textual formats typically are architecture-independent. I
expect that no matter whether I run a amd64 lopsubgen or an armhf one
(on a suitable CPU or using qemu), it produces the same output. Please
correct me if I'm wrong and in that case do not apply my patch.

The proposed change requires a trip through the NEW queue as it
introduces a new binary package. It's not a trivial change nor easily
reverted (as it requires reverse Breaks+Replaces to revert). Please take
a bit of time to understand the proposed change before committing it and
ask any questions you may have. The lib*-bin split is quite common and
in searching for similarly named packages you shall find a number of
prior art examples.

Helmut
diff --minimal -Nru liblopsub-1.0.5/debian/changelog 
liblopsub-1.0.5/debian/changelog
--- liblopsub-1.0.5/debian/changelog    2024-05-11 21:02:48.000000000 +0200
+++ liblopsub-1.0.5/debian/changelog    2024-08-16 19:03:09.000000000 +0200
@@ -1,3 +1,10 @@
+liblopsub (1.0.5-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Split lopsubgen into a Multi-Arch: foreign package. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 16 Aug 2024 19:03:09 +0200
+
 liblopsub (1.0.5-1) unstable; urgency=medium
 
   * prefer https:// over http:// and git://
diff --minimal -Nru liblopsub-1.0.5/debian/control 
liblopsub-1.0.5/debian/control
--- liblopsub-1.0.5/debian/control      2024-05-11 21:02:48.000000000 +0200
+++ liblopsub-1.0.5/debian/control      2024-08-16 19:00:06.000000000 +0200
@@ -28,7 +28,7 @@
 
 Package: liblopsub-dev
 Architecture: any
-Depends: ${shlibs:Depends}, liblopsub1t64 (= ${binary:Version}), 
${misc:Depends}
+Depends: ${shlibs:Depends}, liblopsub1t64 (= ${binary:Version}), 
${misc:Depends}, liblopsub-bin (= ${binary:Version})
 Description: Long Option Parser for Subcommand - headers
  Lopsub  is  an  open  source library written in C which aims to ease
  the task of creating, documenting and parsing the options of Unix
@@ -40,3 +40,21 @@
  supports single-character short options and GNU-style long  options.
  The public API is well documented and stable.
  This package contains the development environment for the lopsub library.
+
+Package: liblopsub-bin
+Architecture: any
+Multi-Arch: foreign
+Depends: ${shlibs:Depends}, liblopsub1t64 (= ${binary:Version}), 
${misc:Depends}
+Breaks: liblopsub-dev (<< 1.0.5-1.1~)
+Replaces: liblopsub-dev (<< 1.0.5-1.1~)
+Description: Long Option Parser for Subcommand - generator
+ Lopsub  is  an  open  source library written in C which aims to ease
+ the task of creating, documenting and parsing the options of Unix
+ command line utilities. It is suitable for simple commands as well
+ as complex command line utilities with many subcommands where  each
+ subcommand  has its own set of options. Options and documentation are
+ kept together in a single file which can be translated to C code (to
+ be included in the application), or to a manual page.  The library
+ supports single-character short options and GNU-style long  options.
+ The public API is well documented and stable.
+ This package contains the lopsubgen converstion utility.
diff --minimal -Nru liblopsub-1.0.5/debian/liblopsub-bin.install 
liblopsub-1.0.5/debian/liblopsub-bin.install
--- liblopsub-1.0.5/debian/liblopsub-bin.install        1970-01-01 
01:00:00.000000000 +0100
+++ liblopsub-1.0.5/debian/liblopsub-bin.install        2024-08-16 
19:00:28.000000000 +0200
@@ -0,0 +1,2 @@
+usr/bin/lopsubgen
+usr/share/man/man1/lopsubgen*
diff --minimal -Nru liblopsub-1.0.5/debian/liblopsub-bin.links 
liblopsub-1.0.5/debian/liblopsub-bin.links
--- liblopsub-1.0.5/debian/liblopsub-bin.links  1970-01-01 01:00:00.000000000 
+0100
+++ liblopsub-1.0.5/debian/liblopsub-bin.links  2024-08-16 19:03:09.000000000 
+0200
@@ -0,0 +1 @@
+usr/share/doc/liblopsub1t64 usr/share/doc/liblopsub-bin
diff --minimal -Nru liblopsub-1.0.5/debian/liblopsub-dev.install 
liblopsub-1.0.5/debian/liblopsub-dev.install
--- liblopsub-1.0.5/debian/liblopsub-dev.install        2024-05-11 
21:02:48.000000000 +0200
+++ liblopsub-1.0.5/debian/liblopsub-dev.install        2024-08-16 
19:00:21.000000000 +0200
@@ -1,5 +1,3 @@
 usr/include/*
 usr/lib/*/liblopsub.so
-usr/bin/lopsubgen
-usr/share/man/man1/lopsubgen*
 usr/share/man/man5/lopsub-suite*
diff --minimal -Nru liblopsub-1.0.5/debian/rules liblopsub-1.0.5/debian/rules
--- liblopsub-1.0.5/debian/rules        2024-05-11 21:02:48.000000000 +0200
+++ liblopsub-1.0.5/debian/rules        2024-08-16 19:03:07.000000000 +0200
@@ -4,6 +4,7 @@
 
 package := liblopsub1t64
 devpackage := liblopsub-dev
+binpackage := liblopsub-bin
 
 define checkdir
        @test -f debian/rules -a -f lopsub.c || \
@@ -47,6 +48,8 @@
        mv $(TMPDIR)/usr/lib-$(TRIPLET) $(TMPDIR)/usr/lib/$(TRIPLET)
        dh_install -p $(package)
        dh_install -p $(devpackage)
+       dh_install -p $(binpackage)
+       dh_link -p $(binpackage)
        dh_lintian
        $(MAKE_DIR) $(DESTDIR)/DEBIAN $(DOCS_DIR) $(DEVDOCS_DIR)
        echo 'activate-noawait ldconfig' > $(DESTDIR)/DEBIAN/triggers

Reply via email to