Fix cross-building and use dpkg-buildflags.
authorColin Watson <cjwatson@debian.org>
Wed, 9 Jan 2013 12:46:31 +0000 (12:46 +0000)
committerColin Watson <cjwatson@debian.org>
Wed, 9 Jan 2013 12:46:31 +0000 (12:46 +0000)
Makefile
debian/changelog
debian/control
debian/rules

index 777c4d8..1175bba 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ CFLAGS := -Os -g -Wall
 all: newns
 
 newns: newns.c
-       $(CC) $(CFLAGS) $^ -o $@
+       $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
 
 clean:
        rm -f newns
index c32551a..9cab981 100644 (file)
@@ -1,3 +1,9 @@
+os-prober (1.58) UNRELEASED; urgency=low
+
+  * Fix cross-building and use dpkg-buildflags.
+
+ -- Colin Watson <cjwatson@debian.org>  Wed, 09 Jan 2013 12:44:26 +0000
+
 os-prober (1.57) unstable; urgency=low
 
   [ Christian Perrier ]
index a8802bf..c8adad4 100644 (file)
@@ -3,7 +3,7 @@ Section: debian-installer
 Priority: optional
 Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
 Uploaders: Colin Watson <cjwatson@debian.org>, Joey Hess <joeyh@debian.org>, Christian Perrier <bubulle@debian.org>
-Build-Depends: debhelper (>= 7.0.50)
+Build-Depends: debhelper (>= 7.0.50), dpkg-dev (>= 1.15.7)
 Standards-Version: 3.9.3
 Vcs-Browser: http://git.debian.org/?p=d-i/os-prober.git
 Vcs-Git: git://git.debian.org/d-i/os-prober.git
index 85e7e6f..63a5932 100755 (executable)
@@ -10,6 +10,23 @@ ifneq (,$(findstring :$(ARCH):,:i386:amd64:))
 ARCH=x86
 endif
 
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+CC := gcc
+else
+CC := $(DEB_HOST_GNU_TYPE)-gcc
+endif
+
+export DEB_CFLAGS_MAINT_APPEND := -Os -Wall
+
+CFLAGS := $(shell dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get CFLAGS)
+LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+
+override_dh_auto_build:
+       $(MAKE) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
+
 override_dh_install:
        dh_install
        for probes in os-probes os-probes/mounted os-probes/init \