2021-07-04 01:48:15 +08:00
|
|
|
#!/bin/bash
|
2015-03-03 03:51:29 +08:00
|
|
|
|
2010-05-13 05:28:21 +08:00
|
|
|
# Slackware build script for slock
|
|
|
|
|
2012-04-02 12:18:55 +08:00
|
|
|
# Copyright 2007-2012 Grigorios Bouzakis <grbzks@imap.cc>
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software for any purpose
|
|
|
|
# with or without fee is hereby granted, provided that the above copyright
|
|
|
|
# notice and this permission notice appear in all copies.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
|
|
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS AND COPYRIGHT HOLDERS AND THEIR CONTRIBUTORS BE LIABLE FOR ANY
|
|
|
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2010-05-13 05:28:21 +08:00
|
|
|
|
2015-03-23 10:32:44 +08:00
|
|
|
# Modified by Mario Preksavec <mario@slackware.hr>
|
|
|
|
|
2021-07-04 17:41:06 +08:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2010-05-13 05:28:21 +08:00
|
|
|
PRGNAM=slock
|
2017-05-15 09:43:17 +08:00
|
|
|
VERSION=${VERSION:-1.4}
|
2016-08-19 10:19:19 +08:00
|
|
|
BUILD=${BUILD:-1}
|
2010-05-13 05:28:21 +08:00
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 18:23:38 +08:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2010-05-13 05:28:21 +08:00
|
|
|
|
2010-05-23 13:43:31 +08:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2016-08-19 10:19:19 +08:00
|
|
|
i?86) ARCH=i586 ;;
|
2010-06-04 13:01:32 +08:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
2010-05-23 13:43:31 +08:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 18:23:38 +08:00
|
|
|
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
|
|
|
# the name of the created package would be, and then exit. This information
|
|
|
|
# could be useful to other scripts.
|
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2010-05-13 05:28:21 +08:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2016-08-19 10:19:19 +08:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2010-05-13 06:23:11 +08:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-13 05:28:21 +08:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-13 06:23:11 +08:00
|
|
|
LIBDIRSUFFIX="64"
|
2010-05-23 13:43:31 +08:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-13 05:28:21 +08:00
|
|
|
fi
|
|
|
|
|
2012-04-02 12:18:55 +08:00
|
|
|
DOCS="LICENSE README"
|
|
|
|
|
2010-05-13 05:28:21 +08:00
|
|
|
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 .
|
2013-11-22 15:37:19 +08:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2010-05-13 05:28:21 +08:00
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
2010-05-13 06:23:11 +08:00
|
|
|
# This uses our CFLAGS defined above
|
2016-01-10 13:13:52 +08:00
|
|
|
sed "s,@SLACKCFLAGS@,$SLKCFLAGS," $CWD/patches/config.mk.patch | patch -p1
|
|
|
|
|
2016-08-19 10:19:19 +08:00
|
|
|
make \
|
|
|
|
PREFIX=/usr \
|
|
|
|
MANPREFIX=/usr/man \
|
|
|
|
X11INC=/usr/include/X11 \
|
|
|
|
X11LIB=/usr/lib${LIBDIRSUFFIX}/X11
|
|
|
|
make install \
|
|
|
|
PREFIX=/usr \
|
|
|
|
MANPREFIX=/usr/man \
|
|
|
|
X11INC=/usr/include/X11 \
|
|
|
|
X11LIB=/usr/lib${LIBDIRSUFFIX}/X11 \
|
|
|
|
DESTDIR=$PKG
|
2010-05-13 06:23:11 +08:00
|
|
|
|
2015-03-16 14:32:47 +08:00
|
|
|
# This approach was preferable, but since slock must have root privs to
|
|
|
|
# adjust its OOM score, oh well...
|
|
|
|
#chown root:shadow $PKG/usr/bin/slock
|
|
|
|
#chmod 2755 $PKG/usr/bin/slock
|
|
|
|
chmod 4755 $PKG/usr/bin/slock
|
2010-05-13 05:28:21 +08:00
|
|
|
|
2012-04-02 12:18:55 +08:00
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
2016-08-19 10:19:19 +08:00
|
|
|
gzip -9 $PKG/usr/man/man?/*.?
|
|
|
|
|
2010-05-13 05:28:21 +08:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
2012-04-02 12:18:55 +08:00
|
|
|
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
|
2010-05-13 05:28:21 +08:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
2015-03-23 10:32:44 +08:00
|
|
|
# User knows whats at stake
|
|
|
|
if [ "${OVERRIDEXFLOCK4:-no}" != "no" ]; then
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
fi
|
|
|
|
|
2010-05-13 05:28:21 +08:00
|
|
|
cd $PKG
|
2021-07-04 18:23:38 +08:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|