add info about oficial slackbuild
[slackbuilds.git] / tut / tut.SlackBuild
blobf14196e361cb0d025802ce1efd4865a500c6e508
1 #!/bin/bash
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.
18 # SlackBuild script for tut
19 # ===========================
20 # By: r1w1s1 (https://fosstodon.org/@r1w1s1)
21 # For: tut
22 # Descr: Tut is a Mastodon TUI (Terminal User Interface) client
23 # URL: https://github.com/RasmusLindroth/tut
24 # Changelog:
25 # v2.0.1: 10/august/2024 by r1w1s1 - Initial build.
27 cd $(dirname $0) ; CWD=$(pwd)
29 PRGNAM=tut
30 VERSION=${VERSION:-2.0.1} # Replace with the latest version
31 BUILD=${BUILD:-1}
32 TAG=${TAG:-_SBo}
33 PKGTYPE=${PKGTYPE:-tgz}
35 TMP=${TMP:-/tmp/SBo}
36 PKG=$TMP/package-$PRGNAM
37 OUTPUT=${OUTPUT:-/tmp}
39 if [ -z "$ARCH" ]; then
40 case "$( uname -m )" in
41 i?86) ARCH=i586 ;;
42 arm*) ARCH=arm ;;
43 *) ARCH=$( uname -m ) ;;
44 esac
47 if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
48 echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
49 exit 0
52 if [ "$ARCH" = "i586" ]; then
53 SLKCFLAGS="-O2 -march=i586 -mtune=i686"
54 LIBDIRSUFFIX=""
55 elif [ "$ARCH" = "i686" ]; then
56 SLKCFLAGS="-O2 -march=i686 -mtune=i686"
57 LIBDIRSUFFIX=""
58 elif [ "$ARCH" = "x86_64" ]; then
59 SLKCFLAGS="-O2 -fPIC"
60 LIBDIRSUFFIX="64"
61 else
62 SLKCFLAGS="-O2"
63 LIBDIRSUFFIX=""
66 set -e
68 rm -rf $PKG
69 mkdir -p $TMP $PKG $OUTPUT
70 cd $TMP
71 rm -rf $PRGNAM-$VERSION
72 tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
73 cd ${PRGNAM}-${VERSION}
75 # Compile and install
76 CGO_CFLAGS="$SLKCFLAGS" \
77 CGO_CXXFLAGS="$SLKCFLAGS" \
78 go build
79 install -Dm755 $PRGNAM $PKG/usr/bin/$PRGNAM
81 # Strip the binaries
82 find $PKG -type f -exec strip --strip-unneeded {} \;
84 # Copy the Slackware packaging templates
85 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
86 cp -a README.md LICENSE config.example.toml $PKG/usr/doc/$PRGNAM-$VERSION
87 cp -a config/toot.tmpl $PKG/usr/doc/$PRGNAM-$VERSION
88 cp -a config/user.tmpl $PKG/usr/doc/$PRGNAM-$VERSION
89 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
91 # Install themes
92 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/themes
93 cp config/themes/* $PKG/usr/doc/$PRGNAM-$VERSION/themes
95 # Install and compress man pages
96 for i in {1,5,7};
98 mkdir -p $PKG/usr/man/man$i
99 cp -r docs/man/tut.$i $PKG/usr/man/man$i/tut.$i
100 done
101 gzip -9 $PKG/usr/man/man[0-9]/$PRGNAM.[0-9]
103 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
104 | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
106 # Create the package description
107 mkdir -p $PKG/install
108 cp $CWD/slack-desc $PKG/install/slack-desc
110 # Build the package
111 cd $PKG
112 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE