Source: brightd
Version: 0.4.1-2
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

brightd fails to cross build from source, because the upstream Makefile
hard codes the build architecture compiler. For fixing that, we need to
make it substitutable and substitute it (e.g. via dh_auto_buil). It also
uses install -s and thus the build architecture strip. That's generally
a bad idea, because it breaks DEB_BUILD_OPTIONS=nostrip and generation
of a -dbgsym package in addition to breaking cross compilation. Thus we
also make INSTALL substitutable and pass a non-stripping install. The
INSTALL assignment can be dropped in debhelper compatibility level 11.
Please consider applying the attached patch.

Helmut
diff --minimal -Nru brightd-0.4.1/debian/changelog 
brightd-0.4.1/debian/changelog
--- brightd-0.4.1/debian/changelog      2018-09-05 14:48:36.000000000 +0200
+++ brightd-0.4.1/debian/changelog      2019-02-25 17:05:49.000000000 +0100
@@ -1,3 +1,13 @@
+brightd (0.4.1-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: Make compiler and install substitutable.
+    + Let dh_auto_build pass a cross compiler to make.
+    + Pass a non-stripping install to make install.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 25 Feb 2019 17:05:49 +0100
+
 brightd (0.4.1-2) unstable; urgency=medium
 
   * Refresh the patch.
diff --minimal -Nru brightd-0.4.1/debian/patches/cross.patch 
brightd-0.4.1/debian/patches/cross.patch
--- brightd-0.4.1/debian/patches/cross.patch    1970-01-01 01:00:00.000000000 
+0100
+++ brightd-0.4.1/debian/patches/cross.patch    2019-02-25 17:05:49.000000000 
+0100
@@ -0,0 +1,25 @@
+--- brightd-0.4.1.orig/Makefile
++++ brightd-0.4.1/Makefile
+@@ -1,3 +1,4 @@
++INSTALL ?= install
+ PREFIX=$(DESTDIR)/usr
+ BINDIR=bin/
+ #NO_X11=1  # (Uncomment this to disable X11 Support)
+@@ -14,14 +15,14 @@
+ all: brightd brightd.1
+ 
+ brightd: brightd.c
+-      gcc $@.c $(CFLAGS) $(A_CFLAGS) -o $@
++      $(CC) $@.c $(CFLAGS) $(A_CFLAGS) -o $@
+ 
+ brightd.1:
+       sed -re 's/^\.nr no_x11 [01]/.nr no_x11 $(MAN_NO_X11)/' brightd.1.tpl > 
brightd.1
+ 
+ install:
+-      install -Ds brightd $(PREFIX)/$(BINDIR)/brightd
+-      install -D brightd.1 $(PREFIX)/share/man/man1/brightd.1
++      $(INSTALL) -Ds brightd $(PREFIX)/$(BINDIR)/brightd
++      $(INSTALL) -D brightd.1 $(PREFIX)/share/man/man1/brightd.1
+ 
+ uninstall:
+       rm $(PREFIX)/$(BINDIR)/brightd
diff --minimal -Nru brightd-0.4.1/debian/patches/series 
brightd-0.4.1/debian/patches/series
--- brightd-0.4.1/debian/patches/series 2018-09-05 14:48:36.000000000 +0200
+++ brightd-0.4.1/debian/patches/series 2019-02-25 17:05:49.000000000 +0100
@@ -3,3 +3,4 @@
 0003-Use-int-for-brightness-not-char.patch
 0004-Reorder-gcc-arguments.patch
 0005-Reword-the-contradiction-in-the-e-option-description.patch
+cross.patch
diff --minimal -Nru brightd-0.4.1/debian/rules brightd-0.4.1/debian/rules
--- brightd-0.4.1/debian/rules  2018-09-05 14:48:36.000000000 +0200
+++ brightd-0.4.1/debian/rules  2019-02-25 17:05:49.000000000 +0100
@@ -8,10 +8,10 @@
        dh $@
 
 override_dh_auto_build:
-       $(MAKE) CFLAGS="$(shell dpkg-buildflags --get CFLAGS) $(shell 
dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get LDFLAGS)"
+       dh_auto_build -- CFLAGS="$(shell dpkg-buildflags --get CFLAGS) $(shell 
dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get LDFLAGS)"
 
 override_dh_auto_install:
-       $(MAKE) DESTDIR=$(CURDIR)/debian/brightd install
+       dh_auto_install -- INSTALL='install --strip-program=true'
        chmod 4755 $(CURDIR)/debian/brightd/usr/bin/brightd
        install -m 0644 -D debian/brightd-xsession 
$(CURDIR)/debian/brightd/etc/X11/Xsession.d/90brightd
 

Reply via email to