3 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
4 # Version 2, December 2004
6 # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
8 # Everyone is permitted to copy and distribute verbatim or modified
9 # copies of this license document, and changing it is allowed as long
10 # as the name is changed.
12 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
13 # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16 # 0. You just DO WHAT THE FUCK YOU WANT TO.
19 # 20221228 bkw: updated for v0.9.
21 # # 20211119 bkw: BUILD=2
23 # don't overwrite ncurses' st and st-256color terminfo entries.
24 # thanks to Eric Lindblad for pointing this out.
25 # install the rest of the docs (FAQ, LEGACY, TODO).
26 # include config.h in the doc dir.
27 # include patches.txt in the doc dir, if patches are used.
28 # add .desktop and icon.
31 # SlackBuild script for st
32 # ===========================
33 # By: r1w1s1 (https://fosstodon.org/@r1w1s1)
35 # Descr: st is a simple terminal implementation for X.
36 # URL: https://st.suckless.org/
38 # v0.9.2: 07/july/2024 by r1w1s1 - Update Version
40 # st-blinking_cursor-20230819-3a6d6d7.diff
41 # st-defaultfontsize-20210225-4ef0cbd.diff
42 # Update .desktop file to start st with tmux
45 cd "$(dirname "$0")" ||
exit 1
49 VERSION
=${VERSION:-0.9.2}
52 PKGTYPE
=${PKGTYPE:-tgz}
54 # Determine architecture
55 ARCH
=${ARCH:-$(uname -m)}
59 *) ARCH
=$
(uname
-m) ;;
62 # Output package name and exit if requested
63 if [ -n "${PRINT_PACKAGE_NAME}" ]; then
64 echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
69 PKG
=$TMP/package-
$PRGNAM
70 OUTPUT
=${OUTPUT:-/tmp}
74 i586
) SLKCFLAGS
="-O2 -march=i586 -mtune=i686" ; LIBDIRSUFFIX
="" ;;
75 i686
) SLKCFLAGS
="-O2 -march=i686 -mtune=i686" ; LIBDIRSUFFIX
="" ;;
76 x86_64
) SLKCFLAGS
="-O2 -fPIC" ; LIBDIRSUFFIX
="64" ;;
77 *) SLKCFLAGS
="-O2" ; LIBDIRSUFFIX
="" ;;
80 # Clean up previous build
82 mkdir
-p "$TMP" "$PKG" "$OUTPUT"
84 rm -rf "$PRGNAM-$VERSION"
85 tar xvf
"$CWD/$PRGNAM-$VERSION.tar.gz"
86 cd "$PRGNAM-$VERSION" ||
exit 1
88 find .
-type f
-exec chmod 644 {} \
;
89 find .
-type d
-exec chmod 755 {} \
;
90 find .
-type f
-perm /111 -exec chmod 755 {} \
;
92 # Apply custom config.h if exists
93 [ -e "$CWD/config.h" ] && cp -f "$CWD/config.h" config.h
95 # Apply patches if available
96 for patch in "$CWD"/patches
/*; do
97 [ -e "$patch" ] ||
break
101 # Compile and install
102 make CFLAGS
="$SLKCFLAGS"
103 make PREFIX
=/usr DESTDIR
="$PKG" install
105 # Strip binaries and compress man pages
106 strip
"$PKG"/usr
/bin
/$PRGNAM
107 gzip -9 "$PKG"/usr
/man
/man?
/*
109 # Exclude redundant terminfo entries from ncurses package
110 #pkgfile=$(ls /var/lib/pkgtools/packages/ncurses-* | grep '/ncurses-[^-]\+-[^-]\+-[^-]\+$' || echo /dev/null)
112 for file in /var
/lib
/pkgtools
/packages
/ncurses-
*; do
113 if [[ $file =~
/ncurses-
[^
-]+-[^
-]+-[^
-]+$
]]; then
119 for file in "$PKG"/usr
/share
/terminfo
/s
/*; do
120 name
=$
(basename "$file")
121 if grep -q "^usr/share/terminfo/s/$name$" "$pkgfile"; then
122 echo "=== excluding terminfo entry: $name"
127 # Create .desktop file and icons
128 mkdir
-p "$PKG"/usr
/share
/applications
129 cat "$CWD/$PRGNAM.desktop" > "$PKG"/usr
/share
/applications
/"$PRGNAM.desktop"
131 for px
in 16 32 48 64 128; do
133 dir
="$PKG/usr/share/icons/hicolor/$size/apps"
135 convert
-resize "$size" "$CWD/$PRGNAM.png" "$dir/$PRGNAM.png"
138 mkdir
-p "$PKG/usr/share/pixmaps"
139 ln -s ..
/icons
/hicolor
/48x48
/apps
/$PRGNAM.png
"$PKG/usr/share/pixmaps/$PRGNAM.png"
142 PKGDOC
="$PKG/usr/doc/$PRGNAM-$VERSION"
144 cp -a config.h FAQ LEGACY LICENSE README TODO
"$PKGDOC"
145 cat "$CWD/$PRGNAM.SlackBuild" > "$PKGDOC/$PRGNAM.SlackBuild"
147 # Slackware install scripts
148 mkdir
-p "$PKG/install"
149 cat "$CWD/slack-desc" > "$PKG/install/slack-desc"
150 cat "$CWD/doinst.sh" > "$PKG/install/doinst.sh"
154 /sbin
/makepkg
-l y
-c n
"$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"