aboutsummaryrefslogtreecommitdiff
path: root/system/unhide/unhide.SlackBuild
blob: 25e1372c6ff53859fe9edba1f84fc4a9cb0b1f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/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