Source: liblopsub Version: 1.0.5-3.1 Tags: patch User: [email protected] Usertags: ftcbfs
liblopsub fails to cross build from source, because it builds for the build architecture. The easiest way of fixing this usually is using dh_auto_build, but this package appears to avoid debhelper where possible. Hence, I propose using dpkg's buildtools.mk instead. Then, the upstream build system needs reworking to support cross compilation. It builds two intermediate binaries run during build. For lopsubgen-stage1, we may just build it for the build architecture as it is not installed. lopsubgen however is both run and installed. I suggest building it twice (but only during cross compilation) and am attaching a patch to this end. Please propose this patch to upstream as it will enable cross building liblopsub on other distributions such as Yocto or PtxDist. Helmut
diff -Nru liblopsub-1.0.5/debian/changelog liblopsub-1.0.5/debian/changelog --- liblopsub-1.0.5/debian/changelog 2025-04-11 14:55:08.000000000 +0200 +++ liblopsub-1.0.5/debian/changelog 2025-09-17 07:14:50.000000000 +0200 @@ -1,3 +1,12 @@ +liblopsub (1.0.5-3.2) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: (Closes: #-1) + + Let dpkg's buildtools.mk export cross tools. + + Add cross building support to upstream build system. + + -- Helmut Grohne <[email protected]> Wed, 17 Sep 2025 07:14:50 +0200 + liblopsub (1.0.5-3.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru liblopsub-1.0.5/debian/patches/cross.patch liblopsub-1.0.5/debian/patches/cross.patch --- liblopsub-1.0.5/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100 +++ liblopsub-1.0.5/debian/patches/cross.patch 2025-09-17 07:14:50.000000000 +0200 @@ -0,0 +1,85 @@ +--- liblopsub-1.0.5.orig/Makefile ++++ liblopsub-1.0.5/Makefile +@@ -16,6 +16,9 @@ + # makes sure that such files are removed. + .DELETE_ON_ERROR: + ++CC_FOR_BUILD ?= $(CC) ++CFLAGS_FOR_BUILD ?= $(CFLAGS) ++CPPFLAGS_FOR_BUILD ?= $(CPPFLAGS) + PREFIX ?= /usr/local + M4 := m4 + LN := ln -f +@@ -28,7 +31,8 @@ + GZIP := gzip -fn9 + ZCAT := zcat + +-CC += -ffile-prefix-map=$(CURDIR)=. ++CFLAGS += -ffile-prefix-map=$(CURDIR)=. ++CFLAGS_FOR_BUILD += -ffile-prefix-map=$(CURDIR)=. + + dummy != $(M4) /dev/null || printf 'failed' + ifeq ($(dummy), failed) +@@ -79,20 +83,26 @@ + %.c: %.l + $(LEX) -o $@ $< + ++ifeq ($(CC),$(CC_FOR_BUILD)) ++LSGB = lopsubgen ++else ++LSGB = lopsubgen-build ++endif + # lopsubgen + lopsubgen.lsg.c lopsubgen.lsg.h: lopsubgen.suite lopsubgen-stage1 \ + lopsub-internal.h + ./lopsubgen-stage1 < $< +-%.lsg.c: %.suite lopsubgen +- ./lopsubgen --gen-c < $< +-%.lsg.h: %.suite lopsubgen +- ./lopsubgen --gen-header < $< +-%.1.gz: %.suite lopsubgen +- ./lopsubgen --gen-man=${@:.gz=} --version-string $(GIT_VERSION) < $< ++%.lsg.c: %.suite $(LSGB) ++ ./$(LSGB) --gen-c < $< ++%.lsg.h: %.suite $(LSGB) ++ ./$(LSGB) --gen-header < $< ++%.1.gz: %.suite $(LSGB) ++ ./$(LSGB) --gen-man=${@:.gz=} --version-string $(GIT_VERSION) < $< + $(GZIP) ${@:.gz=} + + # compiling +-lsg1_objs := lopsubgen.o lsg1.o version.o ++lsg1_objs := lopsubgen.build.o lsg1.build.o version.build.o ++lsgb_objs := lopsubgen.build.o lsg.build.o lopsubgen.lsg.build.o lopsub.build.o version.build.o + lsg_objs := lopsubgen.o lsg.o lopsubgen.lsg.o lopsub.o version.o + liblopsub_objs := config_file.o lopsub.o version.o + lopsubex_objs := lopsubex.o lopsubex.lsg.o $(liblopsub_objs) +@@ -104,14 +114,18 @@ + $(lsg_objs) $(liblopsub_objs) $(lopsubex_objs): %.o: %.c + lopsubgen.o config_file.o: + $(CC) $(CPPFLAGS) $(LLS_CFLAGS) $(CFLAGS) -c -o $@ ${@:.o=.c} +-lsg1.o: lsg.c lsg.h +- $(CC) $(CPPFLAGS) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS) -DSTAGE1 -c -o $@ $< ++lsg1.build.o: lsg.c lsg.h ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS_FOR_BUILD) -DSTAGE1 -c -o $@ $< ++%.build.o: %.c ++ $(CC_FOR_BUILD) -I. $(CPPFLAGS_FOR_BUILD) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS_FOR_BUILD) -c -o $@ $< + %.o: %.c + $(CC) -I. $(CPPFLAGS) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS) -c -o $@ $< + + # linking + lopsubgen-stage1: $(lsg1_objs) +- $(CC) -Wall -g $(lsg1_objs) -o $@ ++ $(CC_FOR_BUILD) -Wall -g $(lsg1_objs) -o $@ ++lopsubgen-build: $(lsgb_objs) ++ $(CC_FOR_BUILD) -Wall -g $(LDFLAGS_FOR_BUILD) -o $@ $(lsgb_objs) + lopsubgen: $(lsg_objs) + $(CC) -Wall -g $(LDFLAGS) -o $@ $(lsg_objs) + $(REALNAME): $(liblopsub_objs) +@@ -154,5 +168,5 @@ + $(RM) $(all) $(html) *.o *.man + distclean: clean + $(RM) *.lsg.c *.lsg.h lopsubgen.c config_file.c lopsubgen-stage1 \ +- lopsub.h lopsub.7 lopsub-suite.5 version.c ++ lopsubgen-build lopsub.h lopsub.7 lopsub-suite.5 version.c + -include Makefile.local diff -Nru liblopsub-1.0.5/debian/patches/series liblopsub-1.0.5/debian/patches/series --- liblopsub-1.0.5/debian/patches/series 2025-04-11 14:55:08.000000000 +0200 +++ liblopsub-1.0.5/debian/patches/series 2025-09-17 07:14:50.000000000 +0200 @@ -1 +1,2 @@ binNMU.patch +cross.patch diff -Nru liblopsub-1.0.5/debian/rules liblopsub-1.0.5/debian/rules --- liblopsub-1.0.5/debian/rules 2025-04-11 14:55:08.000000000 +0200 +++ liblopsub-1.0.5/debian/rules 2025-09-17 07:14:50.000000000 +0200 @@ -20,6 +20,8 @@ TRIPLET := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) include /usr/share/dpkg/pkg-info.mk +DPKG_EXPORT_BUILDTOOLS = 1 +include /usr/share/dpkg/buildtools.mk export DEB_VERSION # activate the dh sequencer

