diff -urN perl-5.14.2/debian/changelog perl-5.14.2-ma-cross/debian/changelog
--- perl-5.14.2/debian/changelog	2013-02-12 04:13:11.000000000 +0000
+++ perl-5.14.2-ma-cross/debian/changelog	2013-02-12 04:14:33.000000000 +0000
@@ -1,6 +1,13 @@
+perl (5.14.2-18ma1cross1) precise; urgency=low
+
+  [ Neil Williams ]
+  * Cross build with debian-perl-cross 
+
+ -- Wookey <wookey@wookware.org>  Tue, 12 Feb 2013 04:10:19 +0000
+
 perl (5.14.2-18ma1) raring; urgency=low
 
-  [ Niko Tyni ]
+  [ Niko Tyni]
   * Multiarch support
 
  -- Wookey <wookey@e102475-lin>  Mon, 11 Feb 2013 23:49:28 +0000
diff -urN perl-5.14.2/debian/rules perl-5.14.2-ma-cross/debian/rules
--- perl-5.14.2/debian/rules	2013-02-11 19:39:48.000000000 +0000
+++ perl-5.14.2-ma-cross/debian/rules	2013-02-12 04:09:51.000000000 +0000
@@ -37,18 +37,49 @@
 checkroot   = test `id -u` -eq 0
 checkperl   = $(SHELL) debian/checkperl
 
+# CROSSING
+# Don't configure - copy in cross files
+# NOTE: Different for static/shared/debug
+# usecrosscompile not set no target host etc
+# Don't build miniperl - use host perl
+# Later - build host miniperl
+# Later - find on host
+#
+
+DEB_BUILD_GNU_TYPE      ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE       ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+
 # this may differ from $(fullversion) for release candidates and the like
 package_upstream_version = $(shell dpkg-parsechangelog | \
         sed -ne 's/-[^-]\+$$//; s/^Version: *\([0-9]\+:\)*//p')
 
 package_version = $(shell dpkg-parsechangelog | sed -n 's/^Version: *//p')
 
+ifeq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE))
+        HOST_PERL = 
+        PERL_TO_USE = $(srcdir)/perl.static
+        HEADER_DIR = /usr/include
+        LIBRARY_DIR = /usr/lib
+        OBJCOPY = objcopy
+        STRIP = strip
+else
+        HOST_PERL = $(shell which perl)
+        PERL_TO_USE = $(HOST_PERL)
+        HOST_PERL_LIBS = /usr/lib/perl/$(package_upstream_version)
+        HEADER_DIR  = /usr/include/$(DEB_HOST_GNU_TYPE)
+        LIBRARY_DIR = /usr/lib/$(DEB_HOST_GNU_TYPE)
+        OBJCOPY = $(DEB_HOST_GNU_TYPE)-objcopy
+        STRIP = $(DEB_HOST_GNU_TYPE)-strip
+endif
+export INCLUDE=$(HEADER_DIR)
+export LIB=$(LIBRARY_DIR)
+
 # this gets prepended to the patch names in patchlevel.h
 patchprefix = DEBPKG:
 
 # control file substitutions
 subst_upstream = -VUpstream-Version=$(package_upstream_version)
-subst_perlapi  = -Vperlapi:Provides="`./perl.static debian/mkprovides`"
+subst_perlapi  = -Vperlapi:Provides="`$(PERL_TO_USE) debian/mkprovides`"
 subst_next_upstream = -VNext-Upstream-Version=$(nextversion)
 # perl-base with a static perl won't get the libperl pre-dependency via shlibs
 ifeq ($(installtype),static)
@@ -60,13 +91,13 @@
 
 # for cpan/Compress-Raw-Zlib
 export BUILD_ZLIB=False
-export ZLIB_INCLUDE=/usr/include
-export ZLIB_LIB=/usr/lib
+export ZLIB_INCLUDE=$(HEADER_DIR)
+export ZLIB_LIB=$(LIBRARY_DIR)
 
 # for cpan/Compress-Raw-Bzip2
 export BUILD_BZIP2=0
-export BZIP2_INCLUDE=/usr/include
-export BZIP2_LIB=/usr/lib
+export BZIP2_INCLUDE=$(HEADER_DIR)
+export BZIP2_LIB=$(LIBRARY_DIR)
 
 build: build-stamp
 install: install-stamp
