59.1. perl-5.44.0
The Perl programming language
| Version | 5.44.0, release 1 |
| Shelf | perl-cpan — The perl interpreter and every perl-* CPAN module |
| Phase | 30_foundation (Build Foundation), 14 of 127 in build order |
| Licence | Artistic-1.0-Perl OR GPL-1.0-or-later |
| Homepage | https://www.perl.org/ |
| Build time | 2.2 SBU |
| Installed size | 69.5 MiB in 2883 files |
| Recipe | ports/core/perl-cpan/perl/kpkgbuild |
About
Perl 5, the interpreter, its core modules and its documentation tools (perldoc, pod2man, cpan, h2xs and the rest). Much of the build runs on it without naming it: automake, autoconf’s helper scripts, OpenSSL’s Configure, pod2man for manual pages, and the generators in many upstream build systems. perl is one of the tools 30_foundation installs first, before any shelf: the phase list names it among “the build tools recipes reach for without naming them in depends”; see the pinned run in that phase’s part. Every perl-* port, such as perl-xml-parser, builds its modules against this interpreter.
The module directories come in three sets: the core library in core_perl, packaged CPAN modules in vendor_perl, and modules installed by hand in site_perl, each with a /usr/share/perl5 half for pure-Perl files and a /usr/lib/perl5 half for compiled ones. The interpreter is threaded and shared. build.sh also writes a config.over that fixes the host name, kernel version and build time Configure would otherwise take from the build machine, so the recorded configuration is the same wherever it is built. Why each of these is set, and what it means for a perl-* recipe, is under Python, Perl, Haskell, Node and OCaml modules and in the perl-cpan notes of the ports catalogue.
Why it is in KDOS
The comment above the 24 ports from fortify-headers to musl-utils in script/phases/30_foundation/packages.txt is quoted in The build foundation.
Sources
perl-5.44.0.tar.gz(20.3 MiB)
sha2563b855066b92491cb40e86affb1ca57d1a388aa43e51b91c7806a32c2f65f96c3
upstream: https://www.cpan.org/src/5.0/perl-5.44.0.tar.gz
archive copy: sources-3/perl-cpan--perl-5.44.0.tar.gz
Dependencies
Depends on: zlib, bzip2, gdbm.
Required by (125): autoconf, black-hole-solver, ca-certificates, calligra, ccache-manual, ccid, chromium, crawl-tiles, curl, darktable, docx2txt, dvd+rw-tools, exiftool, ffmpeg, foomatic-db-engine, fprintd, freecell-solver, fuse-emulator, gimp, gimp-help, git, glibmm, glibmm2.66, gnucash, groff, gtk-vnc, help2man, hunspell-en, hyphen, i2c-tools, inkscape, isync, jemalloc, kcachegrind, kde-dev-scripts, kdesdk-kio, kdoctools, klickety, koreader, libcerf, libgd, libhubbub, libical, libnbd, libosinfo, libparserutils, libpulse, libspectrum, libstoragemgmt, libtpms, libvirt, libvisio, linux, lmms, mosh, mumble, mythes, nbdkit, netpbm, netsurf, octave, openblas, openssl, openssl3, osinfo-db-tools, parallel, pari, pcsc-lite, perf, perl-authen-sasl, perl-class-inspector, perl-crypt-urandom, perl-db-file, perl-digest-hmac, perl-file-homedir, perl-file-sharedir, perl-file-sharedir-install, perl-file-which, perl-font-ttf, perl-io-socket-ssl, perl-io-string, perl-mime-base32, perl-net-ssleay, perl-parse-yapp, perl-uri, perl-xml-parser, perl-xml-simple, perl-yaml-tiny, postgresql, qca-qt5, qdirstat, qemu, qt5-qtbase, qt6-qtwebengine, qtforkawesome, qv4l2, R, samba, schismtracker, sdl3, sdl3-image, sdl3-mixer, sdl3-ttf, sleuthkit, snowball, spice-gtk, spooles, swtpm, syntax-highlighting, texinfo, texlive, texlive-doc, tlp, ttf-dejavu, v4l-utils, valgrind, verilator, vice, w3m, webkitgtk, webkitgtk6, weechat, whois, wine, xmltoman.
Patches
build.sh applies these; kpkg applies nothing by itself.
liblist-default-dirs.patch— changes ExtUtils::MakeMaker’sExtUtils/Liblist/Kid.pm, the code that turns an XS module’s-lflags into a link line. It adds the directory of every shared library it finds toLD_RUN_PATH, which becomes the module’s run path; the patch skips/liband/usr/lib, where the dynamic linker looks anyway. Without it every XS module linked against a system library would carry a/usr/librun-path entry, which the package lint warns on (see What the package lint refuses).
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'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/perl-cpan/perl.
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
echo '3b855066b92491cb40e86affb1ca57d1a388aa43e51b91c7806a32c2f65f96c3 perl-5.44.0.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
SRC=$SRC_ROOT/perl-5.44.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf perl-5.44.0.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 recipe’s helpers devseries and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 --no-backup-if-mismatch -i "$PORT_SRC/liblist-default-dirs.patch"
export BUILD_ZLIB=False BUILD_BZIP2=0
_kver=$(awk '$2 == "LINUX_VERSION_CODE" { c = $3; printf "%d.%d.%d", int(c / 65536), int(c / 256) % 256, c % 256 }' /usr/include/linux/version.h)
_time=$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH")
cat > config.over <<EOF
myhostname='localhost'
mydomain='.localdomain'
cf_email='root@localhost'
perladmin='root@localhost'
cf_by='kdos'
osvers='$_kver'
myuname='linux localhost $_kver x86_64'
cf_time='$_time'
EOF
./Configure -des \
-Dprefix=/usr \
-Dvendorprefix=/usr \
-Dprivlib=/usr/share/perl5/core_perl \
-Darchlib=/usr/lib/perl5/core_perl \
-Dsitelib=/usr/share/perl5/site_perl \
-Dsitearch=/usr/lib/perl5/site_perl \
-Dvendorlib=/usr/share/perl5/vendor_perl \
-Dvendorarch=/usr/lib/perl5/vendor_perl \
-Dman1dir=/usr/share/man/man1 \
-Dman3dir=/usr/share/man/man3 \
-Dman3ext=3pm \
-Doptimize="$CFLAGS" \
-Dldflags="$LDFLAGS" \
-Dlddlflags="-shared $LDFLAGS" \
-Duseshrplib \
-Dusethreads \
-Dloclibpth=' ' \
-Dlocincpth=' ' \
-Dglibpth='/usr/lib' \
-Ui_db \
-Ud_eaccess -Ud_euidaccess
make
make DESTDIR=$PKG install
ln -s perl5/core_perl/CORE/libperl.so $PKG/usr/lib/libperl.so
The switches, and why each is set:
BUILD_ZLIB— set toFalse, withBUILD_BZIP2=0beside it, in the environmentConfigureandmakeinherit. The core modules Compress::Raw::Zlib and Compress::Raw::Bzip2 then link the system’slibzandlibbz2, from zlib and bzip2, instead of compiling the copies of those libraries bundled in their source directories.-des— threeConfigureoptions:-dtakes the default answer to every question,-egoes on past writingconfig.shwithout stopping, and-sprints only the essentials. Together they runConfigureunattended.-Dprefix=/usr— with-Dvendorprefix=/usr, the install prefix of the interpreter and of packaged modules.-Dprivlib— with-Darchlib,-Dvendorlib,-Dvendorarch,-Dsiteliband-Dsitearch: the six module directories.privlib,vendorlibandsitelibhold pure-Perl modules under/usr/share/perl5/{core,vendor,site}_perl;archlib,vendorarchandsitearchhold compiled ones, and theCOREdirectory withlibperl.soand the headers, under/usr/lib/perl5/{core,vendor,site}_perl. Aperl-*port installs into the vendor pair withINSTALLDIRS=vendor; the site pair is left to the machine’s owner, and no package writes there.-Dman1dir=/usr/share/man/man1— with-Dman3dir=/usr/share/man/man3: where the program and module manual pages go.-Dman3ext=3pm— module pages get the section suffix3pm, soFile::Spec’s page cannot share a name with a C library’s section 3 page.-Doptimize="$CFLAGS"— with-Dldflags="$LDFLAGS"and-Dlddlflags="-shared $LDFLAGS": the tree’s compiler and linker flags.Configurereads neitherCFLAGSnorLDFLAGSfrom the environment, and the values given here are recorded inConfig, so every XS module built later compiles and links with them as well.-Duseshrplib— build the interpreter as a sharedlibperl.soinstead of the default staticlibperl.a.perllinks it, and so can programs that embed Perl: in this tree, postgresql’s PL/Perl (--with-perl) and perf (LIBPERL=1).-Dusethreads— a threaded interpreter, archnamex86_64-linux-thread-multi. An XS module is compiled for that ABI, so with this switch changed everyperl-*port with C in it has to be rebuilt.-Dloclibpth=' '— with-Dlocincpth=' 'and-Dglibpth='/usr/lib': the library and include directoriesConfiguresearches and records. Its defaults list/usr/local/lib,/usr/local/include,/opt/localand the GNU directories (/usr/gnu,/opt/gnu), and itsglibpthadds/usr/ccs/lib,/usr/ucbliband/usr/local/libto/liband/usr/lib; set to blank and to/usr/libalone, they keep every such path out of the recorded flags that each XS build reuses.-Ui_db— leave Berkeley DB out:Configurewould build theDB_Filemodule whenever it findsdb.h, so the result would depend on what the build tree held.DB_Fileis the perl-db-file port, built once db exists.-Ud_eaccess— recordeaccess()as absent, although musl declares and provides it. Under theuse filetest 'access'pragma, Perl’s-r,-wand-xtests for the effective user then use its own emulation, which swaps the real and effective IDs around a plainaccess()call, instead of callingeaccess().Configurehas no variable namedd_euidaccess, so-Ud_euidaccessbeside it sets nothing; it appears inconfig.shonly among the recordedconfig_args.
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, 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-5.44.0-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, and runs the triggers its paths call for.
Contents
Installed programs: corelist, cpan, enc2xs, encguess, h2ph, h2xs, instmodsh, json_pp, libnetcfg, perl, perl5.44.0, perlbug, perldoc, perlivp, perlthanks, piconv, pl2pm, pod2html, pod2man, pod2text, pod2usage, podchecker, prove, ptar, ptardiff, ptargrep, shasum, splain, streamzip, xsubpp, zipdetails.
Installed libraries: libperl.so.
Installed directories: /usr/lib/perl5/core_perl, /usr/lib/perl5/site_perl, /usr/share/licenses/perl, /usr/share/perl5/core_perl, /usr/share/perl5/site_perl.
Short descriptions
corelist |
a commandline frontend to Module::CoreList |
cpan |
easily interact with CPAN from the command line |
enc2xs |
Perl Encode Module Generator |
encguess |
guess character encodings of files |
h2ph |
convert .h C header files to .ph Perl header files |
h2xs |
convert .h C header files to Perl extensions |
instmodsh |
A shell to examine installed modules |
json_pp |
JSON::PP command utility |
libnetcfg |
configure libnet |
perl |
The Perl 5 language interpreter |
perlbug |
how to submit bug reports on Perl |
perldoc |
Look up Perl documentation in Pod format. |
perlivp |
Perl Installation Verification Procedure |
perlthanks |
how to submit bug reports on Perl |
piconv |
iconv(1), reinvented in perl |
pl2pm |
Rough tool to translate Perl4 .pl files to Perl5 .pm modules |
pod2html |
convert .pod files to .html files |
pod2man |
Convert POD data to formatted *roff input |
pod2text |
Convert POD data to formatted ASCII text |
pod2usage |
print usage messages from embedded pod docs in files |
podchecker |
check the syntax of POD format documentation files |
prove |
Run tests through a TAP harness. |
ptar |
a tar-like program written in perl |
ptardiff |
program that diffs an extracted archive against an unextracted one |
ptargrep |
Apply pattern matching to the contents of files in a tar archive |
shasum |
Print or Check SHA Checksums |
splain |
produce verbose warning diagnostics |
streamzip |
create a zip file from stdin |
xsubpp |
compiler to convert Perl XS code into C code |
zipdetails |
display the internal structure of zip files |
Notes
config.over is a file Configure reads last, after its own probes, so the values in it win. build.sh writes the host name and domain (localhost, .localdomain), the administrator’s address, cf_by='kdos', the kernel version taken from the installed kernel headers (/usr/include/linux/version.h) rather than from uname, and cf_time from SOURCE_DATE_EPOCH. Without it, Config_heavy.pl and CORE/config.h would record the build machine’s name, running kernel and the time of the build, and two builds of the same recipe would differ.
The final ln -s puts libperl.so in /usr/lib as a link to the real library in CORE/, so a program that embeds Perl links with a plain -lperl and loads it at run time with no run path of its own.
GDBM_File, NDBM_File and ODBM_File are built only when Configure finds the headers they need (i_gdbm for the first; ndbm.h and dbm.h, which gdbm’s compatibility layer provides, for the other two), so like DB_File they follow what is installed. gdbm is in depends, so it is installed first: GDBM_File links libgdbm, and NDBM_File and ODBM_File link libgdbm_compat.