summaryrefslogtreecommitdiffstats
path: root/misc/ardesia/ardesia.SlackBuild
blob: 7966118714590299d8139980c4c983d0f022318c (plain)
#!/bin/sh

# Slackware build script for ardesia

# Written by Geoff Ritter < geoff dot ritter at gmail dot com >

# Public Domain

PRGNAM=ardesia
VERSION=${VERSION:-0.6}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

CWD=$(pwd)
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
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
# If you are going to blindly reset permissions, this is a bit more readable.
# However '-perm /111' may only be compatible with only gnu/find.
find . \
  -type d -exec chmod 755 {} \; -o \
  -type f -perm /111 -exec chmod 755 {} \; -o \
  -type f -exec chmod 644 {} \;

# Note, while there are no library files installed, the Make file apparently
# uses --libdir to decided where to find some of the libraries.

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib$LIBDIRSUFFIX \
  --mandir=/usr/man \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --build=$ARCH-slackware-linux

make
make install DESTDIR=$PKG

# Make sure the Icon parameter is set properly in .desktop file
sed -i 's/Icon=.*/Icon=ardesia/' $PKG/usr/share/applications/ardesia.desktop
# Copy the icon to the proper folder
mkdir -p $PKG/usr/share/icons/hicolor/22x22/apps/
cp $PKG/usr/share/pixmaps/ardesia.png $PKG/usr/share/icons/hicolor/22x22/apps

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# No Manpages

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
# make install already did this but to the wrong directory
# --docdir is not respected
mv $PKG/usr/doc/ardesia/* $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
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}