slackware-current/extra/source/brltty/brltty.SlackBuild

95 lines
2.3 KiB
Text
Raw Normal View History

#!/bin/sh
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
if [ ! -d $TMP ]; then
mkdir -p $TMP # location to build the source
fi
PKG=/tmp/package-brltty
VERSION=4.0
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-1}
if [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
else
LIBDIRSUFFIX=""
fi
rm -rf $PKG
mkdir -p $PKG
cd $TMP
rm -rf brltty-$VERSION
tar xf $CWD/brltty-$VERSION.tar.?z* || exit 1
cd brltty-$VERSION
sh autogen
chown -R root:root .
find . -perm 775 -exec chmod 755 {} \;
find . -perm 700 -exec chmod 755 {} \;
find . -perm 744 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
./configure \
--prefix=/usr \
--bindir=/bin \
--sbindir=/sbin \
--libdir=/lib${LIBDIRSUFFIX} \
--infodir=/usr/info \
--mandir=/usr/man \
--sysconfdir=/etc \
--build=$ARCH-slackware-linux
make -j2 || exit 1
make install INSTALL_ROOT=$PKG || exit 1
chmod 755 $PKG/bin/* $PKG/lib${LIBDIRSUFFIX}/brltty/*
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mkdir -p $PKG/usr/doc/brltty-$VERSION
cp -a \
README* COPYING* \
Documents/{Manual-*,TODO,CONTRIBUTORS,HISTORY,README.*} \
$PKG/usr/doc/brltty-$VERSION
cat Documents/ChangeLog | head -n 150 > $PKG/usr/doc/brltty-$VERSION/ChangeLog
( cd $PKG/usr/doc/brltty-$VERSION
find . -name "Makefile*" -exec rm -f {} \;
find . -name "*.sgml" -exec rm -f {} \;
find . -size 0 -type f -exec rm -f {} \;
)
gzip -9 $PKG/usr/man/man?/*.?
mkdir -p $PKG/etc
cp -a Documents/brltty.conf $PKG/etc/brltty.conf.new
mkdir -p $PKG/install
# Write out the doinst.sh:
cat << EOF > $PKG/install/doinst.sh
config() {
NEW="\$1"
OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r \$OLD ]; then
mv \$NEW \$OLD
elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy
rm \$NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
config etc/brltty.conf.new
EOF
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n ../brltty-$VERSION-$ARCH-$BUILD.txz