The debian/rules patch has been updated: https://raw.github.com/codehelp/perl-cross-debian/master/patches/debian/rules.diff
(also attached for those who want to cross-build perl for testing) However, there is some more to do with the extension install operations and I've also got some checks to do on an upstream proposal for the Makefile.SH upstream patch. I'll continue working on the cross support and see what can be done to clean up the extensions / installation issues. -- Neil Williams ============= http://www.linux.codehelp.co.uk/
--- /home/neil/code/debian/src/perl/cross/original-5.14.2/perl-5.14.2/debian/rules
+++ /home/neil/code/debian/src/perl/cross/5-14-test/perl-5.14.2/debian/rules
@@ -35,29 +35,64 @@
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
+ OBJCOPY = objcopy
+ STRIP = strip
+ export ZLIB_INCLUDE=/usr/include
+ export ZLIB_LIB=/usr/lib
+ export BZIP2_INCLUDE=/usr/include
+ export BZIP2_LIB=/usr/lib
+ export INCLUDE=/usr/include
+ export LIB=/usr/lib
+else
+ HOST_PERL = $(shell which perl)
+ PERL_TO_USE = $(HOST_PERL)
+ HOST_PERL_LIBS = /usr/lib/perl/$(package_upstream_version)
+ HEADER_DIR = /usr/$(DEB_HOST_GNU_TYPE)/include
+ OBJCOPY = $(DEB_HOST_GNU_TYPE)-objcopy
+ STRIP = $(DEB_HOST_GNU_TYPE)-strip
+ export ZLIB_INCLUDE=/usr/$(DEB_HOST_GNU_TYPE)/include
+ export ZLIB_LIB=/usr/$(DEB_HOST_GNU_TYPE)/lib
+ export BZIP2_INCLUDE=/usr/$(DEB_HOST_GNU_TYPE)/include
+ export BZIP2_LIB=/usr/$(DEB_HOST_GNU_TYPE)/lib
+ export INCLUDE=/usr/$(DEB_HOST_GNU_TYPE)/include
+ export LIB=/usr/$(DEB_HOST_GNU_TYPE)/lib
+endif
+
# 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)
# for cpan/Compress-Raw-Zlib
export BUILD_ZLIB=False
-export ZLIB_INCLUDE=/usr/include
-export ZLIB_LIB=/usr/lib
# for cpan/Compress-Raw-Bzip2
export BUILD_BZIP2=0
-export BZIP2_INCLUDE=/usr/include
-export BZIP2_LIB=/usr/lib
build: build-stamp
install: install-stamp
@@ -76,40 +111,62 @@
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/shlibs.local \
debian/perl-base.shlibs debian/libperl$(version).shlibs \
@@ -117,17 +174,31 @@
# <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
+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"
+ 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
@@ -138,24 +209,24 @@
for flag in $(shell dpkg-buildflags --get CPPFLAGS) \
$(shell dpkg-buildflags --get CFLAGS); do \
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)
@@ -163,10 +234,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
@@ -213,14 +284,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/perl/$(version)
@@ -231,7 +302,7 @@
# Verify that perl-base stays self contained
# plain "use IO " and "use re" are deprecated and/or useless
- ./perl.static $(srcdir)/debian/check-require $(build)/perl-base \
+ $(PERL_TO_USE) $(srcdir)/debian/check-require $(build)/perl-base \
< debian/perl-base.files
endif
endif
@@ -269,7 +340,7 @@
cp debian/rename $(build)/perl/usr/bin/prename
chmod 755 $(build)/perl/usr/bin/prename
- ./perl.static -Ilib $(build)/perl/usr/bin/pod2man --official \
+ $(PERL_TO_USE) -Ilib $(build)/perl/usr/bin/pod2man --official \
debian/rename >$(build)/perl/usr/share/man/man1/prename.1
# install docs
@@ -336,12 +407,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
@@ -384,7 +455,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; \
@@ -420,7 +491,7 @@
>debian/perl-base.shlibs
endif
- 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; \
@@ -436,7 +507,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 \
pgpN4wv5kv9LS.pgp
Description: PGP signature

