2021-07-03 19:48:15 +02:00
|
|
|
#!/bin/bash
|
2018-07-09 09:58:36 +02:00
|
|
|
|
|
|
|
# Slackware build script for unsf
|
|
|
|
|
2022-06-08 18:26:26 +02:00
|
|
|
# Written by B. Watson (urchlay@slackware.uk)
|
2018-07-09 09:58:36 +02:00
|
|
|
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
|
|
|
|
# Upstream hasn't done a proper release since 1.0, we use latest git.
|
|
|
|
# Use git2targz.sh to prepare source tarballs, when it's time to update.
|
|
|
|
|
2021-11-26 19:55:01 +01:00
|
|
|
# 20211126 bkw: update for v1.1+git20201107
|
|
|
|
|
2021-07-04 11:41:06 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2018-07-09 09:58:36 +02:00
|
|
|
PRGNAM=unsf
|
2021-11-26 19:55:01 +01:00
|
|
|
VERSION=${VERSION:-1.1+git20201107}
|
2018-07-09 09:58:36 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 12:23:38 +02:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2018-07-09 09:58:36 +02:00
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i586 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 12:23:38 +02:00
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-07-09 09:58:36 +02:00
|
|
|
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-$VERSION
|
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
|
|
|
|
cd $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
2021-11-26 19:55:01 +01:00
|
|
|
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
|
|
|
|
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
|
2018-07-09 09:58:36 +02:00
|
|
|
|
|
|
|
# upstream forgot to create include/ in the src, revisit this later.
|
|
|
|
sed -i 's#include/\(libunsf\.h\)#\1#' CMakeLists.txt
|
|
|
|
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
|
|
|
|
-DMAN_INSTALL_DIR=/usr/man \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release ..
|
|
|
|
make
|
|
|
|
make install/strip DESTDIR=$PKG
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# don't see a way to get cmake to skip the static lib/exe.
|
|
|
|
rm -f $PKG/usr/bin/$PRGNAM-static $PKG/usr/lib$LIBDIRSUFFIX/*.a
|
|
|
|
|
|
|
|
# install doesn't install the man page...
|
|
|
|
mkdir -p $PKG/usr/man/man1/
|
|
|
|
gzip -9c < $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a README* LICENSE $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
|
|
|
|
|
|
|
|
cd $PKG
|
2021-07-04 12:23:38 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|