#!/bin/bash # usb_modeswitch.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter for Slackware ARM. DATAVER=${DATAVER:-20100418} # 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=armv4t" 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 gcc $SLKCFLAGS $LDFLAGS -lusb -Wall -o usb_modeswitch usb_modeswitch.c || exit 1 # Install into package: install -D -s -m 0755 usb_modeswitch $PKG/usr/sbin/usb_modeswitch install -D -m 0755 usb_modeswitch.tcl $PKG/lib/udev/usb_modeswitch install -D -m 0644 usb_modeswitch.conf $PKG/etc/usb_modeswitch.conf.new mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION cp -a \ COPYING* README* \ $PKG/usr/doc/$PKGNAM-$VERSION 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 install -D -m 0644 40-usb_modeswitch.rules $PKG/lib/udev/rules.d/40-usb_modeswitch.rules mkdir -p $PKG/etc cp -a usb_modeswitch.d $PKG/etc mkdir -p $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