#!/bin/bash ulimit -s unlimited shopt -s extglob # perl.SlackBuild # Heavily based on the original Slackware build script by # Patrick Volkerding & David Cantrell. # 01-Jun-2004 # # Copyright 2009, 2010, 2011, 2012, 2013, 2015, 2016 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: slackset_var_cwds # Additional required modules: # To save on maintenance, and since we carry the same versions as x86 Slackware, # let's pull the version numbers from the x86 trunk: XSB=$CWD/perl.SlackBuild [ ! -x $XSB ] && { echo "ERROR: Cannot find x86 SlackBuild for Perl!" ; exit 1; } for bundledapp in \ DEVELCHECKLIB \ DBDMYSQL \ DBI \ GETTEXT \ TERMREADKEY \ URI \ XMLPARSER \ XMLSIMPLE \ AUTHENSASL \ MIMEBASE64 \ IOSOCKETSSL \ NETSSLEAY \ PARSEYAPP \ LIBNET \ PATHTINY \ TEMPLATETOOLKIT \ MOO \ MODULERUNTIME \ SUBQUOTE \ JSON \ IOTTY \ ROLETINY \ ; do eval $( grep -E "^${bundledapp}=" $XSB ) echo "Bundled module: ${bundledapp} version $( eval $( echo "echo \$${bundledapp}" ) )" done # Set to "yes" to run tests: MAKETEST=${MAKETEST:-no} # : IMPORTANT VERSION INFORMATION : # IMPORTANT: also update -Dinc_version_list in ./configure below! # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete and re-create temporary directories # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.!(*sign|*asc|*sig) cd $PKGNAM-$VERSION || exit 1 slackhousekeeping # Apply patches (taken from Debian's diff): - none seem relevant in 5.22 #tar xf $PORTCWD/sources/perl*debian* || exit 1 #auto_apply_patch debian/patches/debian/arm_thread_stress_timeout.diff || exit 1 # Configure perl: USE_THREADS="-Dusethreads -Duseithreads" ./Configure -de $USE_THREADS \ -Dprefix=/usr \ -Dsiteprefix=/usr/local \ -Dsitelib="/usr/local/share/perl5" \ -Dsitearch="/usr/local/lib${LIBDIRSUFFIX}/perl5" \ -Darchlib="/usr/lib${LIBDIRSUFFIX}/perl5" \ -Dcccdlflags='-fPIC' \ -Dinstallprefix=/usr \ -Dvendorprefix=/usr \ -Dprivlib="/usr/share/perl5" \ -Dvendorlib="/usr/share/perl5/vendor_perl" \ -Dvendorarch="/usr/lib${LIBDIRSUFFIX}/perl5/vendor_perl" \ -Dscriptdir='/usr/bin' \ -Doptimize="$SLKCFLAGS" \ -Duseshrplib \ -Ubincompat5005 \ -Uversiononly \ -Dlibpth="/usr/local/lib${LIBDIRSUFFIX} /usr/lib${LIBDIRSUFFIX} /lib${LIBDIRSUFFIX}" \ -Dpager='/usr/bin/less -isr' \ -Darchname=$ARCH-linux-thread-multi || failconfig # Build: make $NUMJOBS || make || failmake [[ $MAKETEST == yes ]] && { make test || exit 1; } # Install onto filesystem (needed to build modules): make install ( cd /usr/bin ln -vsf perl$VERSION perl ) # Install into package directory: make install DESTDIR=$PKG || exit 1 # Add additional modules: # The || echo trick is because some of the documentation may not exist, and we don't # want to bail out just because of it. # This doesn't happen on x86 since chmod is the last call, but we do that using a function # later in the build script. ( cd ext ( tar xvvf $CWD/Devel-CheckLib-${DEVELCHECKLIB}.tar.!(*sign|*asc|*sig) cd Devel-CheckLib-${DEVELCHECKLIB} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test || exit 1 fi make install || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/doc/perl-$VERSION/Devel-CheckLib-${DEVELCHECKLIB} cp -a README* $PKG/usr/doc/perl-$VERSION/Devel-CheckLib-${DEVELCHECKLIB} chmod 644 $PKG/usr/doc/perl-$VERSION/Devel-CheckLib-${DEVELCHECKLIB}/README* ) || exit 1 ( tar xvvf $CWD/DBI-${DBI}.tar.!(*sign|*asc|*sig) cd DBI-${DBI} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make || exit 1 [[ $MAKETEST == yes ]] && { make test || exit 1; } make install || exit 1 make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/DBI-${DBI} cp -a README* $PKG/usr//doc/$PKGNAM-$VERSION/DBI-${DBI} || echo ) || exit 1 ( tar xvvf $CWD/DBD-mysql-${DBDMYSQL}.tar.!(*sign|*asc|*sig) cd DBD-mysql-${DBDMYSQL} || exit 1 slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make # ignore errors since we can't have it connecting to a MySQL server [[ $MAKETEST == yes ]] && { make test || exit 1; } make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/DBD-mysql-${DBDMYSQL} cp -a INSTALL.html README* TODO $PKG/usr/doc/$PKGNAM-$VERSION/DBD-mysql-${DBDMYSQL} || echo ) || exit 1 ( tar xvvf $CWD/XML-Parser-${XMLPARSER}.tar.!(*sign|*asc|*sig) cd XML-Parser-${XMLPARSER} slackhousekeeping perl -I . Makefile.PL INSTALLDIRS=vendor make || exit 1 [[ $MAKETEST == yes ]] && { make test || exit 1; } make install || exit 1 make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/XML-Parser-${XMLPARSER} cp -a README* $PKG/usr/doc/$PKGNAM-$VERSION/XML-Parser-${XMLPARSER} || echo ) || exit 1 ( tar xvvf $CWD/XML-Simple-${XMLSIMPLE}.tar.!(*sign|*asc|*sig) cd XML-Simple-${XMLSIMPLE} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make || exit 1 [[ $MAKETEST == yes ]] && { make test || exit 1; } make install || exit 1 make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/XML-Simple${XMLSIMPLE} cp -a README* $PKG/usr/doc/$PKGNAM-$VERSION/XML-Simple${XMLSIMPLE} || echo ) || exit 1 ( tar xvvf $CWD/URI-${URI}.tar.!(*sign|*asc|*sig) cd URI-${URI} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make || exit 1 [[ $MAKETEST == yes ]] && { make test || exit 1; } make install || exit 1 make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/URI-${URI} cp -a README* $PKG/usr/doc/$PKGNAM-$VERSION/URI-${URI} || echo ) || exit 1 ( tar xvvf $CWD/Locale-gettext-${GETTEXT}.tar.!(*sign|*asc|*sig) cd Locale-gettext-${GETTEXT} || exit 1 slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor || exit 1 make || exit 1 [[ $MAKETEST == yes ]] && { make test || exit 1; } make install || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/Locale-gettext-${GETTEXT} cp -a README* $PKG/usr/doc/$PKGNAM-$VERSION/Locale-gettext-${GETTEXT} || echo ) || exit 1 ( tar xvvf $CWD/TermReadKey-${TERMREADKEY}.tar.!(*sign|*asc|*sig) cd TermReadKey-${TERMREADKEY} || exit 1 slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make || exit 1 [[ $MAKETEST == yes ]] && { make test || exit 1; } make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/TermReadKey-${TERMREADKEY} cp -a README* $PKG/usr/doc/$PKGNAM-$VERSION/TermReadKey-${TERMREADKEY} || echo ) || exit 1 ( tar xvvf $CWD/Authen-SASL-${AUTHENSASL}.tar.!(*sign|*asc|*sig) cd Authen-SASL-${AUTHENSASL} slackhousekeeping perl -I . Makefile.PL INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test fi make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/Authen-SASL-${AUTHENSASL} cp -a README* META.yml $PKG/usr/doc/$PKGNAM-$VERSION/Authen-SASL-${AUTHENSASL} || echo ) || exit 1 ( tar xvvf $CWD/MIME-Base64-${MIMEBASE64}.tar.!(*sign|*asc|*sig) cd MIME-Base64-${MIMEBASE64} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test fi make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/MIME-Base64-${MIMEBASE64} cp -a README* $PKG/usr/doc/$PKGNAM-$VERSION/MIME-Base64-${MIMEBASE64} || echo ) || exit 1 ( tar xvvf $CWD/IO-Socket-SSL-${IOSOCKETSSL}.tar.gz cd IO-Socket-SSL-${IOSOCKETSSL} slackhousekeeping echo Y | perl Makefile.PL INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test || exit 1 fi make install || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/doc/perl-$VERSION/IO-Socket-SSL-${IOSOCKETSSL} cp -a README* $PKG/usr/doc/perl-$VERSION/IO-Socket-SSL-${IOSOCKETSSL} || echo ) || exit 1 ( tar xvvf $CWD/Net-SSLeay-${NETSSLEAY}.tar.gz cd Net-SSLeay-${NETSSLEAY} slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test || exit 1 fi make install || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/doc/perl-$VERSION/Net-SSLeay-${NETSSLEAY} cp -a README* $PKG/usr/doc/perl-$VERSION/Net-SSLeay-${NETSSLEAY} || echo chmod 644 $PKG/usr/doc/perl-$VERSION/Net-SSLeay-${NETSSLEAY}/* ) || exit 1 ( tar xvvf $CWD/libnet-${LIBNET}.tar.!(*sign|*asc|*sig) cd libnet-${LIBNET} zcat $CWD/libnet-3.08-Do-not-create-Net-libnet.cfg.patch.gz | patch -p1 --verbose || exit 1 slackhousekeeping echo | perl Makefile.PL \ PREFIX=/usr \ INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test fi make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/libnet-${LIBNET} cp -a Artistic Changes Copying INSTALL LICENCE README $PKG/usr/doc/$PKGNAM-$VERSION/libnet-${LIBNET} chmod 644 $PKG/usr/doc/$PKGNAM-$VERSION/libnet-${LIBNET}/* ) || exit 1 ( tar xvvf $CWD/Parse-Yapp-${PARSEYAPP}.tar.!(*sign|*asc|*sig) cd Parse-Yapp-${PARSEYAPP} || exit 1 slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || failmake if [ "$MAKETEST" = "yes" ]; then make test || exit 1 fi make install || failinstall make install DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/perl-$VERSION/Parse-Yapp-${PARSEYAPP} cp -a README* $PKG/usr/doc/perl-$VERSION/Parse-Yapp-${PARSEYAPP} ) || exit 1 ( tar xvvf $CWD/Path-Tiny-${PATHTINY}.tar.gz cd Path-Tiny-${PATHTINY} || exit 1 slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test || exit 1 fi make install || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/doc/perl-$VERSION/Path-Tiny-${PATHTINY} cp -a README* $PKG/usr/doc/perl-$VERSION/Path-Tiny-${PATHTINY} ) || exit 1 ( tar xvvf $CWD/Template-Toolkit-${TEMPLATETOOLKIT}.tar.gz cd Template-Toolkit-${TEMPLATETOOLKIT} || exit 1 slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || exit 1 if [ "$MAKETEST" = "yes" ]; then make test || exit 1 fi make install || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/doc/perl-$VERSION/Template-Toolkit-${TEMPLATETOOLKIT} cp -a README* $PKG/usr/doc/perl-$VERSION/Template-Toolkit-${TEMPLATETOOLKIT} ) || exit 1 ( tar xvvf $CWD/Moo-${MOO}.tar.gz cd Moo-${MOO} || exit 1 slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || failmake if [ "$MAKETEST" = "yes" ]; then make test || failmake fi make install || failinstall make install DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/perl-$VERSION/Moo-${MOO} cp -a README* $PKG/usr/doc/perl-$VERSION/Moo-${MOO} ) || exit 1 ( tar xvvf $CWD/Module-Runtime-${MODULERUNTIME}.tar.gz cd Module-Runtime-${MODULERUNTIME} || exit 1 slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || failmake if [ "$MAKETEST" = "yes" ]; then make test || failmake fi make install || failinstall make install DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/perl-$VERSION/Module-Runtime-${MODULERUNTIME} cp -a README* $PKG/usr/doc/perl-$VERSION/Module-Runtime-${MODULERUNTIME} ) || failmake ( tar xvvf $CWD/Sub-Quote-${SUBQUOTE}.tar.gz cd Sub-Quote-${SUBQUOTE} || exit 1 slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || failmake if [ "$MAKETEST" = "yes" ]; then make test || exit 1 fi make install || failinstall make install DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/perl-$VERSION/Sub-Quote-${SUBQUOTE} cp -a README* $PKG/usr/doc/perl-$VERSION/Sub-Quote-${SUBQUOTE} ) || failmake ( tar xvvf $CWD/JSON-${JSON}.tar.gz cd JSON-${JSON} || exit 1 slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || failmake if [ "$MAKETEST" = "yes" ]; then make test || failmake fi make install || failinstall make install DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/perl-$VERSION/JSON-${JSON} cp -a README* $PKG/usr/doc/perl-$VERSION/JSON-${JSON} ) || failmake ( tar xzvf $CWD/IO-Tty-${IOTTY}.tar.gz cd IO-Tty-${IOTTY} slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || failmake if [ "$MAKETEST" = "yes" ]; then make test || failmake fi make install || failinstall make install DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/perl-$VERSION/IO-Tty-${IOTTY} cp -a README* $PKG/usr/doc/perl-$VERSION/IO-Tty-${IOTTY} ) || failmake ( tar xzvf $CWD/Role-Tiny-${ROLETINY}.tar.gz cd Role-Tiny-${ROLETINY} slackhousekeeping echo y | perl Makefile.PL INSTALLDIRS=vendor make || failmake if [ "$MAKETEST" = "yes" ]; then make test || failmake fi make install || failinstall make install DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/perl-$VERSION/Role-Tiny-${ROLETINY} cp -a README* $PKG/usr/doc/perl-$VERSION/Role-Tiny-${ROLETINY} ) || failmake ) || failmake # Symlinks that replace hard links ( cd $PKG/usr/bin ln -vsf perl$VERSION perl ) # Add a symlink to libperl.so, since otherwise we occasionally run into # binaries that can't find it since it's not in the LD_LIBRARY_PATH: ( cd $PKG/usr/lib${LIBDIRSUFFIX} ln -vsf perl*/CORE/libperl.so . ) # Install documentation mkdir -pm755 $PKG/usr/doc/$PKGNAM-$VERSION cp -fav \ AUTHORS Artistic Changes Copying INSTALL \ README* \ README.{cn,jp,ko,tw} README.linux \ $PKG/usr/doc/$PKGNAM-$VERSION # We follow LSB with symlinks in /usr/share: ( cd $PKG/usr/share mv man .. ) ( cd $PKG/usr/man/man1 mkdir foo cp *.1 foo rm *.1 mv foo/* . rmdir foo gzip -9 * ) ( cd $PKG/usr/man/man3 && gzip -9 * ) chmod 755 $PKG/usr/bin/* chmod 644 $PKG/usr/man/man?/* # Don't ship a perllocal.pod populated with vendor_perl additions. The file is # meant for locally added perl modules: if [ -r $PKG/usr/lib${LIBDIRSUFFIX}/perl5/perllocal.pod ]; then mv -fv $PKG/usr/lib${LIBDIRSUFFIX}/perl5/perllocal.pod $PKG/usr/lib${LIBDIRSUFFIX}/perl5/vendor_perl.pod fi # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slack_delete_lafiles # delete usr/lib{,64}/*.la slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links