summaryrefslogtreecommitdiffstats
path: root/madwifi/build/madwifi.SlackBuild
blob: e32df1e462b9f9fd08172fb393915a8573ed3a7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh
# $Id$
# ----------------------------------------------------------------------------
CWD=`pwd` 
PRGNAM=madwifi
PKG=/tmp/package-$PRGNAM
TMP=/tmp/tmp-$PRGNAM

rm -rf $TMP
rm -rf $PKG

mkdir -p $TMP
mkdir -p $PKG

KERNELARCH=i686
KERNELVERSION=${KERNELVERSION:-`/bin/uname -r`}
KERNELSRC="/lib/modules/${KERNELVERSION}/build"
VERSION=20051014
ARCH=i486
BUILD=1

# --- PACKAGE BUILDING ---

# Explode the package framework:
cd $TMP
if [ -f $CWD/_$PRGNAM.tar.gz ]; then
  explodepkg $CWD/_$PRGNAM.tar.gz
fi

echo "+=================+"
echo "| $PRGNAM-$VERSION |"
echo "+=================+"

cd $TMP/

# Actually you must get the sources from CVS:
# (first command only when this is an update from CVS):
# cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi up -dP
# cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi co madwifi
# Then pack the source tree into madwifi-yyyymmdd.tar.gz for use in this build.
#
# ... or get a snapshot at http://madwifi.otaku42.de/

echo "Extracting the source tarball..."
tar xzvf $CWD/$PRGNAM-$VERSION.tar.gz

# 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.
cd ${KERNELSRC}
make clean oldconfig dep
cd -

cd $PRGNAM
# The wpa_supplicant/madwifi/dhcp problem patch:
# is now incorporated into the wpa_supplicant CVS!
#patch -p0 < $CWD/ieee80211_wireless.c.patch 2>&1 | tee $CWD/patch-${PRGNAM}.log

# Build the kernel modules and the utilities

# enable the SOFTLED with -DSOFTLED
export COPTS="$COPTS -DSOFTLED"
# If you need another rate control module than ath_rate_sample (the default),
# you'll need to set the ATH_RATE variable before starting make. For instance,
# (read the INSTALL file why you could want this) to build ath_rate_amrr, set:
# export ATH_RATE=ath_rate/amrr
make clean all KERNELPATH=${KERNELSRC} KERNELRELEASE=${KERNELVERSION} \
  2>&1 | tee $CWD/make-${PRGNAM}.log
make -C tools \
  2>&1 | tee -a $CWD/make-${PRGNAM}.log

# Install the kernel module
make install DESTDIR=$PKG KERNELPATH=${KERNELSRC} KERNELRELEASE=${KERNELVERSION} \
  2>&1 | tee $CWD/install-${PRGNAM}.log

# ... and the utilities
mkdir -p $PKG/usr/bin
( cd tools
  make install DESTDIR=$PKG BINDIR=/usr/bin
) 2>&1 | tee -a $CWD/install-${PRGNAM}.log

# Include files (for wpa_supplicant):
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 \; 
done

# Documentation...
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYRIGHT INSTALL README 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
chmod -R g-w,o-w $PKG/usr/doc/$PRGNAM-$VERSION
   
# Compress the kernel modules
find $PKG/lib/modules -type f -exec gzip -9 {} \;

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
# Substitute correct versions
sed -i -e "s#\@\@KERNELVERS\@\@#${KERNELVERSION}#g" $PKG/install/slack-desc
sed -i -e "s#\@\@KERNELVERS\@\@#${KERNELVERSION}#g" $PKG/install/doinst.sh

cd $PKG
makepkg -l y -c n $TMP/$PRGNAM-${VERSION}_${KERNELVERSION}-$ARCH-$BUILD.tgz \
  2>&1 | tee $CWD/makepkg-${PRGNAM}.log
(cd $TMP && md5sum $PRGNAM-${VERSION}_${KERNELVERSION}-$ARCH-$BUILD.tgz > $PRGNAM-${VERSION}_${KERNELVERSION}-$ARCH-$BUILD.tgz.md5)
cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $TMP/$PRGNAM-${VERSION}_${KERNELVERSION}-$ARCH-$BUILD.txt


cd $CWD

# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
  rm -rf $TMP
  rm -rf $PKG
fi