summaryrefslogtreecommitdiffstats
path: root/system/xidel/xidel.SlackBuild
blob: 46d90f52ddb63d3b77361682a25573155efb3d66 (plain)
#!/bin/bash

# Slackware build script for xidel

# Written by B. Watson (yalhcru@gmail.com)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

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

PRGNAM=xidel
VERSION=${VERSION:-0.9.8}
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 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}

# No CFLAGS (Pascal, not C), no need for LIBDIRSUFFIX. Upstream
# uses fpc's -O3 option, for whatever that's worth.

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION-src
tar xvf $CWD/$PRGNAM-$VERSION.src.tar.gz
cd $PRGNAM-$VERSION-src
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# Fairly weird build process, but simple enough. -s means strip. Tests
# require internet access, so disabled by default.
[ "${TESTS:-no}" = "yes" ] && T="-t"

cd programs/internet/$PRGNAM
./build.sh -s $T
mkdir -p $PKG/usr/bin
cp -a $PRGNAM $PKG/usr/bin

mkdir -p $PKG/usr/man/man1
gzip -9c < meta/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README* COPYING changelog examples $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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