#!/bin/bash # Slackware build script for vif # Written by B. Watson (urchlay@slackware.uk) # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # Note to self: the actual upstream download file doesn't seem # to change names (it's "vif-current.tar.gz") when there's a new # version... but the top-level dir inside the tarball does have the # version number (e.g. vif-1.2.16/). So I host the tarball myself, # renamed to match the version number. See getsrc.sh. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=vif VERSION=${VERSION:-1.2.16} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi set -e # "make check" doesn't work until after the package has been installed # (and even then it's checking the installed version, not the binaries # we just built). if [ "${CHECK:-no}" = "yes" ]; then CHECK=yes if [ ! -x /usr/bin/vif ]; then CHECK=no elif [ "$( /usr/bin/vif -v | head -1 | cut -d' ' -f2 )" != "$VERSION" ]; then CHECK=no fi if [ "$CHECK" = "no" ]; then cat <&1 | tee make_check.log # The recursive Makefiles can't be parallelized. Using -jN where N>1 # works, but spews "jobserver unavailable" warnings. # Allowing CC overrides in the env, but this *does not* compile # with Slack 15.0's clang. make -j1 C_COMPILER=${CC:-gcc} LOCDIR=/usr # Do not use 'make install', it doesn't support DESTDIR, and does a # "make clean" followed by "make all", so we can't use LOCDIR=$PKG/usr # either (the $PKG would end up hardcoded in the binaries). Also, # 'make install' uses sudo, which would normally be OK since we run as # root, but if the local sysadmin has removed root from /etc/sudoers, # it would break... mkdir -p $PKG/usr/{bin,$LIB,include,man/man1} install -s -m0755 src/bin/vif $PKG/usr/bin install -m0644 src/include/vif.h $PKG/usr/include install -m0644 src/lib/libvif.a $PKG/usr/$LIB gzip -9c < src/man/vif.1 > $PKG/usr/man/man1/vif.1.gz PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKGDOC cp -a AUTHORS COPYING NEWS README $PKGDOC [ "$CHECK" = "yes" ] && cp -a make_check.log $PKGDOC cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE