Using perl to build perl

Brendan O'Dea bod at c47.org
Sun Apr 17 06:49:46 UTC 2016


On 16 April 2016 at 19:20, Niko Tyni <ntyni at debian.org> wrote:
> For a long time, src:perl has had some limited support for bootstrapping a
> new architecture without /usr/bin/perl.  We've gone to quite some trouble
> to avoid needing perl to build perl as far as possible, including quite
> a few sed scripts and a 600-line monstrous debian/rules file so we don't
> need debhelper. However, things like dpkg-shlibdeps and dpkg-gencontrol
> which are required for building .deb packages are #!/usr/bin/perl scripts,
> so this is arguably somewhat ineffective.

This was added at the request of porters in 2001 or so.  I can't find
anything in my mail archives from the time, so I suspect that the
conversation was on IRC and would guess one of ia64 or hppa which were
the ports in flight around that time.

Initially I just included a subset of debhelper, which I updated
periodically to break a circular build-dependency b/w perl and
debhelper, but eventually removed the debhelper bits entirely, and
arranged debian/rules such that perl was not used at all until
perl.static was available, and checkperl was run prior to any indirect
execution (dpkg-shlibdeps, dpkg-gencontrol) with instructions to make
those work: in hindsight, those could have probably been silently
handled by executing them using the built perl.static.

At the time this was definitely tested in a chroot, but skimming the
rules file now I can see that there are places where stuff has crept
in: use of dpkg-architecture and dpkg-parsechangelog stick out
immediately.

> So if we started to build-depend on debhelper and therefore transitively
> perl, would anybody actually care?

I'm fairly confident that there would be complaints if you made that change:

  https://wiki.debian.org/DebianBootstrap
  https://wiki.debian.org/CircularBuildDependencies

This looks interesting though:

  https://wiki.debian.org/BuildProfileSpec

It appears that it may be possible to do something like this:

  Package: perl-stage1
  Build-Profiles: <stage1>
  Architecture: any
  ...

  Package: perl-base
  Build-Profiles: <!stage1>
  Architecture: any
  Conflicts: perl-stage1
  Replaces: perl-stage1
  ...

similarly add "Build-Profiles: <!stage1>" to all other packages.  Then
change debian/rules to contain:

  ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
    include debian/rules.stage1
  else
    include debian/rules.standard
  endif

debian/rules.standard would contain what debian/rules does now, but
cleaned up to use debhelper.

A basic debian/rules.stage1 is attached.  It's not particularly
pretty, but appears to work and shouldn't need to change much.

I presume that once all of this is done, debhelper can then depend on
"perl | perl-stage1", which would allow the normal perl packages to
build-depend on debhelper.

Looping in Wookey who from the authorship of some of those documents
may be able to add more knowledgeable suggestions.

--bod
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rules.stage1
Type: application/octet-stream
Size: 1100 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/perl-maintainers/attachments/20160417/f8e2006b/attachment.obj>


More information about the Perl-maintainers mailing list