59.3. perl-file-sharedir-install-0.14
Install shared files of a perl distribution — the configure-time half of File::ShareDir
| Version | 0.14, release 1 |
| Shelf | perl-cpan — The perl interpreter and every perl-* CPAN module |
| Phase | 30_foundation (Build Foundation), 96 of 127 in build order |
| Licence | Artistic-1.0-Perl OR GPL-1.0-or-later |
| Homepage | https://metacpan.org/dist/File-ShareDir-Install |
| Build time | 0.1 SBU |
| Installed size | 36.6 KiB in 3 files |
| Recipe | ports/core/perl-cpan/perl-file-sharedir-install/kpkgbuild |
About
File::ShareDir::Install is the build-time half of File::ShareDir. A distribution’s Makefile.PL calls it to declare a directory of data files, such as XML::Parser’s encoding maps, and it adds the rules that install them under auto/share/dist/<distribution> in Perl’s module tree, where File::ShareDir finds them at run time. It is pure Perl and installs no program.
Two ports in the tree name it in depends. perl-xml-parser’s Makefile.PL loads it with a plain use, so XML::Parser cannot even be configured without it. perl-file-sharedir loads it through inc::latest, which takes the newer of this installed copy and the one bundled in File::ShareDir’s own inc/ directory, to install its sample files.
Sources
perl-file-sharedir-install-0.14.tar.gz(30.9 KiB)
sha2568f9533b198f2d4a9a5288cbc7d224f7679ad05a7a8573745599789428bc5aea0
upstream: https://cpan.metacpan.org/authors/id/E/ET/ETHER/File-ShareDir-Install-0.14.tar.gz
archive copy: sources-3/perl-cpan--perl-file-sharedir-install-0.14.tar.gz
Dependencies
Depends on: perl.
Required by (2): perl-file-sharedir, perl-xml-parser.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install perl-file-sharedir-install'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/perl-cpan/perl-file-sharedir-install.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/perl-cpan/perl-file-sharedir-install
echo '8f9533b198f2d4a9a5288cbc7d224f7679ad05a7a8573745599789428bc5aea0 perl-file-sharedir-install-0.14.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/perl-file-sharedir-install
SRC=$SRC_ROOT/perl-file-sharedir-install-0.14
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf perl-file-sharedir-install-0.14.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
perl Makefile.PL INSTALLDIRS=vendor
make
make DESTDIR=$PKG install
find "$PKG" -name .packlist -delete
find "$PKG" -name perllocal.pod -delete
find "$PKG" -type d -empty -delete
The switches, and why each is set:
INSTALLDIRS=vendor— install into Perl’s vendor directories rather than MakeMaker’s default, the site ones. The perl port sets them to/usr/share/perl5/vendor_perlfor pure-Perl modules and/usr/lib/perl5/vendor_perlfor compiled ones; the site directories are left to modules a machine’s owner installs by hand, and no package writes there.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/perl-file-sharedir-install, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf perl-file-sharedir-install-0.14-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/perl-file-sharedir-install, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/perl-file-sharedir-install, /usr/share/perl5/vendor_perl/File/ShareDir.
Notes
make install writes two records of its own, and build.sh deletes both from $PKG: a .packlist listing the files the distribution installed, and perllocal.pod, a file in Perl’s archlib to which every MakeMaker install appends an entry. kpkg’s database already records what the package installed, and perllocal.pod is one path that every perl-* package would carry, which kpkg refuses once a second package claims it. The last find then removes the directories those deletions leave empty.