#!/bin/bash # usb_modeswitch.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter for Slackware ARM. DATAVER=${DATAVER:-20120812} # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: case $ARCH in arm) export SLKCFLAGS="-O2 -march=armv5te" export LIBDIRSUFFIX="" ;; *) export SLKCFLAGS="-O2" ;; esac # Extract source: tar xvvf $CWD/usb-modeswitch-[0-9]*.tar*?z? cd usb* || exit 1 slackhousekeeping # Build: make clean # "make static" uses the embedded "jim" Tcl interpreter make static # Install into package: install -D -s --mode=755 usb_modeswitch $PKG/usr/sbin/usb_modeswitch install -D --mode=755 usb_modeswitch.sh $PKG/lib/udev/usb_modeswitch install -D --mode=644 usb_modeswitch.conf $PKG/etc/usb_modeswitch.conf.new install -D --mode=644 usb_modeswitch.1 $PKG/usr/man/man1/usb_modeswitch.1 install -d $PKG/var/lib/usb_modeswitch install -D -s --mode=755 usb_modeswitch_dispatcher $PKG/usr/sbin/usb_modeswitch_dispatcher mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION cp -a \ COPYING* README* \ $PKG/usr/doc/$PKGNAM-$VERSION cat $CWD/device_reference.txt.gz > $PKG/usr/doc/$PKGNAM-$VERSION/device_reference.txt mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/jim cp -fav \ jim/{AUTHORS,LICENSE,README*} \ $PKG/usr/doc/$PKGNAM-$VERSION/jim changelogliposuction ChangeLog $PKGNAM $VERSION # Trim down a "ChangeLog" file # Now, install the data pack: cd $TMPBUILD tar xvf $CWD/usb-modeswitch-data-${DATAVER}.tar.?z* || exit 1 cd usb-modeswitch-data* || exit 1 slackhousekeeping make install DESTDIR=$PKG || exit 1 mkdir -vpm755 $PKG/usr/doc/usb-modeswitch-data-${DATAVER} changelogliposuction ChangeLog usb-modeswitch-data $DATAVER # Trim down a "ChangeLog" file cp -a \ COPYING* README* \ $PKG/usr/doc/usb-modeswitch-data-${DATAVER} # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links