@@ -85,40 +116,61 @@
 perl.static:
 	$(checkdir)
 	rm -f libperl.so* # must be built last
-	[ ! -f Makefile ] || $(MAKE) distclean
+	[ ! -f Makefile ] || $(MAKE) distclean CROSS_PERL=$(HOST_PERL)
 	[ -f $(patchlevel) ] || touch $(patchlevel)
+ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 	$(SHELL) debian/config.debian --static
-	$(MAKE) perl $(test_target)
+else
+	perl-cross-debian --variant static
+endif
+	$(MAKE) perl $(test_target)  CROSS_PERL=$(HOST_PERL)
 	mv libperl.a libperl-static
 	mv perl perl.static
 
 	# for the build log
-	./perl.static -Ilib -V
+	$(PERL_TO_USE) -Ilib -V
 
 perl.debug:
 	$(checkdir)
 	rm -f libperl.so* # must be built last
-	[ ! -f Makefile ] || $(MAKE) distclean
+	[ ! -f Makefile ] || $(MAKE) distclean CROSS_PERL=$(HOST_PERL)
 	[ -f $(patchlevel) ] || touch $(patchlevel)
+ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 	$(SHELL) debian/config.debian --debug
-	$(MAKE) perl
+else
+	perl-cross-debian --variant debug
+endif
+	$(MAKE) perl CROSS_PERL=$(HOST_PERL)
 	mv perl perl.debug
 
 libperl.so.$(fullversion):
 	$(checkdir)
-	[ ! -f Makefile ] || $(MAKE) distclean
+	[ ! -f Makefile ] || $(MAKE) distclean CROSS_PERL=$(HOST_PERL)
 	[ -f $(patchlevel) ] || touch $(patchlevel)
+ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 	$(SHELL) debian/config.debian --shared
-	$(MAKE) SHRPLDFLAGS='$$(LDDLFLAGS) -Wl,-soname,libperl.so.$(version)' $@
+else
+	perl-cross-debian --variant shared
+endif
+	$(MAKE) SHRPLDFLAGS='$$(LDDLFLAGS) -Wl,-soname,libperl.so.$(version)' $@ CROSS_PERL=$(HOST_PERL)
 	ln -s libperl.so.$(fullversion) libperl.so.$(version)
 	ln -s libperl.so.$(version) libperl.so
+ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 	$(MAKE) all $(test_target) || { rm -f libperl.so*; exit 1; }
+else
+	@echo "Need to use installed (host) extensions when building extensions...."
+	@echo "Overwrite any built so far"
+	cp -fr $(HOST_PERL_LIBS)/auto/* lib/auto/
+	@echo "Now make the extensions"
+	-mkdir lib/$(DEB_HOST_GNU_TYPE)
+	$(MAKE) extensions CROSS_PERL=$(HOST_PERL) INST_ARCHLIB=$(srcdir)/lib/$(DEB_HOST_GNU_TYPE)
+endif
 
 clean:
 	$(checkdir)
 	$(checkroot)
 	test -f $(patches)	# maintainer sanity check
-	[ ! -f Makefile ] || $(MAKE) distclean
+	[ ! -f Makefile ] || $(MAKE) distclean CROSS_PERL=$(HOST_PERL)
 	rm -rf config.over perl.static perl.debug libperl-static libperl.so* \
 	    $(patchlevel) build-stamp install-stamp t/auto \
 	    debian/libperl$(version).shlibs \
@@ -126,17 +178,32 @@
 	# <https://rt.cpan.org/Public/Bug/Display.html?id=68214>
 	rm -f cpan/DB_File/DB_File.pm.bak cpan/DB_File/t/db-btree.t.bak \
 	    cpan/DB_File/t/db-hash.t.bak cpan/DB_File/t/db-recno.t.bak
+	find lib -name .exists -o -name '*.so' -o -name '*.bs' -o -name '*.ld' | xargs rm -f
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+	perl-cross-debian --clean
+endif
 
 install-stamp: build-stamp
 	$(checkdir)
 	$(checkroot)
 	$(checkperl)
 	rm -rf $(tmp) $(build)
-
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+	@echo "Copy back all the target-independent extensions - for use and installation"
+	mkdir -p $(lib)/auto/
+	cp -fr $(HOST_PERL_LIBS)/auto/* $(lib)/auto/
+	$(MAKE) install CROSS_PERL=$(HOST_PERL)
+	@echo "Copy the arch dependent ones over the debian ones for installation into packages"
+	find . -name .exists -o -name '*.bs' | xargs rm -f
+	cp -fr lib/$(DEB_HOST_GNU_TYPE)/auto/*  $(lib)/auto/
+	echo "Don't install INST_ARCHLIB into packages"
+	-find $(tmp)/usr/share/perl -name $(DEB_HOST_GNU_TYPE) -exec rm -fr {} \;
+else
 	$(MAKE) install
+endif
 	# remove temporary prefix on install vars and switch man
 	# extensions to 1p and 3pm for vendor module installs
-	SRCDIR="$(srcdir)" ./perl.static -i -pe 's!\Q$$ENV{SRCDIR}\E/$(tmp)/!/! if /install/;' \
+	SRCDIR="$(srcdir)" $(PERL_TO_USE) -i -pe 's!\Q$$ENV{SRCDIR}\E/$(tmp)/!/! if /install/;' \
 	    -e 's/^(man1ext=).*/$$1'\''1p'\''/;' \
 	    -e 's/^(man3ext=).*/$$1'\''3pm'\''/;' \
 		$(lib)/Config.pm $(lib)/Config_heavy.pl
