summaryrefslogtreecommitdiffstats
path: root/network/proxymini/proxymini.SlackBuild
blob: 68097b4856887dd2e1249b04a64cd1bec639d079 (plain)
#!/bin/bash

# Slackware build script for proxymini
# Written by Thomas Morper <thomas@beingboiled.info>

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=proxymini
VERSION=${VERSION:-0.2.3}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
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" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -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

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
unzip -d $PRGNAM-$VERSION $CWD/$PRGNAM.zip
cd $PRGNAM-$VERSION
chown -R root:root .
find . -type f -exec chmod 644 {} \;

CFLAGS="$SLKCFLAGS" make

mkdir -p $PKG/usr/bin
cp -a proxymini $PKG/usr/bin

mkdir -p $PKG/usr/man/man1
cat $CWD/proxymini.1 > $PKG/usr/man/man1/proxymini.1
gzip -9 $PKG/usr/man/man1/proxymini.1

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