#!/bin/bash # python.SlackBuild # Heavily based on the original Slackware build script, # Modified by Stuart Winter for the Slackware porting Project. # 24-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 # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: case $ARCH in arm) export SLKCFLAGS="-O3 -march=armv4 -mtune=xscale" ;; powerpc) export SLKCFLAGS="-O3" ;; sparc) export SLKCFLAGS="-O3" ;; alpha) export SLKCFLAGS="-O3" ;; x86_64) export SLKCFLAGS="-O3" ;; i486) export SLKCFLAGS="-O3" ;; mips) export SLKCFLAGS="-O3" ;; *) export SLKCFLAGS="-O3" ;; esac # Extract source: tar xvvf $CWD/Python-$VERSION.tar.bz2 cd Python-* slackhousekeeping # Security patches: zcat $CWD/patches/CVE-2008-1679-1721.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 zcat $CWD/patches/CVE-2008-3144.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 zcat $CWD/patches/CVE-2008-3142.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 zcat $CWD/patches/CVE-2008-2316.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 zcat $CWD/patches/CVE-2008-2315.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 # Clean up after the patches: find . -name "*.orig" -exec rm "{}" \; # Location for Python site-packages: SITEPK=$PKG/usr/lib/python2.5/site-packages # same as above without $PKG TOOLSDIR=/usr/lib/python2.5/site-packages # Configure: OPT="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --mandir=/usr/man \ --with-ncurses \ --with-threads \ --enable-ipv6 \ --enable-shared \ --build=$ARCH-slackware-linux || failconfig # Build: make $NUMJOBS || failmake # Install into package: make install DESTDIR=$PKG || failinstall # Install some python-demo files: mkdir -vpm755 $PKG/usr/doc/$PKGNAM-$VERSION/html cp -favv Demo $PKG/usr/doc/$PKGNAM-$VERSION # We'll install the python-tools under site-packages: mkdir -vpm755 $SITEPK ( cd Tools ; cp -a * $SITEPK ) mkdir -vpm755 $PKG/usr/doc/$PKGNAM-$VERSION mv -fv $SITEPK/README $PKG/usr/doc/$PKGNAM-$VERSION/README.python-tools ( cd $PKG/usr/doc/$PKGNAM-$VERSION ln -vsf $TOOLSDIR Tools ) # Make a few useful symlinks: mkdir -vpm755 $PKG/usr/bin ( cd $PKG/usr/bin ln -vsf $TOOLSDIR/modulator/modulator.py modulator ln -vsf $TOOLSDIR/pynche/pynche pynche ln -vsf $TOOLSDIR/i18n/msgfmt.py . ln -vsf $TOOLSDIR/i18n/pygettext.py . ) # Replace hardlink with symlink: ( cd $PKG/usr/bin rm -fv python ln -vsf python2.5 python ) # Install docs: cp -favv README Misc $PKG/usr/doc/$PKGNAM-$VERSION tar xvvf $CWD/html-$VERSION.tar.bz2 -C${PKG}/usr/doc/$PKGNAM-$VERSION/html # 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 slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links