111 lines
3.0 KiB
Bash
111 lines
3.0 KiB
Bash
#!/bin/bash
|
|
|
|
# Slackware build script for td_lib
|
|
|
|
# Written by B. Watson (urchlay@slackware.uk)
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
# For a long time, this was bundled with ded. However, recent versions
|
|
# of ded have configure scripts and makefiles that have grown too
|
|
# complex to easily force it to find td_lib in a custom directory. The
|
|
# path of least resistance is to break this library out into its own
|
|
# build, even though nothing else besides ded uses it.
|
|
|
|
# 20250210 bkw: update for 20250117.
|
|
# 20240809 bkw: update for 20240421. I missed upstream's new release...
|
|
|
|
# 20240423 bkw, BUILD=2: add missing .pc file to package. I thought
|
|
# ded was compiling OK without it, but it was actually pulling in
|
|
# td_lib from $TMP, not the installed package... which meant building
|
|
# td_lib followed by ded seemed to work, but building td_lib, then "rm
|
|
# -rf /tmp/SBo", *then* building ded would fail. Grr.
|
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
PRGNAM=td_lib
|
|
VERSION=${VERSION:-20250117}
|
|
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-$VERSION
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tgz
|
|
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 {} +
|
|
|
|
# "checking for long filenames" wants to create files in /usr/lib and
|
|
# /var/lib. Violates the principle of least surprise: users don't expect
|
|
# configure scripts (or SlackBuilds) to touch their system directories.
|
|
# We skip this check with an environment variable.
|
|
|
|
ac_cv_sys_long_file_names="set" \
|
|
CFLAGS="$SLKCFLAGS" \
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
./configure \
|
|
--prefix=/usr \
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
--sysconfdir=/etc \
|
|
--localstatedir=/var \
|
|
--mandir=/usr/man \
|
|
--disable-static \
|
|
--build=$ARCH-slackware-linux
|
|
|
|
# Yes, the -j1's are necessary.
|
|
make -j1
|
|
make -j1 install DESTDIR=$PKG
|
|
|
|
# 20240423 bkw: make install doesn't install this, ded needs it.
|
|
PC=$PKG/usr/lib$LIBDIRSUFFIX/pkgconfig
|
|
mkdir -p $PC
|
|
cp -a support/$PRGNAM.pc $PC
|
|
|
|
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
|
|
mkdir -p $PKGDOC
|
|
cp -a CHANGES COPYING README $PKGDOC
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
|
|
|
|
mkdir -p $PKG/install
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cd $PKG
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|