59.4. perl-file-sharedir-1.118
Locate per-distribution and per-module shared files of perl modules
| Version | 1.118, release 1 |
| Shelf | perl-cpan — The perl interpreter and every perl-* CPAN module |
| Phase | 30_foundation (Build Foundation), 97 of 127 in build order |
| Licence | Artistic-1.0-Perl OR GPL-1.0-or-later |
| Homepage | https://metacpan.org/dist/File-ShareDir |
| Build time | 0.1 SBU |
| Installed size | 49.0 KiB in 6 files |
| Recipe | ports/core/perl-cpan/perl-file-sharedir/kpkgbuild |
About
File::ShareDir is the run-time half of the shared-files convention for Perl: given a distribution or a module name, it returns the directory that distribution’s data files were installed in, under auto/share in Perl’s module tree. It uses Class::Inspector to find an installed module’s file, and is built with File::ShareDir::Install, which installs its own sample files.
In the tree it is there for perl-xml-parser: XML::Parser’s Expat module calls File::ShareDir::dist_dir('XML-Parser') to find its .enc encoding maps.
Sources
perl-file-sharedir-1.118.tar.gz(28.9 KiB)
sha2563bb2a20ba35df958dc0a4f2306fc05d903d8b8c4de3c8beefce17739d281c958
upstream: https://cpan.metacpan.org/authors/id/R/RE/REHSACK/File-ShareDir-1.118.tar.gz
archive copy: sources-3/perl-cpan--perl-file-sharedir-1.118.tar.gz
Dependencies
Depends on: perl, perl-class-inspector, perl-file-sharedir-install.
Required by (1): 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'
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.
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
echo '3bb2a20ba35df958dc0a4f2306fc05d903d8b8c4de3c8beefce17739d281c958 perl-file-sharedir-1.118.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
SRC=$SRC_ROOT/perl-file-sharedir-1.118
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf perl-file-sharedir-1.118.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, 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-1.118-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, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/perl-file-sharedir, /usr/share/perl5/vendor_perl/auto.
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.