summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2018-02-18 11:27:38 +0000
committer Eric Hameleers <alien@slackware.com>2018-02-18 11:27:38 +0000
commit8d87055233ad26cd02fbafc88a521de22ca160e7 (patch)
treef5bbc9b98bcfe12eb867b8993ac7dde17b692186
parent8bf4bef9cc94059de56fbcf23ea327555d55a38c (diff)
downloadasb-8d87055233ad26cd02fbafc88a521de22ca160e7.tar.gz
asb-8d87055233ad26cd02fbafc88a521de22ca160e7.tar.xz
broadcom-sta: make it a proper script for release.
-rwxr-xr-xbroadcom-sta/build/broadcom-sta.SlackBuild98
1 files changed, 53 insertions, 45 deletions
diff --git a/broadcom-sta/build/broadcom-sta.SlackBuild b/broadcom-sta/build/broadcom-sta.SlackBuild
index a5abd73a..19cda51d 100755
--- a/broadcom-sta/build/broadcom-sta.SlackBuild
+++ b/broadcom-sta/build/broadcom-sta.SlackBuild
@@ -1,8 +1,6 @@
#!/bin/sh
-# Slackware build script for broadcom-sta
-
-# Copyright 2015 Andreas Voegele <andreas@andreasvoegele.com>
+# Copyright 2016, 2017, 2018 Eric Hameleers, Eindhoven, Netherlands
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -16,48 +14,52 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
PRGNAM=broadcom-sta
VERSION=${VERSION:-6.30.223.271}
+SRCVER=${SRCVER:-35}
BUILD=${BUILD:-1}
TAG=${TAG:-alien}
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
KERNEL=${KERNEL:-$( uname -r )}
+# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
- case "$( uname -m )" in
- i?86) ARCH=i486 ;;
- arm*) ARCH=arm ;;
- *) ARCH=$( uname -m ) ;;
+ case "$(uname -m)" in
+ i?86) ARCH=i586 ;;
+ arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$(uname -m) ;;
esac
+ export ARCH
fi
-CWD=$(pwd)
-TMP=${TMP:-/tmp/SBo}
-PKG=$TMP/package-$PRGNAM
-OUTPUT=${OUTPUT:-/tmp}
-
case "$ARCH" in
i?86)
- SRCNAM=hybrid-v35-nodebug-pcoem
+ ARCHSUFF=""
;;
x86_64)
- SRCNAM=hybrid-v35_64-nodebug-pcoem
+ ARCHSUFF="_64"
;;
*)
- echo "$ARCH is not supported..."
+ echo "Unsupported architecture $ARCH"
exit 1
;;
esac
-set -e
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/pkg-$PRGNAM
rm -rf $PKG
-mkdir -p $TMP $PKG $OUTPUT
+mkdir -p $TMP $PKG
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
-tar xvf $CWD/$SRCNAM-$( echo $VERSION | tr . _ ).tar.gz
+tar xvf $CWD/hybrid-v${SRCVER}${ARCHSUFF}-nodebug-pcoem-$( echo $VERSION | tr . _ ).tar.?z || exit 1
# Add support for newer kernels:
for KMINOR in 7 8 11 12; do
@@ -68,49 +70,55 @@ done
cat $CWD/patches/001-null-pointer-fix.patch | patch -p1 --verbose || exit 1
cat $CWD/patches/002-rdtscl.patch | patch -p1 --verbose || exit 1
+# Make sure ownerships and permissions are sane:
chown -R root:root .
-find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
- -o -perm 511 \) -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
- -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+# Compile the kernel module:
make -C /lib/modules/$KERNEL/build M=$(pwd) clean
make -C /lib/modules/$KERNEL/build M=$(pwd)
-mkdir -p $PKG/lib/modules/$KERNEL/kernel/extra
-cp wl.ko $PKG/lib/modules/$KERNEL/kernel/extra
-
-mkdir -p $PKG/etc/modprobe.d
-cat $CWD/b43_blacklist.conf.new > $PKG/etc/modprobe.d/b43_blacklist.conf.new
+# Manually install the lot:
+install -Dm644 wl.ko $PKG/lib/modules/$KERNEL/kernel/extra/wl.ko
+install -Dm644 $CWD/b43_blacklist.conf.new $PKG/etc/modprobe.d/b43_blacklist.conf.new
+# Add documentation:
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a lib/LICENSE.txt $CWD/README_$VERSION.txt $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ lib/LICENSE.txt $CWD/README* \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cp -ia $CWD/patches $PKG/usr/doc/$PRGNAM-$VERSION/
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+# Add a package description and a post-install script:
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat << EOF > $PKG/install/doinst.sh
+# Handle the incoming configuration files:
config() {
- NEW="\$1"
- OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
- # If there's no config file by that name, mv it over:
- if [ ! -r \$OLD ]; then
- mv \$NEW \$OLD
- elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
- # toss the redundant copy
- rm \$NEW
- fi
- # Otherwise, we leave the .new copy for the admin to consider...
+ for infile in \$1; do
+ NEW="\$infile"
+ OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r \$OLD ]; then
+ mv \$NEW \$OLD
+ elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm \$NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+ done
}
-
config etc/modprobe.d/b43_blacklist.conf.new
-# A good idea whenever kernel modules are added or changed:
-if [ -x sbin/depmod ]; then
- chroot . /sbin/depmod -a $KERNEL 1> /dev/null 2> /dev/null
-fi
+# Update kernel module dependencies information:
+chroot . /sbin/depmod -a $KERNEL 1>/dev/null 2>/dev/null
EOF
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_$( echo $KERNEL | tr - _ )-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+/sbin/makepkg -l y -c n $TMP/$PRGNAM-${VERSION}_$(echo $KERNEL |tr - _)-$ARCH-$BUILD$TAG.txz
+