summaryrefslogtreecommitdiffstats
path: root/madwifi
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2006-09-20 19:40:22 +0000
committer Eric Hameleers <alien@slackware.com>2006-09-20 19:40:22 +0000
commit3b2b3c6a4a243ae7d4343c34a73ba9e4d0da1f27 (patch)
treed836db215f6ef26a802dd87e31cef9e7b02e6760 /madwifi
parentc1d7f39adf00278fe37c822c0721d252c0297a17 (diff)
downloadasb-3b2b3c6a4a243ae7d4343c34a73ba9e4d0da1f27.tar.gz
asb-3b2b3c6a4a243ae7d4343c34a73ba9e4d0da1f27.tar.xz
Re-did the SlackBuild, added gcc check (Slackware 11.0 versus earlier)
Diffstat (limited to 'madwifi')
-rwxr-xr-xmadwifi/build/madwifi.SlackBuild128
1 files changed, 92 insertions, 36 deletions
diff --git a/madwifi/build/madwifi.SlackBuild b/madwifi/build/madwifi.SlackBuild
index e93add58..eac32e5e 100755
--- a/madwifi/build/madwifi.SlackBuild
+++ b/madwifi/build/madwifi.SlackBuild
@@ -31,33 +31,59 @@
# * First official release! Re-worked the SlackBuild a little.
# 0.9.2-1: 28/jul/2006 by Eric Hameleers <alien@slackware.com>
# * Skipped a release (due to my holidays).
+# 0.9.2-2: 20/sep/2006 by Eric Hameleers <alien@slackware.com>
+# * Updated the SlackBuild script, rebuilt for Slackware 11.0.
# ----------------------------------------------------------------------------
-CWD=`pwd`
-if [ "$TMP" = "" ]; then
- TMP=/tmp
-fi
+
+SNAPSHOT="" # set to "yes" if you're building a snapshot release.
PRGNAM=madwifi
-PKG=$TMP/package-$PRGNAM
+VERSION=${VERSION:-0.9.2}
+BUILD=2
-SNAPSHOT="" # set to "yes" if you're building a snapshot release.
-VERSION=0.9.2
-BUILD=1
ARCH=${ARCH:-i486}
KVER=${KVER:-`uname -r`}
KSRC=${KSRC:-/lib/modules/${KVER}/build}
PATCHLEVEL=`echo $KVER|cut -f 2 -d '.'`
+if [ -z $SNAPSHOT ]; then # build a stable release
+ SOURCE="${PRGNAM}-${VERSION}.tar.gz"
+ SRCURL="http://dl.sourceforge.net/sourceforge/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz"
+fi
+
+# Where do we look for sources?
+CWD=`pwd`
+SRCDIR=`dirname $0`
+[ "${SRCDIR:0:1}" == "." ] && SRCDIR=${CWD}/${SRCDIR}
+
+# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
+TMP=${TMP:-/tmp/build}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
##
## --- with a little luck, you won't have to edit below this point --- ##
##
+# Exit the script on errors:
+set -e
+trap 'echo "$0 FAILED!" | tee $CWD/error-${PRGNAM}.log' ERR
+# Catch unitialized variables:
+set -u
+P1=${1:-1}
+
+# Slackware 11 and up need other option (gcc > 3.3.x)
+if [ `gcc -dumpversion | tr -d '.' |cut -c 1-2` -gt 33 ]; then
+ MOPT=tune
+else
+ MOPT=cpu
+fi
+
case "$ARCH" in
- i386) SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
+ i386) SLKCFLAGS="-O2 -march=i386 -m${MOPT}=i686"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
- i486) SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
+ i486) SLKCFLAGS="-O2 -march=i486 -m${MOPT}=i686"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
s390) SLKCFLAGS="-O2"
@@ -76,19 +102,13 @@ esac
if [ ! -d $TMP/tmp-$PRGNAM ]; then
mkdir -p $TMP/tmp-$PRGNAM # location to build the source
-elif [ "$1" != "--oldbuild" ]; then
+elif [ "$P1" != "--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
-# --- PACKAGE BUILDING ---
-
-echo "+=================+"
-echo "| $PRGNAM-$VERSION |"
-echo "+=================+"
-
if [ "$PKG" = "" -o "$PKG" = "/" ] ; then
echo "Please provide a sane value for the variable 'PKG'."
exit 1
@@ -98,17 +118,52 @@ else
rm -rf $PKG/* # We always erase old package's contents:
fi
+if [ ! -d $OUTPUT ]; then
+ mkdir -p $OUTPUT # place for the package to be saved
+fi
+
+
+# --- SOURCE FILE AVAILABILITY ---
+
+if [ -z $SNAPSHOT ]; then # download stable release
+ if ! [ -f ${SRCDIR}/${SOURCE} ]; then
+ if ! [ "x${SRCURL}" == "x" ]; then
+ echo "Source '${SOURCE}' not available yet... will download now:"
+ wget -O "${SRCDIR}/${SOURCE}" "${SRCURL}" || true
+ if [ $? -ne 0 ]; then
+ echo "Downloading '${SOURCE}' failed... aborting the build."
+ mv -f "${SRCDIR}/${SOURCE}" "${SRCDIR}/${SOURCE}".FAIL
+ exit 1
+ fi
+ else
+ echo "File '${SOURCE}' not available... aborting the build."
+ exit 1
+ fi
+ fi
+fi
+if [ "$P1" == "--download" ]; then
+ echo "Download complete."
+ exit 0
+fi
+
+# --- PACKAGE BUILDING ---
+
+echo "+=================+"
+echo "| $PRGNAM-$VERSION |"
+echo "+=================+"
+
rm -f $CWD/*.log
cd $PKG
# Explode the package framework:
-if [ -f $CWD/_$PRGNAM.tar.gz ]; then
- explodepkg $CWD/_$PRGNAM.tar.gz
+if [ -f $SRCDIR/_$PRGNAM.tar.gz ]; then
+ explodepkg $SRCDIR/_$PRGNAM.tar.gz
fi
cd $TMP/tmp-$PRGNAM
-# Actually you must get the sources from SVN:
+# Actually to build a snapshot (not the stable release) you must get
+# the sources from SVN:
# $ svn checkout http://svn.madwifi.org/trunk madwifi-ng
# The above command stores the source in a subdirectory called madwifi-ng.
# To update to the current version of the source at a later time you just need
@@ -124,6 +179,7 @@ if [ -z $SNAPSHOT ]; then
else
tar xzvf $CWD/${PRGNAM}-ng*$VERSION.tar.gz
fi
+
# I expect a pristine kernel source (freshly installed slackware package)
# Madwifi expects the sources at the location that the link
# "/lib/modules/<kernelversion>/build" points to.... so be it.
@@ -167,7 +223,8 @@ else
2>&1 | tee $CWD/install-${PRGNAM}.log
fi
-# Include files (for wpa_supplicant):
+# Include files (for wpa_supplicant) - note that wpa_supplicant can now also
+# communicate with madwifi using the "WEXT" driver:
mkdir -p $PKG/usr/include/madwifi
for i in include net80211; do
find $i -type f -name "*.h" -exec cp -a --parent {} $PKG/usr/include/madwifi \;
@@ -175,23 +232,23 @@ done
# Documentation
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a COPYRIGHT INSTALL README SNAPSHOT THANKS TODO $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a hal/COPYRIGHT $PKG/usr/doc/$PRGNAM-$VERSION/COPYRIGHT.hal
-cp -a hal/README $PKG/usr/doc/$PRGNAM-$VERSION/README.hal
-cp -a patches/README $PKG/usr/doc/$PRGNAM-$VERSION/README.patches
-cp -a docs/WEP-HOWTO.txt docs/users-guide.pdf $PKG/usr/doc/$PRGNAM-$VERSION/
-cp -a scripts $PKG/usr/doc/$PRGNAM-$VERSION/
-chmod -R g-w,o-w $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a COPYRIGHT INSTALL README SNAPSHOT THANKS TODO $PKG/usr/doc/$PRGNAM-$VERSION || true
+cp -a hal/COPYRIGHT $PKG/usr/doc/$PRGNAM-$VERSION/COPYRIGHT.hal || true
+cp -a hal/README $PKG/usr/doc/$PRGNAM-$VERSION/README.hal || true
+cp -a patches/README $PKG/usr/doc/$PRGNAM-$VERSION/README.patches || true
+cp -a docs/WEP-HOWTO.txt docs/users-guide.pdf $PKG/usr/doc/$PRGNAM-$VERSION/ || true
+cp -a scripts $PKG/usr/doc/$PRGNAM-$VERSION/ || true
+chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/*
# Compress the man pages
-find $PKG/usr/man -type f -exec gzip -9f {} \;
+[ -d $PKG/usr/man ] && find $PKG/usr/man -name "*.?" -type f -exec gzip -9f {} \;
# Compress the kernel modules
-[ $PATCHLEVEL -eq 4 ] && find $PKG/lib/modules -type f -exec gzip -9 {} \;
+[ $PATCHLEVEL -eq 4 ] && find $PKG/lib/modules -name "*.?" -type f -exec gzip -9 {} \;
# Add the slack-desc and doinst.sh files
mkdir -p $PKG/install
-cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $SRCDIR/slack-desc > $PKG/install/slack-desc
# Substitute correct kernel versions
sed -i -e "s#\@\@KERNELVERS\@\@#${KVER}#g" $PKG/install/slack-desc
# Write a doinst.sh
@@ -221,15 +278,14 @@ chmod -R o-w $PKG
# Create the package
cd $PKG
-makepkg -l y -c 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 $PKG/install/slack-desc | grep "^${PRGNAM}" > $TMP/$PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.txt
+makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz 2>&1 | tee $CWD/makepkg-${PRGNAM}.log
+(cd $OUTPUT && md5sum $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz > $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz.md5)
+cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/$PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.txt
cd $CWD
# Clean up the extra stuff:
-if [ "$1" = "--cleanup" ]; then
+if [ "$P1" = "--cleanup" ]; then
rm -rf $TMP/tmp-$PRGNAM
rm -rf $PKG
fi