summaryrefslogblamecommitdiffstats
path: root/desktop/wmmon/wmmon.SlackBuild
blob: b02b781bab81ea3f4b58f001246608d306199fb1 (plain) (tree)
1
2
3
4
5
6
7
8
           


                                  
                                             
 

                                                                              


                                                         





                                                                            








                                                                 

                             
            
                       
                 
                
                       
 

                         
                      
                     



                               




                                                   



                        

                                         

                                         

                                 






                          
                       

                                             
                    


                                                                   




                                                                















                                                                      

                 
                                       
 









                                                                    
                                      
                                                                          






                                                                              
                                                                          
#!/bin/bash

# Slackware build script for wmmon

# Written by B. Watson (urchlay@slackware.uk)

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

# 20230214 bkw: BUILD=2
# - add patch to detect I/O on NVME devices (in -i mode).

# 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!)

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

PRGNAM=wmmon
VERSION=${VERSION:-1.4}
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"
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 {} \+

# I/O monitoring works by checking /proc/diskstats. Each line is
# a device name, and nvme devices weren't invented yet when the
# code was originally written...
patch -p1 < $CWD/nvme.diff

# 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