8.52. Perl-5.40.1

The Perl package contains the Practical Extraction and Report Language.

Approximate build time: 1.3 SBU
Required disk space: 245 MB

8.52.1. Installation of Perl

Create the PKGBUILD for the Perl package with the following commands:

mkdir /sources/perl
cd /sources/perl
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="perl"
pkgver="5.40.1"
pkgrel="1"
pkgdesc="The Perl package contains the Practical Extraction and Report Language."
arch=('x86'
      'x86_64')
url="https://www.perl.org/"
license=('GPLv1')
groups=('core')
depends=('db'
         'gdbm'
         'glibc'
         'rootfs')
makedepends=('bash'
             'binutils'
             'coreutils'
             'gawk'
             'gcc'
             'grep'
             'groff'
             'make'
             'sed'
             'zlib')
checkdepends=('iana-etc'
              'less'
              'procps-ng')
source=('https://www.cpan.org/src/5.0/perl-5.40.1.tar.xz')
md5sums=('bab3547a5cdf2302ee0396419d74a42e')
    
build()
  cd ${pkgname}-${pkgver}

  # This version of Perl builds the Compress::Raw::Zlib and
  # Compress::Raw::BZip2 modules. By
  # default Perl will use an internal copy of the sources for the build.
  # Issue the following command so that Perl will use the libraries
  # installed on the system:
  export BUILD_ZLIB=False
  export BUILD_BZIP2=0

  sh Configure -des                                          \
               -D prefix=/usr                                \
               -D vendorprefix=/usr                          \
               -D privlib=/usr/lib/perl5/5.40/core_perl      \
               -D archlib=/usr/lib/perl5/5.40/core_perl      \
               -D sitelib=/usr/lib/perl5/5.40/site_perl      \
               -D sitearch=/usr/lib/perl5/5.40/site_perl     \
               -D vendorlib=/usr/lib/perl5/5.40/vendor_perl  \
               -D vendorarch=/usr/lib/perl5/5.40/vendor_perl \
               -D man1dir=/usr/share/man/man1                \
               -D man3dir=/usr/share/man/man3                \
               -D pager="/usr/bin/less -isR"                 \
               -D useshrplib                                 \
               -D usethreads
  make
}

check(){
  cd ${pkgname}-${pkgver}

  # Same as before
  export BUILD_ZLIB=False
  export BUILD_BZIP2=0

  TEST_JOBS=$(nproc) make test_harness
}

package(){
  cd ${pkgname}-${pkgver}

  # Same as before
  export BUILD_ZLIB=False
  export BUILD_BZIP2=0

  make DESTDIR=${pkgdir} install  
}
REALEOF

The meaning of the new Configure options:

-D pager="/usr/bin/less -isR"

This ensures that less is used instead of more.

-D man1dir=/usr/share/man/man1 -D man3dir=/usr/share/man/man3

Since Groff is not installed yet, Configure will not create man pages for Perl. These parameters override this behavior.

-D usethreads

Build Perl with support for threads.

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp perl-5.40.1-1-$(uname -m).pkg.tar.xz \                           /srv/pacman/repos/LFS/                                                                                               repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \                                                                                   /srv/pacman/repos/LFS/perl-5.40.1-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Perl package:

pacman -Syu
pacman -S perl --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/perl
cp PKGBUILD /srv/pacman/source/LFS/perl
cd /sources
rm -rf perl

8.52.2. Contents of Perl

Installed programs: corelist, cpan, enc2xs, encguess, h2ph, h2xs, instmodsh, json_pp, libnetcfg, perl, perl5.40.1 (hard link to perl), perlbug, perldoc, perlivp, perlthanks (hard link to perlbug), piconv, pl2pm, pod2html, pod2man, pod2text, pod2usage, podchecker, podselect, prove, ptar, ptardiff, ptargrep, shasum, splain, xsubpp, and zipdetails
Installed libraries: Many which cannot all be listed here
Installed directory: /usr/lib/perl5

Short Descriptions

corelist

A command line front end to Module::CoreList

cpan

Interact with the Comprehensive Perl Archive Network (CPAN) from the command line

enc2xs

Builds a Perl extension for the Encode module from either Unicode Character Mappings or Tcl Encoding Files

encguess

Guess the encoding type of one or several files

h2ph

Converts .h C header files to .ph Perl header files

h2xs

Converts .h C header files to Perl extensions

instmodsh

Shell script for examining installed Perl modules; it can create a tarball from an installed module

json_pp

Converts data between certain input and output formats

libnetcfg

Can be used to configure the libnet Perl module

perl

Combines some of the best features of C, sed, awk and sh into a single Swiss Army language

perl5.40.1

A hard link to perl

perlbug

Used to generate bug reports about Perl, or the modules that come with it, and mail them

perldoc

Displays a piece of documentation in pod format that is embedded in the Perl installation tree or in a Perl script

perlivp

The Perl Installation Verification Procedure; it can be used to verify that Perl and its libraries have been installed correctly

perlthanks

Used to generate thank you messages to mail to the Perl developers

piconv

A Perl version of the character encoding converter iconv

pl2pm

A rough tool for converting Perl4 .pl files to Perl5 .pm modules

pod2html

Converts files from pod format to HTML format

pod2man

Converts pod data to formatted *roff input

pod2text

Converts pod data to formatted ASCII text

pod2usage

Prints usage messages from embedded pod docs in files

podchecker

Checks the syntax of pod format documentation files

podselect

Displays selected sections of pod documentation

prove

Command line tool for running tests against the Test::Harness module

ptar

A tar-like program written in Perl

ptardiff

A Perl program that compares an extracted archive with an unextracted one

ptargrep

A Perl program that applies pattern matching to the contents of files in a tar archive

shasum

Prints or checks SHA checksums

splain

Is used to force verbose warning diagnostics in Perl

xsubpp

Converts Perl XS code into C code

zipdetails

Displays details about the internal structure of a Zip file