system/st: Fix ncurses conflict; many enhancements.

Signed-off-by: B. Watson <yalhcru@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2021-11-29 22:17:31 -05:00 committed by Willy Sudiarto Raharjo
parent 2fe35f429d
commit 29b32f93ca
No known key found for this signature in database
GPG key ID: 3F617144D7238786
8 changed files with 126 additions and 54 deletions

View file

@ -1,5 +1,26 @@
st is a simple terminal implementation for X.
st (simple terminal)
NOTE:
This package overwrite some files from ncurses package.
If you remove this package, please reinstall ncurses back.
st is a simple terminal emulator for X which sucks less.
Most st configuration done by editing config.h, which gets baked into
the st executable. To make this easier, the SlackBuild will look for
"config.h" in its directory, and copy it into the source directory if
found. To get the default config.h from the source, do something like
this:
tar xfO st-0.8.4.tar.gz --wildcards '*/config.def.h' > config.h
...then edit it to your heart's content and copy it into the
SlackBuild directory. When the package is built, your config.h will be
used, and also included in /usr/doc/st-$VERSION for reference.
Also, a lot of extra functionality for st is provided as patches, from
"https://st.suckless.org/patches/". To use these, download them and
place them in the patches/ directory in the SlackBuild's dir. Note
that not all provided patches will apply, since some are for old
versions of st and some are for post-release git. If you use patches,
the file /usr/doc/st-$VERSION/patches.txt will contain a list of them,
for reference.
Note that this SlackBuild already includes a .desktop file and icon
for st, so you don't need the st-desktopentry patch.

9
system/st/doinst.sh Normal file
View file

@ -0,0 +1,9 @@
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
fi
fi

2
system/st/patches/README Normal file
View file

@ -0,0 +1,2 @@
Place any st patches you want to apply in this directory before
running the SlackBuild.

View file

@ -6,11 +6,11 @@
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
st: st (a simple terminal implementation for X)
st: st (simple terminal)
st:
st: st is a simple terminal emulator for X which sucks less.
st:
st:
st: st is a simple virtual terminal emulator for X which sucks less.
st:
st: Homepage: https://st.suckless.org
st:
st:
st:

View file

@ -2,33 +2,25 @@
# Slackware build script for st
# Copyright 2011-2020, Nikolay Korotkiy <sikmir@gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS 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 AUTHOR 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.
# Originally written by Nikolay Korotkiy <email removed>
# Now maintained by B. Watson <yalhcru@gmail.com>
# Modified by the SlackBuilds.org project
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20211119 bkw: BUILD=2
# - new maintainer.
# - don't overwrite ncurses' st and st-256color terminfo entries.
# thanks to Eric Lindblad for pointing this out.
# - install the rest of the docs (FAQ, LEGACY, TODO).
# - include config.h in the doc dir.
# - include patches.txt in the doc dir, if patches are used.
# - add .desktop and icon.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=st
VERSION=${VERSION:-0.8.4}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -40,9 +32,6 @@ if [ -z "$ARCH" ]; then
esac
fi
# 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
@ -75,22 +64,22 @@ rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# Now apply any other patches that users might have added
[ -e "$CWD/config.h" ] && cp -f $CWD/config.h config.h
# Now apply any other patches the user might have added. Have to
# do this *after* applying custom config.h, so any changes to
# config.h here won't get overwritten.
for i in $(ls $CWD/patches 2>/dev/null); do
echo "Applying patch $i"
[ "$i" = "README" ] && continue
echo "=== applying patch $i"
patch -p1 < $CWD/patches/$i
PATCHES+=" $i"
done
# Remove "tic" line from Makefile - we cannot do this here!
#sed -i "/^\t@tic/d" Makefile
# 20200123 bkw: Actually, yes we can:
# 20200123 bkw: 'tic' stuff in Makefile doesn't respect DESTDIR.
sed -i "s|\\<tic\\>|& -o $PKG/usr/share/terminfo|" Makefile
# Above sed command got broken by upstream (they removed the @)
@ -99,26 +88,68 @@ sed -i "s|\\<tic\\>|& -o $PKG/usr/share/terminfo|" Makefile
# when the package is removed. tic won't create the dir, so:
mkdir -p $PKG/usr/share/terminfo
[ -f "$CWD/config.h" ] && cp -f $CWD/config.h config.h
CFLAGS="$SLKCFLAGS" make && \
make install \
PREFIX=/usr \
MANPREFIX=/usr/man \
DESTDIR=$PKG
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
strip $PKG/usr/bin/$PRGNAM
gzip -9 $PKG/usr/man/man?/*
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
# 20211119 bkw: some of st's terminfo defs have been included in
# Slackware's ncurses package. After some discussion with Thomas
# Dickey (the ncurses maintainer) I've decided the ncurses versions
# of these are better. Instead of hardcoding a list here, we'll
# actually use the ncurses package's file list to decide what to
# exclude.
pkgfile="$(
ls /var/lib/pkgtools/packages/ncurses-* \
| grep '/ncurses-[^-]\+-[^-]\+-[^-]\+$' \
)"
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a LICENSE README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
if [ -z "$pkgfile" ]; then
echo "!!! can't find ncurses package, including all st terminfo entries"
pkgfile=/dev/null
fi
for file in $PKG/usr/share/terminfo/s/*; do
name="$( basename $file )"
if grep -q '^usr/share/terminfo/s/'$name'$' $pkgfile
then
echo "=== excluding terminfo entry: $name"
rm $file
fi
done
# .desktop file adapted from xterm.desktop
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
# Icons converted from https://en.wikipedia.org/wiki/File:Suckless_logo.svg
for px in 16 32 48 64 128; do
size=${px}x${px}
dir=$PKG/usr/share/icons/hicolor/$size/apps
mkdir -p $dir
convert -resize $size $CWD/$PRGNAM.png $dir/$PRGNAM.png
done
mkdir -p $PKG/usr/share/pixmaps
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a config.h FAQ LEGACY LICENSE README TODO $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
if [ -n "$PATCHES" ]; then
echo "This package was built with the following patch(es):" > $PKGDOC/patches.txt
echo "$PATCHES" | sed 's, ,\n,g' >> $PKGDOC/patches.txt
fi
mkdir -p $PKG/install
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

9
system/st/st.desktop Normal file
View file

@ -0,0 +1,9 @@
[Desktop Entry]
Name=st
Comment=Simple terminal emulator which sucks less
Exec=st
Terminal=false
Type=Application
Icon=st
Categories=System;TerminalEmulator;
Keywords=shell;prompt;command;commandline;cmd;

View file

@ -6,5 +6,5 @@ MD5SUM="e00b074c0e5d55513745c99f027b7a34"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Nikolay Korotkiy"
EMAIL="sikmir@gmail.com"
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

BIN
system/st/st.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B