Package: libtext-charwidth-perl
Version: 0.04-6.1
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: cross

Hi,

I'm currently working on cross-building bits of Debian and I've got to
perl modules. Most would cross-build fine, but they need to pick up
cross-build details from a cross-perl package. I've just pushed a
patch to the perl package (#633884) which puts that information in
place.

Based on that patch, here's a patch that allows
libtext-charwidth-perl to cross-build.

Cheers,
-- 
Steve McIntyre
[email protected]
diff -u libtext-charwidth-perl-0.04/debian/rules libtext-charwidth-perl-0.04/debian/rules
--- libtext-charwidth-perl-0.04/debian/rules
+++ libtext-charwidth-perl-0.04/debian/rules
@@ -18,6 +18,17 @@
 	INSTALL_PROGRAM += -s
 endif
 
+DEB_BUILD_GNU_TYPE      := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE       := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+        HOST_PERL = $(shell which perl)
+        PERL_VER = $(shell $(HOST_PERL) -v | $(HOST_PERL) -e 'while(<>) {/v(\d+\.\d+\.\d+)/ and print "$$1\n";}')
+
+        export PERL5LIB=/usr/$(DEB_HOST_GNU_TYPE)/lib/perl/$(PERL_VER)
+endif
+
+
 configure: configure-stamp
 configure-stamp:
 	dh_testdir
@@ -39,6 +50,14 @@
 	dh_clean Makefile.old Makefile CharWidth.o blib/arch/auto/Text/CharWidth/CharWidth.so blib/man3/Text::CharWidth.3pm CharWidth.c
 
 install: build
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+	@if [ ! -f $(PERL5LIB)/Config.pm ] || [ ! -f $(PERL5LIB)/Config_heavy.pl ]	;\
+	then	\
+		echo "Config.pm & Config_heavy.pl for cross building not found in $(PERL5LIB)"	;\
+	exit 1	;\
+	fi
+endif
+	dh $@
 	dh_testdir
 	dh_testroot
 	dh_prep
diff -u libtext-charwidth-perl-0.04/debian/changelog libtext-charwidth-perl-0.04/debian/changelog
--- libtext-charwidth-perl-0.04/debian/changelog
+++ libtext-charwidth-perl-0.04/debian/changelog
@@ -1,3 +1,10 @@
+libtext-charwidth-perl (0.04-6.1) unstable; urgency=low
+
+  * Configure perl C compilation for cross builds
+  * Adapted from initial work by Peter Pearse <[email protected]>
+
+ -- Steve McIntyre <[email protected]>  Fri, 15 Jul 2011 12:01:01 +0100
+
 libtext-charwidth-perl (0.04-6) unstable; urgency=low
 
   * DH compatibility level is 7

Reply via email to