slackbuilds/games/vectoroids/vectoroids.SlackBuild

109 lines
2.7 KiB
Bash

#!/bin/bash
# Slackware build script for vectoroids
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20211016 bkw: BUILD=2
# - add icons and .desktop
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=vectoroids
VERSION=${VERSION:-1.1.0}
BUILD=${BUILD:-2}
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
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 .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# Get rid of cruft accidentally left in the distribution tarball
rm -rf data/images/.xvpics
# Can't just override CFLAGS...
sed -i -e "s/-O2/$SLKCFLAGS/" Makefile
make PREFIX=/usr BIN_PREFIX=/usr/games
mkdir -p $PKG/usr $PKG/usr/games
strip $PRGNAM
make install PREFIX=$PKG/usr BIN_PREFIX=$PKG/usr/games
gzip -9 $PKG/usr/man/man6/*.6
# Upstream's icon.png is barely visible due to being vector
# drawings on a transparent background. I made a hopefully nicer
# icon like so:
# convert -resize 64x64 /usr/share/vectoroids/images/redspot-e.bmp 1.png
# composite /usr/share/vectoroids/images/icon.png -geometry +12+12 1.png 64.png
# convert -resize 48x48 64.png 48.png
# convert -resize 32x32 64.png 32.png
# convert -resize 16x16 64.png 16.png
for i in $CWD/icons/*.png; do
px=$( basename $i | cut -d. -f1 )
size=${px}x${px}
dir=$PKG/usr/share/icons/hicolor/$size/apps
mkdir -p $dir
cat $i > $dir/$PRGNAM.png
done
mkdir -p $PKG/usr/share/pixmaps
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
# .desktop written by SlackBuild author.
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp *.txt $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