59.5. perl-xml-parser-2.59
Expat-based XML parser module for perl
| Version | 2.59, release 1 |
| Shelf | perl-cpan — The perl interpreter and every perl-* CPAN module |
| Phase | 30_foundation (Build Foundation), 98 of 127 in build order |
| Licence | Artistic-1.0-Perl OR GPL-1.0-or-later |
| Homepage | https://metacpan.org/dist/XML-Parser |
| Build time | 0.1 SBU |
| Installed size | 522.9 KiB in 41 files |
| Recipe | ports/core/perl-cpan/perl-xml-parser/kpkgbuild |
About
XML::Parser is Perl’s binding to expat, the stream-oriented XML parser in C: an XS module, XML::Parser::Expat, compiled against libexpat, with the higher-level XML::Parser and its parsing styles on top. Beyond the encodings expat knows itself, it reads the others from encoding maps, .enc files shipped in the release and installed as the distribution’s shared files under auto/share/dist/XML-Parser, where it finds them with File::ShareDir. Those maps are among the data files with no other source form the tree carries.
intltool, the tool that extracts translatable strings from source files, needs it, and intltool is in 30_foundation, so this module and the modules it needs are built there too. Later on, xmltoman, libpulse, perl-xml-simple, Xfce’s exo, libxfce4ui and xfconf, and GTK applications such as gnumeric and brasero depend on it.
Sources
perl-xml-parser-2.59.tar.gz(461.6 KiB)
sha256a358fd7c49f5e27717a644a9102bd21dc7fc25a415983279c59b1580e2b62a58
upstream: https://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.59.tar.gz
archive copy: sources-3/perl-cpan--perl-xml-parser-2.59.tar.gz
Dependencies
Depends on: expat, perl, perl-file-sharedir, perl-file-sharedir-install.
Required by (12): brasero, exo, glabels, gnumeric, gpredict, homebank, intltool, libpulse, libxfce4ui, perl-xml-simple, xfconf, xmltoman.
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-xml-parser'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/perl-cpan/perl-xml-parser.
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-xml-parser
echo 'a358fd7c49f5e27717a644a9102bd21dc7fc25a415983279c59b1580e2b62a58 perl-xml-parser-2.59.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-xml-parser
SRC=$SRC_ROOT/perl-xml-parser-2.59
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf perl-xml-parser-2.59.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-xml-parser, 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-xml-parser-2.59-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-xml-parser, and runs the triggers its paths call for.
Contents
Installed directories: /usr/lib/perl5/vendor_perl/XML, /usr/lib/perl5/vendor_perl/auto/XML, /usr/lib/perl5/vendor_perl/auto/share, /usr/share/licenses/perl-xml-parser.
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.
Makefile.PL finds expat through pkg-config and then checks that expat.h and libexpat compile and link. When they do not, it prints “Expat must be installed prior to building XML::Parser” and exits successfully without writing a Makefile, so the failure shows up in the log one step later, as make finding nothing to build. Read the perl Makefile.PL output first.
Expat.so carries no run path even though it links libexpat, because the perl port’s liblist-default-dirs.patch keeps /usr/lib out of MakeMaker’s LD_RUN_PATH.