slackbuilds_ponce/system/unhide/unhide.SlackBuild
B. Watson 74044db7b9
system/unhide: Updated for version 20220611, new maintainer.
Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2023-08-12 08:29:51 +07:00

119 lines
3.2 KiB
Bash

#!/bin/bash
# SlackBuild script for unhide.
# Original author: Rubén Llorente <email removed>
# Updated and maintained by B. Watson <urchlay@slackware.uk>
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20230804 bkw:
# - take over maintenance.
# - relicense as WTFPL with permission from Rubén (via mailing list).
# - update for v20220611.
# - add GUI (unhideGui.py), .desktop file, doinst.sh.
# - minor fixes for man pages.
# - symlink man pages, unhide => unhide-linux, to match the binary.
# - add NEWS to doc dir.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=unhide
SRCNAM=Unhide
VERSION=${VERSION:-20220611}
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"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
else
SLKCFLAGS="-O2"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$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 {} +
# Fix the GUI. Patch by SlackBuild maintainer.
patch -p1 < $CWD/fixgui.diff
# Fix typos and formatting errors in man pages, from Debian:
# https://packages.debian.org/sid/unhide
patch -p1 < $CWD/fix-man.diff
# No Makefile or anything, commands come from README.txt:
GCC="gcc $SLKCFLAGS -Wall --static"
$GCC -pthread unhide-linux*.c unhide-output.c -o unhide-linux
$GCC unhide_rb.c -o unhide_rb
$GCC unhide-tcp.c unhide-tcp-fast.c unhide-output.c -o unhide-tcp
SBIN=$PKG/usr/sbin
mkdir -p $SBIN
install -s -m 0755 unhide-tcp unhide-linux unhide_rb $SBIN
ln -s unhide-linux $SBIN/unhide
for i in "" es fr; do
dir=$PKG/usr/man/$i/man8
mkdir -p $dir
for j in unhide unhide-tcp; do
gzip -9 < man/$i/$j.8 > $dir/$j.8.gz
done
ln -s unhide.8.gz $dir/unhide-linux.8.gz
done
# 20230803 bkw: the GUI isn't well-documented, but seems to work, at
# least after a bit of patching.
mkdir -p $PKG/usr/bin
install -m0755 unhideGui.py $PKG/usr/bin
PYDIR=$PKG/usr/share/$PRGNAM
mkdir -p $PYDIR
cp -a ToolTip.py $PYDIR
# 20230804 bkw: wrote a .desktop file for the GUI. Couldn't think of
# an idea for an icon, so I just used the magnifying glass icon
# from WindowMaker.
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp COPYING LEEME.txt LISEZ-MOI.TXT README.txt NEWS TODO changelog $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
cat $CWD/README > $PKGDOC/README
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