Package: lsof
Version: 4.86+dfsg-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: cross

The following patch adds cross-building support to the lsof packaging.
The upstream build system at least makes it possible, although it's
rather cumbersome (especially having to set LSOF_CCV and the
-DHAS_STRFTIME override) and non-standard; but I've verified that this
works.

In the process, I needed to fix the packaging to honour
DEB_BUILD_OPTIONS=nocheck, as recommended by policy.  This matters when
cross-building since you may well not be able to execute the binaries
you've just built.

  * Use appropriate compiler, ar, and ranlib when cross-building.
  * Honour DEB_BUILD_OPTIONS=nocheck.

diff -Nru lsof-4.86+dfsg/debian/rules lsof-4.86+dfsg/debian/rules
--- lsof-4.86+dfsg/debian/rules 2012-04-25 07:14:09.000000000 +0100
+++ lsof-4.86+dfsg/debian/rules 2012-12-02 02:26:04.000000000 +0000
@@ -18,6 +18,18 @@
 LSOF_CFGL := $(shell dpkg-buildflags --get LDFLAGS)
 export LSOF_CFGL
 
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+    export LSOF_CC := $(DEB_HOST_GNU_TYPE)-gcc
+    export LSOF_CCV := $(shell $(LSOF_CC) -v 2>&1 | sed -n 's/.*version 
\(.*\)/\1/p')
+    export LINUX_CONF_CC := gcc
+    export LSOF_AR := $(DEB_HOST_GNU_TYPE)-ar cr
+    export LSOF_RANLIB := $(DEB_HOST_GNU_TYPE)-ranlib
+    # Autodetection will fail.
+    LSOF_CFGF += -DHAS_STRFTIME
+endif
+
 override_dh_auto_clean:
        dh_auto_clean
        rm -f dfile.c dlsof.h dmnt.c dnode.c dproc.c dproto.h dsock.c dstore.c 
machine.h Makefile
@@ -32,7 +44,9 @@
        dh_installchangelogs 00DIST
 
 override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
        cd tests && make test && make opt && cd -
+endif
 
 %:
        dh $@

Thanks,

-- 
Colin Watson                                       [[email protected]]


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to