Bug#633884: Makefile.SH and debian/rules update

Neil Williams codehelp at debian.org
Mon Dec 17 20:37:26 UTC 2012


block 633884 by 696189
thanks

(Updating this bug to reflect the available support in perl-cross-debian
to simplify the cross-building support for perl.)

Some of the background has already discussed with the perl
maintainers during the development of perl-cross-debian and now that
perl-cross-debian is in experimental, we can continue the process in
the BTS. The process needs more testing - especially runtime testing of
the cross-built perl packages. There are steps upstream to improve perl
cross-building [0] and there appears to be some overlap between how
this upstream support can be implemented and how perl-cross-debian can
support cross-building in the meantime.

The attached patches are the parts of perl-cross-debian support which
need to be patched into perl - Makefile.SH for avoiding the execution
of cross-built binaries alongside the use of pre-configured config data
and changes to debian/rules to replace calls to perl.static with a
variable to support calling /usr/bin/perl when cross-building.

The patches themselves have evolved since #285559 was filed against
perl 5.8.4 and updated for #633884 - there are elements of the
current patches which are historical.

Nearly all of the changes to Makefile.SH are isolated within
conditionals utilising CROSS_PERL except one - the extensions target.
This could do with some more testing but it is mainly to support the
alternative extensions build target to avoid some of the work needed by
the 'all' target. It could also be useful in the generation of the cache
files themselves as the content of the generated headers are common to
some combinations of architecture. It *should* make it easier to
prevent the kind of errors which have tripped me up once already. [1]
I hope to use this target *on native* machines to only generate the
extensions data to try and debug similar problems.

debian/rules has a wider range of changes. The current set are
predicated on dpkg-cross style cross-dependency paths. It should be
possible to detect MultiArch paths simply by checking for certain
directories but that can be added later.

The changes to debian/rules move the current setting of INCLUDE and LIB
alongside the setting of ZLIB_INCLUDE and BZIP2_INCLUDE etc. With
MultiArch support, it could be worth testing if these are historical or
still necessary as the headers are arch-independent (currently).

HOST_PERL_LIBS is set to the package_upstream_version because perl has
problems trying to cross-build one version or perl using the native
perl binaries from a different version. DynaLoader was the first to
fail when I was testing this. perl-cross-debian checks that these
versions match.

perl-cross-debian is not (and isn't expected to be) a build-dependency
of perl (cross build or not) but that's expected with cross-builds.
Cross-builders are used to less-than-graceful failures - the fact that
the cross-build will fail noisily if perl-cross-debian is not installed
is actually a bonus because it will fail early. 

Installing the cross-compiler itself is a largely undocumented
process...

After perl-cross-debian is called, the cross-build calls perl directly.
This may seem inconsistent but the other uses of PERL_TO_USE are mainly
to allow for use in both native and cross builds. perl-cross-debian
itself isn't called using PERL_TO_USE and it is a perl script.

> > +       $(MAKE) perl $(test_target)  CROSS_PERL=$(HOST_PERL)
> > +       mv libperl.a libperl-static

The explanation for this is that $(test_target) is empty for a
cross-build via the DEB_BUILD_OPTIONS="nocheck" and
debian/config.debian --test-target. perl-cross-debian checks for this
variable and fails the build if it is not set.

I can attach compressed build logs of the 5.14 and 5.16 cross-build, if
that is useful.

> > -       ./perl.static -Ilib -V
> > +       $(PERL_TO_USE) -Ilib -V

This does work - running the host perl with the cross Config.pm and the
rest. It's one of the reasons why the versions of the cross perl build
and the host perl must match.

> > +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

I will try and get some more testing done on whether the overwriting is
the right thing to do or whether the extensions need to be deleted or
made unreadable with chmod -r.

> > -           debian/substvars debian/files debian/list.tmp $(tmp) $(build)
> > +           debian/substvars debian/files debian/list.tmp $(tmp) $(build) \
> > +               Configure.cross config.sh config.h xconfig.h uudmap.h bitcount.h
> 

This is a bug in perl-cross-debian - the knowledge of which files are
to be deleted lives within perl-cross-debian, so it needs to clean
these too. Same with Cross/$(DEB_HOST_GNU_TYPE)/*.new

> > +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)

This section could do with some more testing. I'm not sure how much
testing the cross-built extensions will actually receive, other than
what is needed to use them to build perl natively.

OK, what I think I need to do is sort out a few bug fixes in
perl-cross-debian, get more people doing testing by applying (and
possibly improving) a patch from perl-cross-debian for debian/rules in
perl, then updating #633884.

I don't mind carrying patches for debian/rules during the testing but
if we can get Makefile.SH patched in 5.16, that will make things a lot
easier.

Hence, blocking this bug with the perl-cross-debian bug which will then
result in an updated patch for debian/rules.


[0]
http://news.perlfoundation.org/2012/05/grant-application-improving-cr.html
[1]
https://github.com/codehelp/perl-cross-debian/commit/fbdbdcfb3c8e900466fdfb4b36944593dd528ae9

-- 


Neil Williams
=============
http://www.linux.codehelp.co.uk/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cross-Makefile.diff
Type: text/x-diff
Size: 4040 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/perl-maintainers/attachments/20121217/00c4ef82/attachment-0002.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rules.diff
Type: text/x-diff
Size: 11839 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/perl-maintainers/attachments/20121217/00c4ef82/attachment-0003.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/perl-maintainers/attachments/20121217/00c4ef82/attachment-0001.pgp>


More information about the Perl-maintainers mailing list