@@ -145,26 +212,26 @@
 	# see #657853
 	if which dpkg-buildflags >/dev/null 2>&1; then \
 		for flag in $(shell dpkg-buildflags --get CPPFLAGS) \
-		         $(shell dpkg-buildflags --get CFLAGS); do \
+		         $(shell dpkg-buildflags --get CFLAGS); do \$(PERL_TO_USE)
 			case "$$flag" in -fstack-protector) ;; \
-			     *) ./perl.static -i -pe "/^(cc|cpp)flags/ and \
+			     *) $(PERL_TO_USE) -i -pe "/^(cc|cpp)flags/ and \
 			          s/(['\s])\Q$$flag\E(['\s])/\1\2/ and s/  +/ /" \
 		            $(lib)/Config.pm $(lib)/Config_heavy.pl ;; \
 		    esac; done; \
 		for flag in $(shell dpkg-buildflags --get LDFLAGS); do \
-			./perl.static -i -pe "/^ld(dl)?flags/ and \
+			$(PERL_TO_USE) -i -pe "/^ld(dl)?flags/ and \
 			          s/(['\s])\Q$$flag\E(['\s])/\1\2/ and s/  +/ /" \
 		          $(lib)/Config.pm $(lib)/Config_heavy.pl ; \
 		done; \
 	fi
 
 	# convert required header files
-	-cd /usr/include; $(srcdir)/perl.static -I $(srcdir)/lib \
+	-cd $(HEADER_DIR); $(PERL_TO_USE) -I $(srcdir)/lib \
 	    $(srcdir)/utils/h2ph -a -d $(srcdir)/$(lib) \
 		`cat $(srcdir)/debian/headers`
 
 	# fix up generated headers
-	./perl.static -Ilib debian/fixheaders $(lib)
+	$(PERL_TO_USE) -Ilib debian/fixheaders $(lib)
 
 	# simple wrapper around Errno module
 	cp debian/errno.ph $(lib)
@@ -172,10 +239,10 @@
 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
 ifeq (,$(findstring x-perl-notest,$(DEB_BUILD_OPTIONS)))
 	# Verify that the headers are usable
-	for ph in `< debian/headers sed -e 's/\.h$$/.ph/'`; do \
-		if [ ! -f $(lib)/$$ph ]; then \
+	for ph in `< $(srcdir)/debian/headers sed -e 's/\.h$$/.ph/'`; do \
+		if [ ! -f $(srcdir)/$(lib)/$$ph ]; then \
 			echo "$$ph: missing"; else \
-			echo $$ph | ./perl.static debian/check-require $(tmp) \
+			echo $$ph | $(PERL_TO_USE) debian/check-require $(tmp) \
 				|| exit 1; \
 		fi; \
 	done
@@ -229,14 +296,14 @@
 		done) >debian/list.tmp; \
 	    (cd $(tmp); cpio -vdumpl ../build/$$p) <debian/list.tmp 2>&1 | \
 		grep -v ' linked to '; \
