#!/bin/bash # perl.SlackBuild # Heavily based on the original Slackware build script by # Patrick Volkerding & David Cantrell. # 01-Jun-2004 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Additional required modules: XMLPARSER=2.36 XMLSIMPLE=2.18 URI=1.37 DBI=1.607 DBDMYSQL=4.008 # : 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 # Determine the CFLAGS for the known architectures: case $ARCH in # arm) export SLKCFLAGS="-Os -march=armv3 -mtune=xscale" ;; arm) export SLKCFLAGS="-O2 -march=armv4 -mtune=xscale" ;; powerpc) export SLKCFLAGS="" ;; sparc) export SLKCFLAGS="" ;; *) export SLKCFLAGS="" ;; esac # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.bz2 cd $PKGNAM-$VERSION slackhousekeeping # Apply patches (taken from Debian's diff): # This is to address a problem building with -O2 and gcc4. patch -p1 --verbose < $PORTCWD/sources/64_debian_arm_optim || failpatch #patch -lp1 --verbose < $PORTCWD/sources/configure.diff || failpatch # Avoid some tests which fail on ARM (see the patch for details): patch -p1 --verbose < $PORTCWD/sources/66_debian_arm_fp || failpatch # Configure perl: USE_THREADS="-Dusethreads -Duseithreads" ./Configure -de $USE_THREADS \ -Dprefix=/usr \ -Dcccdlflags='-fPIC' \ -Dinstallprefix=/usr \ -Dvendorprefix=/usr \ -Doptimize="$SLKCFLAGS" \ -Dpager='/usr/bin/less -isr' \ -Dinc_version_list='5.8.8 5.8.7 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0' \ -Darchname=$ARCH-linux || failconfig # Kludge for gcc-4.2.3's needlessly changed output: cat makefile | grep -v '\' > foo mv foo makefile cat x2p/makefile | grep -v '\' > foo mv foo x2p/makefile # Build: make $NUMJOBS || failmake make test || failtest # Install onto filesystem (needed to build modules): make install ( cd /usr/bin ln -vsf perl$VERSION perl ln -vsf c2ph pstruct ln -vsf s2p psed ) mkdir -p /usr/lib/perl5/vendor_perl/${VERSION}/${ARCH}-linux-thread-multi # Install into package directory: make install DESTDIR=$PKG mkdir -p $PKG/usr/lib/perl5/vendor_perl/${VERSION}/${ARCH}-linux-thread-multi # Add additional modules: ( cd ext ( tar xvvf $CWD/DBI-${DBI}.tar.gz cd DBI-${DBI} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make make test make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/DBI-${DBI} cp -a README $PKG/usr/doc/$PKGNAM-$VERSION/DBI-${DBI} ) ( tar xvvf $CWD/DBD-mysql-${DBDMYSQL}.tar.gz cd DBD-mysql-${DBDMYSQL} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make make test 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} ) ( tar xvvf $CWD/XML-Parser-${XMLPARSER}.tar.gz cd XML-Parser-${XMLPARSER} slackhousekeeping perl Makefile.PL INSTALLDIRS=vendor make make test make install 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} ) ( tar xvvf $CWD/XML-Simple-${XMLSIMPLE}.tar.gz cd XML-Simple-${XMLSIMPLE} chown -R root:root . perl Makefile.PL INSTALLDIRS=vendor make make test make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/perl-$VERSION/XML-Simple${XMLSIMPLE} cp -a README $PKG/usr/doc/perl-$VERSION/XML-Simple${XMLSIMPLE} chmod 644 $PKG/usr/doc/perl-$VERSION/XML-Simple${XMLSIMPLE}/* ) ( tar xvvf $CWD/URI-${URI}.tar.gz cd URI-${URI} slackhouskeeping perl Makefile.PL INSTALLDIRS=vendor make make test make install make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/perl-$VERSION/URI-${URI} cp -a README $PKG/usr/doc/perl-$VERSION/URI-${URI} chmod 644 $PKG/usr/doc/perl-$VERSION/URI-${URI}/* ) ) # Symlinks that replace hard links ( cd $PKG/usr/bin ln -vsf perl$VERSION perl ln -vsf c2ph pstruct ln -vsf s2p psed ) # Install documentation mkdir -pm755 $PKG/usr/doc/$PKGNAM-$VERSION cp -fav AUTHORS Artistic Copying INSTALL MANIFEST README README.Y2K README.cn README.jp README.ko README.micro README.tw Todo.micro \ $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 * ln -vsf c2ph.1.gz pstruct.1.gz ln -vsf s2p.1.gz psed.1.gz ) ( cd $PKG/usr/man/man3 && gzip -9 * ) chmod 755 $PKG/usr/bin/* chmod 644 $PKG/usr/man/man?/* rm -rf $PKG/usr/share # This file shouldn't get clobbered: if [ -r $PKG/usr/lib/perl5/${VERSION}/${ARCH}-linux-thread-multi/perllocal.pod ]; then mv $PKG/usr/lib/perl5/${VERSION}/${ARCH}-linux-thread-multi/perllocal.pod $PKG/usr/lib/perl5/${VERSION}/${ARCH}-linux-thread-multi/perllocal.pod.new fi # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs 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 # The Slackware doinst.sh script contains non-portable arch names: sed -i 's?i486?'"$ARCH"'?g' install/doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links