summaryrefslogtreecommitdiffstats
path: root/system/loksh/loksh.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'system/loksh/loksh.SlackBuild')
-rw-r--r--system/loksh/loksh.SlackBuild67
1 files changed, 45 insertions, 22 deletions
diff --git a/system/loksh/loksh.SlackBuild b/system/loksh/loksh.SlackBuild
index 31f9e194c8..b17f14c8b0 100644
--- a/system/loksh/loksh.SlackBuild
+++ b/system/loksh/loksh.SlackBuild
@@ -1,8 +1,9 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for loksh
-# Copyright 2018-2019 Hunter Sezen California, USA
+# Copyright 2018-2020 Hunter Sezen California, USA
+# Copyright 2023-2024 K. Eugene Carlson Tsukuba, JP
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,10 +23,13 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PRGNAM=loksh
-VERSION=${VERSION:-6.6}
+VERSION=${VERSION:-7.5}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -35,23 +39,26 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# 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
+
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 -eu
@@ -60,7 +67,7 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
@@ -69,23 +76,39 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-make \
- CFLAGS="$SLKCFLAGS"
+if [ "${DEBUG:=0}" != 0 ]; then
+ NDEBUG=false
+ RELEASE=debug
+ SLKCFLAGS="$(printf %s "$SLKCFLAGS" | sed 's/-O2/-O0/')"
+else
+ NDEBUG=true
+ RELEASE=plain
+fi
-make install \
- PREFIX=/usr \
- BIN_NAME=$PRGNAM \
- BIN_DIR=/bin \
- MAN_DIR=/usr/man \
- DOC_DIR=/usr/doc/$PRGNAM-$VERSION \
- DESTDIR=$PKG
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+meson setup \
+ --prefix=/ \
+ --bindir=bin \
+ --mandir=usr/man \
+ --datadir=usr \
+ -Dstrip=$NDEBUG \
+ -Db_ndebug=$NDEBUG \
+ -Dbuildtype=$RELEASE \
+ build
+
+"${NINJA:=ninja}" -C build
+DESTDIR=$PKG "$NINJA" -C build install
+
+mv -- $PKG/bin/ksh $PKG/bin/$PRGNAM
+mv -- $PKG/usr/man/man1/ksh.1 $PKG/usr/man/man1/$PRGNAM.1
+mv -- $PKG/usr/doc/$PRGNAM $PKG/usr/doc/$PRGNAM-$VERSION
+# bash is the default sh in Slackware, so this page is unwanted.
+rm -f $PKG/usr/man/man1/sh.1
mkdir -p $PKG/usr/bin
ln -s /bin/$PRGNAM $PKG/usr/bin/$PRGNAM
-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
-
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
@@ -97,4 +120,4 @@ 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:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE