# perl5-glibc64-250518/cfg - "Build" settings for package

#---------------------------------------------------------------------

[technotes]

1. It's usually not difficult  to rebuild a "perl5-..." package.  How-
ever, updating from one  upstream release of  Perl to  another  may be
rather  difficult.  The  latter step is recommended  primarily for ex-
perts.

#---------------------------------------------------------------------

2. Perl is a  critical distro component  (like "glibc" or certain ver-
sions of "gcc").  Therefore, for safety's sake,  the package structure
used for Perl is somewhat complicated.

Most  importantly,  this distro proceeds as though  there's  a package
named "perl5". For example, PATH usually includes the directory:

      $PRODTREE/perl5/bin

"Real" Perl packages have names similar to "perl5-190730".  The trail-
ing  six digits are a unique numeric identifier.  Presently,  the six-
digit identifiers  correspond to "build" dates,  but this is a conven-
tion and not a requirement.

There  may be several "real" Perl packages installed  under the distro
at any  one time.  However,  as a general rule,  they're  not accessed
directly.  Perl is  normally used through the  "perl5"  link mentioned
above.  Therefore,  only one copy of Perl is  used  at  a time  (i.e.,
the linked copy).

This approach makes it easier for a sysadmin to switch the entire dis-
tro from one version of Perl to another.  Additionally,  this approach
makes rebuilds and updates safer, because changes can be reversed (see
the next section).

#---------------------------------------------------------------------

3. When it's  necessary to rebuild or update Perl,  try  the following
procedure:

      a. Don't change the "real" Perl "devel" and/or "installed" trees
         initially.

      b. Clone one  "real" Perl "devel" tree to create a  new package.
         To do this, proceed roughly as follows:

         cd /src            # Go to distro's main "src" tree
         cd *_perl          # Go to directory  that contains  Perl
                            # core package(s)

                            # Create a new package
        cp -a perl5-150523 perl5-240310
                                 ^^^^^^
                                 Choose a new and unique six-dig-
                                 it identifier (ideally, based on
                                 the  current date)  and  make  a
                                 note of the number used

         Optional:  Or include "glibc32" or  "glibc64"  in the name as
         follows to indicate architecture:

         cp -a perl5-150523 perl5-glibc64-240310

         In this case, make the same name change in the steps below.

      c. The "perl5-######" package's build resource tree includes two
         configuration files named "default.sh.in" and "Policy.sh.in".

         Don't modify  "Policy.sh.in"  unless you know what you're do-
         ing.

         However, if you're switching between major Perl releases (for
         example, between Perl 5.8.8 and 5.10.0), the existing version
         of  "default.sh.in" may not work correctly.  It's best to re-
         generate that file as follows:

         * Unpack the Perl source tarball and enter the top-level dir-
           ectory

         * Execute:

           PREFIX=$PRODTREE/perl5-glibc64-240310
           mkdir -p $PREFIX/bin
           rlwrap bash ./Configure \
               -Dprefix=$PREFIX -Dvendorprefix=$PREFIX -d

           Above and below, use the six-digit identifier selected pre-
           viously instead of "240310".

           The preceding will probably prompt you to press "return" at
           one point. If it does, do so.

         * Copy "config.sh" to "default.sh.in" in the package resource
           "special" directory.

         * Go  to the  "special" directory.  Execute  the  Perl script
          "fix-perl-default".  This will make some required changes to
          "default.sh.in".

      d. Execute  a command similar to  "makelac perl5-glibc64-240310"
         -- but  modify the  six-digit  identifier  used  to match the
         six-digit value selected in step (b)).

      e. Prepend the new package's  "bin" directory to  PATH and  test
         "perl".  Note:  External (i.e., non-core) CPAN packages won't
         be available at this point.  If you try  to use  packages  of
         this type, errors will occur.

      f. Update  the  "perl5" link  mentioned previously.  For example
         (modify the six-digit identifier used here appropriately):

         cd $PRODTREE && ln -nsf perl5-glibc64-240310 perl5

      g. If problems occur, change the "perl5" link back to its origi-
         nal value.

      h. Rebuild all of the  distro packages designated as  "cpancore"
         packages and/or as "perl:strict" packages.

      i. Optional:  If everything works correctly, make back-up copies
         of the old "perl5-######" "devel" tree  (the tree  you copied
         *from* in step (b)) and the  associated "install" tree,  then
         delete these two trees.

      j. makelac texinfo  --force
         makelac automake --force

      k. If you're sure that the  new copy of  "perl5" is working cor-
         rectly,  edit the distro's  "remaster-distro" script  and re-
         place all occurrences of the old package  name  (for example,
         "perl5-150523")  with  the  new  package  name  (for example,
         "perl5-240310").

      l. Additionally,  make the same change to the "cfg" files stored
         in the "perl" package resource tree.

#---------------------------------------------------------------------

4. This package installs a symbolic link named  "perl" in the distro's
main "bin" directory.  Important:  The "perl" link  points to a "perl"
executable, but it doesn't necessarily point to the  "perl" executable
that's associated with this particular  "perl5-..." package.

Details:  As  explained previously,  this  distro  behaves  as  though
there's a  package  named "perl5",  but the  "perl5" installed tree is
actually a  symbolic link  to a "real"  installed tree.  This approach
allows  the  system administrator  to  switch the distro to  different
versions of "perl5" with minimum effort.

The  "perl"  executable link mentioned above is a  generic  executable
of sorts.  It points to "something/perl5/bin/perl",  where "something/
perl5" is the  installed tree that's  selected  by the current "perl5"
package link.

#---------------------------------------------------------------------

[buildtimes]

00.08 hours (or 004.92 minutes) - Dell Inspiron 6400 2.0 GHz Intel Duo
                                  7200 2GB RAM - older setup

00.09 hours (or 005.28 minutes) - ThinkPad E540 i7 4x2 16GB RAM - old-
                                  er setup

00.13 hours (or 007.70 minutes) - 2023 dedi Xeon E3-1200 v3  4x2  32GB
                                  RAM - 64-bit kernel and 64-bit  dis-
                                  tro - built  perl 5.40.2  using  gcc
                                  14.2.0

00.14 hours (or 008.18 minutes) - ThinkPad X1  Carbon 6G  i7 4x2  16GB
                                  RAM - older setup

00.20 hours (or 012.27 minutes) - ThinkPad W530 i7 4x2  32GB RAM - 64-
                                  bit kernel and 64-bit distro - built
                                  perl 5.40.2 using gcc 14.2.0

00.30 hours (or 017.77 minutes) - Compaq 1.7 GHz Intel Pentium 4 512MB
                                  - older setup

#---------------------------------------------------------------------

[settings]
configure  = none
defer      = glibc64
license    = Artistic License (see "license.txt" in installed tree)
nosyslinks = yes
setpaths   = gcc
tmpsize    = 202M

#---------------------------------------------------------------------

[depends]
bison3
coreutils
db
gdbm
less
nettools
sed

#---------------------------------------------------------------------

[build]
DATADIR=$PKGDIR_PROD/data
LIBDIR=$PKGDIR_PROD/lib
mkdir -p $DATADIR $LIBDIR

sed -e "s@__META_SYSBIN__@$LACSYSTREE/bin@g" \
    < $PKGDIR_SPECIAL/MyConfig.pm.in \
    >        $DATADIR/MyConfig.pm.in

export LACFORCEPIC=yes
OLDPATH=$PATH
mkdir -p $PKGDIR_PROD/{bin,doc,man}

for PASS in 1 2
do
    PATH=$OLDPATH
    unset PERL5LIB

    pushd ..
    if [ $PASS == 1 ]; then
        echo Pass 1: Building regular perl with static libperl.a
        tar jcf /tmp/perlsrc.tbz perl-5.*
    else
        echo Pass 2: Building dynamic libperl.so
        rm -fr perl-5.*
        tar jxf /tmp/perlsrc.tbz
    fi
    popd

    for x in default Policy
    do
        sed -e "s#__META_PREFIX__#$PKGDIR_PROD#g" \
            -e "s#__META_PRODTREE__#$PRODTREE#g" \
            -e "s#__META_SYSTREE__#/$LACARCH#g" \
            -e "s#__META_GLIBCDIR__#$LACSYSLIBPREFIX/lib#g" \
            < $PKGDIR_SPECIAL/$x.sh.in \
            > $x.sh
    done

    if [ $PASS == 2 ]; then
        sed -e "s@^libperl=.*@libperl='libperl.so'@" \
            -e "s@^useshrplib=.*@useshrplib='true'@" \
            -i default.sh
    fi

    sh ./Configure \
        -Dprefix=$PKGDIR_PROD \
        -Dvendorprefix=$PKGDIR_PROD \
        -de -f default.sh

    smpmake

    if [ $PASS == 1 ]; then
        export PATH=`pwd`:$PATH
        export PERL5LIB=`pwd`/lib
        make install
                                # Important:  Link doesn't necessarily
                                # point to  this  copy  of  Perl - see
                                # notes at top of file
        ln -nsf $PRODTREE/perl5/bin/perl $SYS_BINDIR/perl
        cp -p Artistic $PKGDIR_PROD/doc/license.txt
    else
        LIBPERL=`find $PKGDIR_PROD/ -type f -name libperl.a`

        if [ x"$LIBPERL" == x ]; then
            echo Internal error: libperl.a not built
            exit 1
        fi

        LIBPERL=`echo $LIBPERL | sed 's/\.a$/.so/'`
        echo  Installing $LIBPERL
        cp -p libperl.so $LIBPERL
        ln -nsf $LIBPERL $LIBDIR/
        rm /tmp/perlsrc.tbz
    fi
done

#---------------------------------------------------------------------

# Original URLs. These URLs were valid at one point, but may have died
# since then. If you download newer versions of tarballs [etc.], don't
# delete  the  original versions,  as you may not  be able  to replace
# them.

[urls]
url_debian  = Not checked yet
url_home    = http://www.perl.org/

url_lfs     = http://www.linuxfromscratch.org/lfs/view/stable/\
chapter05/perl.html

url_tarball = http://www.cpan.org/src/5.0/perl-5.40.2.tar.xz

#---------------------------------------------------------------------

[history]
170504 Updated from 5.22.1 to 5.26.0
171022 Updated to 5.26.1
171103 Modified to build both libperl.a and libperl.so
171206 Rebuilt as perl5-171206
180312 Rebuilt as perl5-180312
180414 Updated to 5.26.2
181112 Updated to 5.28.0
181204 Updated to 5.28.1
190703 Updated to 5.30.0
210205 Updated to 5.30.3
210530 Updated to 5.32.1
240310 Updated to 5.34.3
241109 Updated to 5.40.0
250129 Updated to 5.40.1
250518 Updated to 5.40.2
250518 Disabled CPAN "cksum" security step to fix numerous FTBFSes