#!/bin/sh # ----------------------------------------------------------------------------- # # Slackware SlackBuild script # =========================== # By: Eric Hameleers # For: ft3xx # URL: http://www.promise.com/support/ # Needs: # Changelog: # 1.00.0.19-1: 06/Oct/2005 by Eric Hameleers # * Initial build. # # Run 'sh SlackBuild --cleanup' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . # Install using 'installpkg'. # # ----------------------------------------------------------------------------- # --- INIT --- # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PRGNAM=ft3xx VERSION=1.00.0.19 ARCH=${ARCH:-i486} BUILD=1 KVER=${KVER:-`uname -r`} KSRC=${KSRC:-/lib/modules/${KVER}/build} DOCS="README*" if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mcpu=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "athlon-xp" ]; then SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" fi PKG=$TMP/package-$PRGNAM if [ ! -d $TMP/tmp-$PRGNAM ]; then mkdir -p $TMP/tmp-$PRGNAM # location to build the source elif [ "$1" != "--oldbuild" ]; then # If the "--oldbuild" parameter is present, we keep # the old build files and continue; # By default we remove the remnants of previous build and continue: rm -rf $TMP/tmp-$PRGNAM/* fi if [ ! -d $PKG ]; then mkdir -p $PKG # place for the package to be built fi # --- PACKAGE BUILDING --- echo "++" echo "|| $PRGNAM-$VERSION" echo "++" # We always erase old package's contents: rm -rf $PKG/* cd $PKG # Explode the package framework: if [ -f $CWD/_$PRGNAM.tar.gz ]; then explodepkg $CWD/_$PRGNAM.tar.gz fi cd $TMP/tmp-$PRGNAM echo "Extracting the program archive(s) for $PRGNAM..." mkdir ${PRGNAM}-${VERSION} cd ${PRGNAM}-${VERSION} unzip $CWD/1_fasttrak_tx4000_partial_source_${VERSION}.zip patch -p0 < $CWD/Makefile.patch chown -R root.root * find . -perm 777 -exec chmod 755 {} \; # --- BUILDING --- echo Building ... CFLAGS="$SLKCFLAGS" \ make KVER=$KVER KSRC=$KSRC 2>&1 | tee $CWD/make-${PRGNAM}.log # # Install all the needed stuff to the package dir # mkdir -p $PKG/lib/modules/${KVER}/kernel/drivers/scsi cp -a ft3xx.o $PKG/lib/modules/${KVER}/kernel/drivers/scsi/ gzip -9f $PKG/lib/modules/${KVER}/kernel/drivers/scsi/ft3xx.o # And now write the doinst.sh : mkdir -p $PKG/install cat <<-EEOOTT > $PKG/install/doinst.sh # Only run depmod on matching running kernel # Slackware will run depmod anyway on reboot): MYMODVER=$KVER MYKERNEL=\`uname -r\` if [ "\$MYKERNEL" = "\$MYMODVER" ]; then if [ -x sbin/depmod ]; then chroot . /sbin/depmod -a \$MYKERNEL 1> /dev/null 2> /dev/null fi fi EEOOTT # --- DOCUMENTATION --- mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS \ $PKG/usr/doc/$PRGNAM-$VERSION chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/* # --- OWNERSHIP, RIGHTS --- chmod -R o-w $PKG # --- PACKAGE DESCRIPTION --- mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc if [ -f $CWD/doinst.sh ]; then cat $CWD/doinst.sh > $PKG/install/doinst.sh fi # --- BUILDING --- # Build the package: cd $PKG makepkg --linkadd y --chown n $TMP/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz \ 2>&1 | tee $CWD/makepkg-${PRGNAM}.log (cd $TMP && md5sum ${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz.md5) cat $CWD/slack-desc | grep "^${PRGNAM}" > $TMP/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.txt # --- CLEANUP --- # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/tmp-$PRGNAM rm -rf $PKG fi