Package: netcat-openbsd
Version: 1.105-6
Severity: normal
Tags: patch
User: crossbu...@debian.org
Usertags: cross

When asked to cross-build, netcat-openbsd uses the native compiler
rather than the cross-compiler, and uses pkg-config rather than the
appropriate $host-pkg-config.  Once these are fixed, it cross-builds
cleanly.  Patch follows.

  * Set correct compiler and pkg-config when cross-building.

diff -Nru 
netcat-openbsd-1.105/debian/patches/0001-port-to-linux-with-libsd.patch 
netcat-openbsd-1.105/debian/patches/0001-port-to-linux-with-libsd.patch
--- netcat-openbsd-1.105/debian/patches/0001-port-to-linux-with-libsd.patch     
2012-06-14 14:20:53.000000000 +0100
+++ netcat-openbsd-1.105/debian/patches/0001-port-to-linux-with-libsd.patch     
2012-12-01 02:44:59.000000000 +0000
@@ -11,7 +11,7 @@
 
 --- a/Makefile
 +++ b/Makefile
-@@ -1,6 +1,19 @@
+@@ -1,6 +1,20 @@
 -#     $OpenBSD: Makefile,v 1.6 2001/09/02 18:45:41 jakob Exp $
 +#       $OpenBSD: Makefile,v 1.6 2001/09/02 18:45:41 jakob Exp $
  
@@ -19,7 +19,8 @@
  SRCS= netcat.c atomicio.c socks.c
  
 -.include <bsd.prog.mk>
-+LIBS=  `pkg-config --libs libbsd` -lresolv
++PKG_CONFIG?=  pkg-config
++LIBS=  `$(PKG_CONFIG) --libs libbsd` -lresolv
 +OBJS=  $(SRCS:.c=.o)
 +CFLAGS=  -g -O2
 +LDFLAGS=  -Wl,--no-add-needed
diff -Nru netcat-openbsd-1.105/debian/rules netcat-openbsd-1.105/debian/rules
--- netcat-openbsd-1.105/debian/rules   2012-06-14 14:20:53.000000000 +0100
+++ netcat-openbsd-1.105/debian/rules   2012-12-01 02:41:43.000000000 +0000
@@ -6,10 +6,20 @@
 DEB_LDFLAGS = $(LDFLAGS) -Wl,--no-add-needed,--as-needed
 DEB_VER = $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
 
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+       CROSS :=
+else
+       CROSS := \
+               CC=$(DEB_HOST_GNU_TYPE)-gcc \
+               PKG_CONFIG=$(DEB_HOST_GNU_TYPE)-pkg-config
+endif
+
 %:
        dh $@
 override_dh_auto_build:
-       $(MAKE) CFLAGS='$(DEB_CFLAGS) -DDEBIAN_VERSION=\"$(DEB_VER)\"' 
LDFLAGS="$(DEB_LDFLAGS)"
+       $(MAKE) CFLAGS='$(DEB_CFLAGS) -DDEBIAN_VERSION=\"$(DEB_VER)\"' 
LDFLAGS="$(DEB_LDFLAGS)" $(CROSS)
 override_dh_auto_install:
        mv nc nc.openbsd
        mv nc.1 nc_openbsd.1

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to