-	    (cd $(tmp); ../../perl.static -nle unlink) <debian/list.tmp; \
+	    (cd $(tmp); $(PERL_TO_USE) -nle unlink) <debian/list.tmp; \
 	done
 
 	# ensure that all file have been moved from debian/tmp
 	test `find $(tmp) ! -type d | wc -l` -eq 0
 
 	# move pod out of -base modules and into .pod files in -doc
-	./perl.static debian/splitdoc $(build)/perl-base
+	$(PERL_TO_USE) debian/splitdoc $(build)/perl-base
 
 	# create symlinks to match @INC
 	ln -s $(fullversion) $(build)/perl-base/usr/lib/$(archtriplet)/perl/$(version)
@@ -248,7 +315,7 @@
 
 	( shopt -s globstar; cd $(build)/perl-base; \
 	  find `grep -v '^#' $(srcdir)/debian/perl-base.files` ! -type d ) | \
-	  ./perl.static $(srcdir)/debian/check-require $(build)/perl-base
+	  $(PERL_TO_USE) $(srcdir)/debian/check-require $(build)/perl-base
 endif
 endif
 
@@ -294,7 +361,7 @@
 	cp debian/rename $(build)/perl/usr/bin/prename
 	chmod 755 $(build)/perl/usr/bin/prename
 
-	./perl.static -Ilib $(build)/perl-modules/usr/bin/pod2man --official \
+	$(PERL_TO_USE) -Ilib $(build)/perl-modules/usr/bin/pod2man --official \
 	    debian/rename >$(build)/perl/usr/share/man/man1/prename.1
 
 	# install docs
