Source: entr
Version: 4.1-1
Tags: patch
User: [email protected]
Usertags: rebootstrap

entr fails to cross build from source, because it builds for the wrong
architecture. Its configure inspects uname output with no way to
override it. Therefore, my patch reimplements configure in debian/rules.
Furthermore, the upstream Makefiles hard code the build architecture
pkg-config. My patch makes it substitutable and dh_auto_build will
substitute it. Please consider applying it as it makes entr cross
buildable.

Helmut
diff --minimal -Nru entr-4.1/debian/changelog entr-4.1/debian/changelog
--- entr-4.1/debian/changelog   2018-08-21 13:51:44.000000000 +0200
+++ entr-4.1/debian/changelog   2018-11-26 06:07:33.000000000 +0100
@@ -1,3 +1,12 @@
+entr (4.1-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Reimplement ./configure in debian/rules without uname.
+    + cross.patch: Make pkg-config substitutable.
+
+ -- Helmut Grohne <[email protected]>  Mon, 26 Nov 2018 06:07:33 +0100
+
 entr (4.1-1) unstable; urgency=low
 
   [ Otto Kekäläinen ]
diff --minimal -Nru entr-4.1/debian/patches/cross.patch 
entr-4.1/debian/patches/cross.patch
--- entr-4.1/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100
+++ entr-4.1/debian/patches/cross.patch 2018-11-26 06:07:33.000000000 +0100
@@ -0,0 +1,35 @@
+--- entr-4.1.orig/Makefile.debian
++++ entr-4.1/Makefile.debian
+@@ -5,8 +5,9 @@
+ # make test -f Makefile.linux-lbsd
+ # sudo make install
+ 
+-CFLAGS += -D_GNU_SOURCE -I/usr/include/kqueue $(shell pkg-config --cflags 
libbsd-overlay)
+-LDFLAGS += -lpthread -lkqueue $(shell pkg-config --libs libbsd-ctor)
++PKG_CONFIG ?= pkg-config
++CFLAGS += -D_GNU_SOURCE -I/usr/include/kqueue $(shell $(PKG_CONFIG) --cflags 
libbsd-overlay)
++LDFLAGS += -lpthread -lkqueue $(shell $(PKG_CONFIG) --libs libbsd-ctor)
+ MANPREFIX ?= ${PREFIX}/share/man
+ 
+ include Makefile.bsd
+--- entr-4.1.orig/Makefile.kfreebsd
++++ entr-4.1/Makefile.kfreebsd
+@@ -1,5 +1,6 @@
+-CFLAGS += -D_GNU_SOURCE $(shell pkg-config --cflags libbsd-overlay)
+-LDFLAGS += $(shell pkg-config --libs libbsd-overlay)
++PKG_CONFIG ?= pkg-config
++CFLAGS += -D_GNU_SOURCE $(shell $(PKG_CONFIG) --cflags libbsd-overlay)
++LDFLAGS += $(shell $(PKG_CONFIG) --libs libbsd-overlay)
+ MANPREFIX ?= ${PREFIX}/share/man
+ 
+ include Makefile.bsd
+--- entr-4.1.orig/Makefile.linux
++++ entr-4.1/Makefile.linux
+@@ -1,5 +1,6 @@
++PKG_CONFIG ?= pkg-config
+ CPPFLAGS += -D_GNU_SOURCE -D_LINUX_PORT -Imissing
+-LDFLAGS += $(shell pkg-config --libs libbsd-ctor)
++LDFLAGS += $(shell $(PKG_CONFIG) --libs libbsd-ctor)
+ MANPREFIX ?= ${PREFIX}/share/man
+ EXTRA_SRC = missing/strlcpy.c missing/kqueue_inotify.c
+ 
diff --minimal -Nru entr-4.1/debian/patches/series 
entr-4.1/debian/patches/series
--- entr-4.1/debian/patches/series      2018-08-21 13:51:44.000000000 +0200
+++ entr-4.1/debian/patches/series      2018-11-26 06:06:02.000000000 +0100
@@ -1,2 +1,3 @@
 libbsd-overlay.patch
 kfreebsd-support.patch
+cross.patch
diff --minimal -Nru entr-4.1/debian/rules entr-4.1/debian/rules
--- entr-4.1/debian/rules       2018-08-21 13:51:44.000000000 +0200
+++ entr-4.1/debian/rules       2018-11-26 06:05:58.000000000 +0100
@@ -7,12 +7,20 @@
 # Hardening
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all future=+lfs
 
+# Reimplement ./configure without relying on uname.
+include /usr/share/dpkg/architecture.mk
+ifeq (,$(filter linux kfreebsd,$(DEB_HOST_ARCH_OS)))
+UPSTREAM_MAKEFILE=Makefile.bsd
+else
+UPSTREAM_MAKEFILE=Makefile.$(DEB_HOST_ARCH_OS)
+endif
+
 # Rules
 %:
-       dh $@ --parallel
+       dh $@ --parallel --buildsystem=makefile
 
-override_dh_auto_configure:
-       ./configure
+override_dh_auto_build:
+       dh_auto_build -- -f $(UPSTREAM_MAKEFILE)
 
 override_dh_auto_install:
        dh_auto_install -- PREFIX=/usr

Reply via email to