slackbuilds/desktop/wmmon/wmmon.SlackBuild

102 lines
2.8 KiB
Bash

#!/bin/sh
# Slackware build script for wmmon
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20191211 bkw: Update for v1.4. Script can no longer build the old version.
# - add libdockapp dep
# - get rid of patches (no longer needed)
# - add icon (to go with upstream's new .desktop file)
# - s/clock/window in man page, also document -c option
# 20170224 bkw:
# - BUILD=2
# - install /etc/wmmonrc as a proper .new config
# - make doinst.sh treat /etc/wmmonrc.new correctly
# - don't install INSTALL in package docdir
# - added notes (to myself) about version numbers, to stop myself
# from trying to "upgrade" to 1.2b1.
# - actually mention windowmaker in the README (derp!)
PRGNAM=wmmon
VERSION=${VERSION:-1.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/${PRGNAM}_${VERSION}.orig.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 {} \+
# Man page taken from Debian, slightly corrected, and -c option added.
cat $CWD/$PRGNAM.1 > $PRGNAM.1
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
make
make install-strip DESTDIR=$PKG
gzip $PKG/usr/man/man1/*.1
mkdir -p $PKG/etc
cat $CWD/wmmonrc > $PKG/etc/wmmonrc.new
# Icon created from wmmon-master.xpm + some overlaid text. If you
# think it's ugly, you're right: PLEASE send me a nicer looking one.
# I never claimed to be a graphic designer.
mkdir -p $PKG/usr/share/pixmaps
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
# Make .desktop reference the icon.
echo 'Icon=/usr/share/pixmaps/wmmon.png' >> \
$PKG/usr/share/applications/$PRGNAM.desktop
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a BUGS CHANGES COPYING HINTS README TODO $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}