#!/bin/bash VERSION=$1 # Determine patch level required & apply the patch: function apply_patch () { patchfile=$1 # Unpack if it's bzip2 or gzip: FTYPE=$( file $patchfile ) if [ "$( echo $FTYPE | grep "bzip2 compressed" )" ]; then bzcat -f $patchfile > $TMPBUILD/$patchfile.unpacked patchfile=$TMPBUILD/$patchfile.unpacked elif [ "$( echo $FTYPE | grep "gzip compressed" )" ]; then zcat -f $patchfile > $TMPBUILD/$patchfile.unpacked patchfile=$TMPBUILD/$patchfile.unpacked fi # Most patches should not require more levels than this: success=0 for (( pl=0 ; pl<=5 ; pl++ )) ; do echo "Patch : $patchfile , trying patch level $pl" patch --fuzz=20 -t --dry-run -p$pl < $patchfile > /dev/null 2>&1 && success=1 && break done if [ $success = 1 ]; then echo "Patch: $patchfile will apply at level $pl" patch --fuzz=20 --verbose -p$pl < $patchfile return 0 else echo "Patch: $patchfile failed to apply at levels 0-5" return 1 fi } # Extract source: cd $SLACKTRACKSCRATCHDIR tar xvvf $CWD/ircii-pana-$VERSION-final.tar.gz cd BitchX slackhousekeeping # Apply the patches: for i in $PORTCWD/sources/*.patch* ; do apply_patch $i || failpatch done # Configure: CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --enable-cdrom \ --with-ssl \ --with-plugins \ --enable-ipv6 || failconfig # Build: make $NUMJOBS || failmake # Install into the filesystem: make install # Install docs: mkdir -p /usr/doc/BitchX-$VERSION cp -a README* COMPILE-PROBLEMS INST* IPv6-support doc/* \ /usr/doc/BitchX-$VERSION # Install package description: cd / rm -rf /install slackdesc