From 8fe39e7dfbecd2d0cbba9fb92de313a8c3fbfeee Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Wed, 20 Sep 2006 22:15:23 +0000 Subject: Rewrote the SlackBuild (like the gcc check) --- wpa_supplicant/build/wpa_supplicant.SlackBuild | 151 ++++++++++++++++++------- 1 file changed, 111 insertions(+), 40 deletions(-) (limited to 'wpa_supplicant/build') diff --git a/wpa_supplicant/build/wpa_supplicant.SlackBuild b/wpa_supplicant/build/wpa_supplicant.SlackBuild index a1133b96..97c34263 100755 --- a/wpa_supplicant/build/wpa_supplicant.SlackBuild +++ b/wpa_supplicant/build/wpa_supplicant.SlackBuild @@ -55,6 +55,8 @@ # Upgrade. This time, build the wpa_gui and man pages too. # Also, made support for madwifi/hermes/broadcom drivers # configurable using three *_INCLUDES variables. +# 0.4.9-2: * 20/sep/2006 by Eric Hameleers +# Changed the SlackBuild for Slackware 11.0 compatibility # # ------------------------------------------------------------------------------ # @@ -68,20 +70,16 @@ # --- INIT --- # Set initial variables: -CWD=`pwd` -if [ "$TMP" = "" ]; then - TMP=/tmp -fi -OFFICIAL_RELEASE="yes" # make empty if you're building from CVS +SNAPSHOT="" # set to "yes" if you're building from CVS SRCNAM=hostap PRGNAM=wpa_supplicant -VERSION=0.4.9 +VERSION=${VERSION:-0.4.9} ARCH=${ARCH:-i486} -BUILD=1 +BUILD=2 DOC="ChangeLog COPYING README* examples \ - wpa_supplicant.conf.sample $CWD/README.slackware" + wpa_supplicant.conf.sample" # Support for some of the wireless drivers needs the header files of those # drivers. @@ -93,30 +91,104 @@ MADWIFI_INCLUDES="/usr/include/madwifi" HERMES_INCLUDES="" BROADCOM_INCLUDES="" - -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" +if [ -z $SNAPSHOT ]; then # build a stable release + SOURCE="${PRGNAM}-${VERSION}.tar.gz" + SRCURL="http://hostap.epitest.fi/releases/${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} + +# 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} + +## +## --- with a little luck, you won't have to edit below this point --- ## +## + +# 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 -m${MOPT}=i686" + SLKLDFLAGS=""; LIBDIRSUFFIX="" + ;; + i486) SLKCFLAGS="-O2 -march=i486 -m${MOPT}=i686" + SLKLDFLAGS=""; LIBDIRSUFFIX="" + ;; + s390) SLKCFLAGS="-O2" + SLKLDFLAGS=""; LIBDIRSUFFIX="" + ;; + powerpc) SLKCFLAGS="-O2" + SLKLDFLAGS=""; LIBDIRSUFFIX="" + ;; + x86_64) SLKCFLAGS="-O2 -fPIC" + SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64" + ;; + athlon-xp) SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" + SLKLDFLAGS=""; LIBDIRSUFFIX="" + ;; +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 -if [ ! -d $PKG ]; then - mkdir -p $PKG # place for the package to be built +if [ "$PKG" = "" -o "$PKG" = "/" ] ; then + echo "Please provide a sane value for the variable 'PKG'." + exit 1 +elif [ ! -d $PKG ]; then + mkdir -p $PKG # place for the package to be built +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 @@ -126,14 +198,12 @@ echo "++" echo "|| $PRGNAM-$VERSION" echo "++" -# We always erase old package's contents: -rm -rf $PKG/* rm -f $CWD/*.log # Explode the package framework: -if [ -e $CWD/_$PRGNAM.tar.gz ]; then +if [ -e $SRCDIR/_$PRGNAM.tar.gz ]; then (cd $PKG && - explodepkg $CWD/_$PRGNAM.tar.gz ) + explodepkg $SRCDIR/_$PRGNAM.tar.gz ) fi cd $TMP/tmp-$PRGNAM @@ -142,25 +212,25 @@ cd $TMP/tmp-$PRGNAM # Extract the source archive, patch and modify # -if ! [ -f $CWD/${PRGNAM}-${VERSION}.defconfig ]; then +if ! [ -f $SRCDIR/${PRGNAM}-${VERSION}.defconfig ]; then echo "Could not find ${PRGNAM}-${VERSION}.defconfig!" echo "You need to create that file using ${SRCNAM}-${VERSION}/${PRGNAM}/defconfig as example." exit 1 fi -if [ -z "$OFFICIAL_RELEASE" ]; then - tar -xzvf $CWD/${SRCNAM}-${VERSION}.tar.gz +if [ -z "$SNAPSHOT" ]; then + tar -xzvf $SRCDIR/${PRGNAM}-${VERSION}.tar.gz + cd ${PRGNAM}-${VERSION} +else + tar -xzvf $SRCDIR/${SRCNAM}-${VERSION}.tar.gz cd ${SRCNAM}-${VERSION}/${PRGNAM} sed -i -e \ "s/^#define VERSION_STR \"\(.*\)\"/#define VERSION_STR \"\1_$VERSION\"/" \ version.h -else - tar -xzvf $CWD/${PRGNAM}-${VERSION}.tar.gz - cd ${PRGNAM}-${VERSION} fi # Create the configuration file for wpa_supplicant: -cat $CWD/${PRGNAM}-${VERSION}.defconfig > .config +cat $SRCDIR/${PRGNAM}-${VERSION}.defconfig > .config if [ ! -z $MADWIFI_INCLUDES -a -d $MADWIFI_INCLUDES ]; then echo "Adding madwifi driver (Atheros) support" | tee -a $CWD/configure.log cat <<-EOT >> .config @@ -192,7 +262,7 @@ make wpa_gui 2>&1 | tee -a $CWD/make.log ( cd doc/docbook if ! ls *.? >/dev/null 2>&1 ; then - make man + make man 2>&1 | tee -a $CWD/make.log fi ) @@ -262,7 +332,7 @@ strip --strip-unneeded 2> /dev/null # --- 'doinst.sh' script: ------ -mkdir -p $PKG/install +mkdir -p $PKG/install 2>/dev/null || true cat < $PKG/install/doinst.sh # Handle the incoming configuration files: config() { @@ -286,7 +356,8 @@ EOINS # --- DOCUMENTATION --- # Copy the documentation: mkdir -p $PKG/usr/doc/${PRGNAM}-${VERSION} -cp -a $DOC $PKG/usr/doc/${PRGNAM}-${VERSION} +cp -a $DOC $PKG/usr/doc/${PRGNAM}-${VERSION}/ || true +cp -a $SRCDIR/README.slackware $PKG/usr/doc/${PRGNAM}-${VERSION}/ || true chmod -R a-w $PKG/usr/doc/${PRGNAM}-${VERSION}/* # Compress the man page(s) @@ -295,21 +366,21 @@ chmod -R a-w $PKG/usr/doc/${PRGNAM}-${VERSION}/* # --- PACKAGE DESCRIPTION --- -mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +mkdir -p $PKG/install 2>/dev/null || true +cat $SRCDIR/slack-desc > $PKG/install/slack-desc # --- PACKAGE CREATION --- # Build the package and compute its md5 checksum: cd $PKG -makepkg --linkadd y --chown n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.tgz -cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.txt -(cd $TMP && md5sum $PRGNAM-$VERSION-$ARCH-$BUILD.tgz > $PRGNAM-$VERSION-$ARCH-$BUILD.tgz.md5) +makepkg --linkadd y --chown n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD.tgz +cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD.txt +(cd $OUTPUT && md5sum $PRGNAM-$VERSION-$ARCH-$BUILD.tgz > $PRGNAM-$VERSION-$ARCH-$BUILD.tgz.md5) # --- CLEANUP --- # Clean up the extra stuff: -if [ "$1" = "--cleanup" ]; then +if [ "$P1" = "--cleanup" ]; then rm -rf $TMP/tmp-$PRGNAM rm -rf $PKG fi -- cgit v1.2.3-65-gdbad