@@ -361,12 +428,12 @@
 			dir=$${path%/*}; \
 			test -d $(debug)$$dir || mkdir -p $(debug)$$dir; \
 			# stash debugging symbols \
-			objcopy --only-keep-debug $$f $(debug)$$path; \
+			$(OBJCOPY) --only-keep-debug $$f $(debug)$$path; \
 			# strip \
-			strip --remove-section=.comment --remove-section=.note \
+			$(STRIP) --remove-section=.comment --remove-section=.note \
 			    $$extra $$f; \
 			# add debuglink \
-			objcopy --add-gnu-debuglink=$(debug)$$path $$f; \
+			$(OBJCOPY) --add-gnu-debuglink=$(debug)$$path $$f; \
 		esac; \
 	    done
 	    # versioned hardlink for the detached debug symbols
@@ -409,7 +476,7 @@
 	$(checkdir)
 	$(checkroot)
 	rm -f debian/substvars
-	for p in `./perl.static -l -00ne 'print $$1 if /^Architecture:\s+all/m \
+	for p in `$(PERL_TO_USE) -l -00ne 'print $$1 if /^Architecture:\s+all/m \
 	    and /^Package:\s+(.*)/m' debian/control`; \
 	do \
 	    rm -rf $(build)/$$p/DEBIAN; \
@@ -437,7 +504,7 @@
 	echo 'libperl $(version) libperl$(version) (>= 5.14.2-13)' \
 	    >debian/libperl$(version).shlibs
 
-	for p in `./perl.static -l -00ne 'print $$1 if /^Architecture:\s+any/m \
+	for p in `$(PERL_TO_USE) -l -00ne 'print $$1 if /^Architecture:\s+any/m \
 	    and /^Package:\s+(.*)/m' debian/control`; \
 	do \
 	    rm -rf $(build)/$$p/DEBIAN debian/substvars; \
@@ -453,7 +520,7 @@
 		>$(build)/$$p/DEBIAN/md5sums; \
 	done
 	# dpkg-shlibdeps needs to be run only after all the shlibs are present
-	for p in `./perl.static -l -00ne 'print $$1 if /^Architecture:\s+any/m \
+	for p in `$(PERL_TO_USE) -l -00ne 'print $$1 if /^Architecture:\s+any/m \
 	    and /^Package:\s+(.*)/m' debian/control`; \
 	do \
 	    find $(build)/$$p/usr -type f \
diff -urN perl-5.14.2/Makefile.SH perl-5.14.2-ma-cross/Makefile.SH
--- perl-5.14.2/Makefile.SH	2013-02-12 03:15:39.000000000 +0000
+++ perl-5.14.2-ma-cross/Makefile.SH	2013-02-12 04:09:51.000000000 +0000
@@ -296,10 +291,12 @@
 OBJ_EXT = $_o
 PATH_SEP = $p_
 
+ifeq (,\$(CROSS_PERL))
 # Macros to invoke a copy of miniperl during the build.  Targets which
 # are built using these macros should depend on \$(MINIPERL_EXE)
 MINIPERL_EXE = miniperl\$(EXE_EXT)
 MINIPERL = \$(LDLIBPTH) \$(RUN) ./miniperl\$(EXE_EXT) -Ilib
+HOST_MINIPERL = $(MINIPERL_EXE)
 
 # Macros to invoke a copy of our fully operational perl during the build.
 PERL_EXE = perl\$(EXE_EXT)
@@ -308,6 +305,23 @@
 # Macros to run our tests
 RUN_TESTS = \$(LDLIBPTH) ./runtests
 
+else # CROSS_PERL
+
+# Macros to invoke a copy of miniperl during the build.  Targets which
+# are built using these macros should depend on \$(MINIPERL_EXE)
+MINIPERL_EXE = miniperl\$(EXE_EXT)
+MINIPERL = \$(CROSS_PERL)
+HOST_MINIPERL = \$(CROSS_PERL)
+
+# Macros to invoke a copy of our fully operational perl during the build.
+PERL_EXE = perl\$(EXE_EXT)
+RUN_PERL = \$(CROSS_PERL)
+
+# Macros to run our tests
+RUN_TESTS = echo "Not running tests"
+
+endif # CROSS_PERL
+
 dynamic_ext = $dynamic_list
 dynamic_ext_re = $dynamic_ext_re
 static_ext = $static_list
@@ -538,6 +552,9 @@
 	@echo " ";
 	@echo "	Everything is up to date. Type '$(MAKE) test' to run test suite."
 
+# Cross building requires a separate target to allow manipulation of the build tree
+extensions:     $(dynamic_ext) $(nonxs_ext)
+
 .PHONY: all translators utilities
 
 # Both git_version.h and lib/Config_git.pl are built
@@ -621,6 +638,9 @@
 
 globals$(OBJ_EXT): uudmap.h bitcount.h
 
+ifeq (,\$(CROSS_PERL))
+# If we're cross-building, we should have uudmap.h and bitcount.h
+# provided already
 uudmap.h: bitcount.h
 
 bitcount.h: generate_uudmap$(HOST_EXE_EXT)
@@ -628,6 +648,7 @@
 
 generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
 	$(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs)
+endif
 
 miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
 	$(CCCMD) $(PLDLFLAGS) $*.c
@@ -800,18 +821,30 @@
 	aix*|beos*)
 		$spitshell >>$Makefile <<'!NO!SUBS!'
 $(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
+ifeq (,$(CROSS_PERL))
 	$(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) \
 	    $(mini_obj) \
 	    miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
 	$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+else
+	-rm $(MINIPERL_EXE)
+	ln -s $(HOST_MINIPERL) $(MINIPERL_EXE)
+endif
+
 !NO!SUBS!
 		;;
 	next4*)
 		$spitshell >>$Makefile <<'!NO!SUBS!'
 $(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) perlmini$(OBJ_EXT) opmini$(OBJ_EXT)
+ifeq (,$(CROSS_PERL))
 	$(CC) -o $(MINIPERL_EXE) $(mini_obj) \
 	    miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
 	$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+else
+	-rm $(MINIPERL_EXE)
+	ln -s $(HOST_MINIPERL) $(MINIPERL_EXE)
+endif
+
 !NO!SUBS!
 		;;
 	darwin*)
@@ -830,20 +863,32 @@
 		$spitshell >>$Makefile <<'!NO!SUBS!'
 $(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
 	-@rm -f miniperl.xok
+ifeq (,$(CROSS_PERL))
 	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
 	    $(mini_obj) \
 	    miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
 	$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+else
+	-rm $(MINIPERL_EXE)
+	ln -s $(HOST_MINIPERL) $(MINIPERL_EXE)
+endif
+
 !NO!SUBS!
 		;;
 	*)
 		$spitshell >>$Makefile <<'!NO!SUBS!'
 $(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
 	-@rm -f miniperl.xok
+ifeq (,$(CROSS_PERL))
 	$(LDLIBPTH) $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
 	    $(mini_obj) \
 	    miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
 	$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+else
+	-rm $(MINIPERL_EXE)
+	ln -s $(HOST_MINIPERL) $(MINIPERL_EXE)
+endif
+
 !NO!SUBS!
 		;;
 	esac
