[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1110492: vdr-plugin-xineliboutput FTCBFS: multiple reasons



Package: vdr-plugin-xineliboutput
Version: 2.3.0-2
Tags: patch
User: debian-cross@lists.debian.org
Usertags: ftcbfs
X-Debbugs-Cc: debian-cross@lists.debian.org

Dear Maintainer,

vdr-plugin-xineliboutput FTCBFS due to multiple reasons. I am listing them with some of
the fixes done.

1. Hard-coding of pkg-config at various places, thereby not allowing arch triplet
prefixed pkg-config to be used during cross builds. added patch to makefile.

2. In d/rules:
   + CC, CXX were not passed to home-grown ./configure. I also added in a option to take pkgconfig here
   + this seems to really need a -fPIC, I checked build logs of all archs that have this so added it in
   + exported DPKG_EXPORT_BUILDTOOLS and added resepective headers

3. mpg2c executes during the build, which will inevitably give exec format error. however, the output
of this is arch indep. I checked this on atleast 3 arches using porter boxes to confirm. the output
was identical. so this can be compiled with build arch compiler.

I've attached a patch with these fixes. please review/merge.

thanks
nilesh
From 7ae55d2517b8b72036bdf3aa12a4c271f9e37a36 Mon Sep 17 00:00:00 2001
From: Nilesh Patra <nilesh@debian.org>
Date: Thu, 7 Aug 2025 04:15:35 +0530
Subject: [PATCH] Get vdr-plugin-xineliboutput cross building

---
 debian/patches/cross.patch | 62 ++++++++++++++++++++++++++++++++++++++
 debian/patches/series      |  1 +
 debian/rules               |  9 ++++--
 3 files changed, 70 insertions(+), 2 deletions(-)
 create mode 100644 debian/patches/cross.patch

diff --git a/debian/patches/cross.patch b/debian/patches/cross.patch
new file mode 100644
index 0000000..0a42e10
--- /dev/null
+++ b/debian/patches/cross.patch
@@ -0,0 +1,62 @@
+--- a/Makefile
++++ b/Makefile
+@@ -46,6 +46,7 @@
+ CXX      ?= g++
+ CC       ?= gcc 
+ OPTFLAGS ?= 
++PKG_CONFIG ?= pkg-config
+ 
+ ifeq ($(ARCH_APPLE_DARWIN), yes)
+     CXXFLAGS   ?= -O3 -pipe -Wall -Woverloaded-virtual -fPIC -g -fno-common -bundle -flat_namespace -undefined suppress
+@@ -63,7 +64,7 @@
+ ###
+ 
+ # Use package data if installed...otherwise assume we're under the VDR source directory:
+-PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
++PKGCFG = $(if $(VDRDIR),$(shell $(PKG_CONFIG) --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." $(PKG_CONFIG) --variable=$(1) vdr))
+ BINDIR = $(call PKGCFG,bindir)
+ LIBDIR = $(call PKGCFG,libdir)
+ LOCDIR = $(call PKGCFG,locdir)
+@@ -296,7 +297,7 @@
+ 
+ mpg2c: mpg2c.c
+ 	@echo CCLD $@
+-	$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) mpg2c.c -o $@
++	$(Q)$(CC_FOR_BUILD) $(CPPFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS) mpg2c.c -o $@
+ 
+ # data
+ black_720x576.c: mpg2c black_720x576.mpg
+--- a/configure
++++ b/configure
+@@ -189,9 +189,9 @@
+   if $PKG_CONFIG --exists $libname; then
+    if $PKG_CONFIG --libs $libname >/dev/null; then
+     add_flags LIBS_$subsys \
+-              `pkg-config --libs-only-L $libname` \
+-              `pkg-config --libs-only-l $libname`
+-    add_flags CFLAGS_$subsys `pkg-config --cflags-only-I $libname`
++              `$PKG_CONFIG --libs-only-L $libname` \
++              `$PKG_CONFIG --libs-only-l $libname`
++    add_flags CFLAGS_$subsys `$PKG_CONFIG --cflags-only-I $libname`
+     log "yes"
+     return 0
+    fi
+@@ -312,6 +312,7 @@
+   echo "  --disable-pkgconfig    do not use pkg-config"
+   echo "  --cc=CC                select C compiler"
+   echo "  --cxx=CXX              select C++ compiler"
++  echo "  --pkgconfig=PKG_CONFIG select pkg-config Path"
+   echo "  --add-cflags=FLAGS     add compiler flags"
+ }
+ 
+@@ -334,6 +335,10 @@
+       CXX=$optval
+       logdbg "C++ compiler: $CXX"
+       ;;
++    --pkgconfig=?*)
++      PKG_CONFIG=$optval
++      logdbg "PKG_CONFIG: $PKG_CONFIG"
++      ;;
+     --add-cflags=?*)
+       CFLAGS="$CFLAGS $optval"
+       logdbg "CFLAGS: $CFLAGS"
diff --git a/debian/patches/series b/debian/patches/series
index cebe540..24cd223 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 disable-po-update.patch
 cppflags.patch
+cross.patch
diff --git a/debian/rules b/debian/rules
index fd85908..e9667be 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,18 +3,23 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+include /usr/share/dpkg/architecture.mk
+DPKG_EXPORT_BUILDTOOLS=1
+include /usr/share/dpkg/buildtools.mk
 ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
 MAKE_OPTIONS += VERBOSE=1
 endif
 
+export DEB_CXXFLAGS_MAINT_APPEND = -fPIC
+
 %:
 	dh $@ --with vdrplugin
 
 override_dh_auto_configure:
-	./configure --disable-dbus-glib-1
+	./configure --disable-dbus-glib-1 --cc="$(CC)" --cxx="$(CXX)" --pkgconfig="$(PKG_CONFIG)"
 
 override_dh_auto_build:
-	dh_auto_build -- all $(MAKE_OPTIONS)
+	dh_auto_build -- all $(MAKE_OPTIONS) CC="$(CC)" CXX="$(CXX)" CC_FOR_BUILD="$(CC_FOR_BUILD)" PKG_CONFIG="$(PKG_CONFIG)"
 	txt2man -s 1 -t vdr-sxfe -v "Remote X-Server frontend for vdr-plugin-xineliboutput" debian/vdr-sxfe.1.txt >vdr-sxfe.1
 	txt2man -s 1 -t vdr-fbfe -v "Remote Framebuffer frontend for vdr-plugin-xineliboutput" debian/vdr-fbfe.1.txt >vdr-fbfe.1
 	txt2man -s 1 -t vdr-fbfe -v "Remote Framebuffer frontend for vdr-plugin-xineliboutput" debian/vdr-wlfe.1.txt >vdr-wlfe.1
-- 
2.47.2


Reply to: