summaryrefslogblamecommitdiffstats
path: root/system/esekeyd/esekeyd.SlackBuild
blob: 4da676c46c2327027f22ff3f0759085e2be7b87a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
           


                                    
                                             


                                                                              

                             



                         
                       








                               




                                                   












































































                                                                              
                                                                          
#!/bin/bash

# Slackware build script for esekeyd

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

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

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

PRGNAM=esekeyd
VERSION=${VERSION:-1.2.7}
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 [ ! -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-$PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$PRGNAM-$VERSION

# The license is supposed to be GPL3, but it's shipped as a symlink
# to /usr/share/automake-1.10/COPYING, which doesn't even exist on
# Slackware 14.2. Use a copy that does exist.
rm -f COPYING
cp $( /bin/ls /usr/share/automake-*/COPYING | head -1 ) .

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 {} \+

# Typo in man pages.
sed -i 's,pools,polls,g' doc/*.1

# The keyboard autodetection code is outdated and broken. Patch has
# been sent upstream and will hopefully be incorporated in the next
# release.
patch -p1 < $CWD/keyboard_detection.diff

[ -e configure ] || sh bootstrap

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/man?/*.?

# Example config. As shipped, but with all the commands commented out.
# Also add a simpler example that everyone should be able to use.
mkdir -p $PKG/etc
sed 's,^.,#&,' examples/example.conf > $PKG/etc/$PRGNAM.conf.new
cat $CWD/config.snippet >> $PKG/etc/$PRGNAM.conf.new

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog NEWS 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