summaryrefslogtreecommitdiffstats
path: root/games/KoboDeluxe/KoboDeluxe.SlackBuild
blob: 0e0dfc54259a03beca940069369e48facfa02a53 (about) (plain) (blame)
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
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash

# Slackware build script for Kobo Deluxe

# Written by 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, BUILD=2:
# - take over maintenance.
# - relicense as WTFPL.
# - install binary stripped.
# - add patch from Debian to allow the game to be unpaused. apparently
#   this has been broken at least since Slackware 15.0 released,
#   maybe even before that.
# - include upstream's icons in the package (and remove ours).
# - update .desktop file.
# - mention Bosconian in the README, since this game is basically a
#   remake of it with a few enhancements.
# - fix typos and grammar in man page, and extend the CONTROLS section.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=KoboDeluxe
VERSION=${VERSION:-0.5.1}
BUILD=${BUILD:-2}
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"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT $PKG/install
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
tar xvf icons.tar.gz
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 {} +

# These patches are incuded to fix compilation bugs.
# I want to thank the Arch community for making them availible.
patch -p0 < $CWD/kobodeluxe-0.5.1-glibc2.10.patch
patch -p0 < $CWD/kobodeluxe-gcc-4.3.patch

# 20230804 bkw: patch from Debian. Without this, the game starts
# up in Paused mode, and cannot be unpaused.
patch -p1 < $CWD/ignore-appinputfocus.patch

# 20230804 bkw: another Debian patch, prevents the game from looking
# in the current directory for data.
patch -p1 < $CWD/02_paths.patch

# 20230804 bkw: fix typos/grammar and document the pause and screenshot
# keystrokes.
patch -p1 < $CWD/manpagefix.diff

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --bindir=/usr/games \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --sharedstatedir=/var/games \
  --mandir=/usr/man \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --build=$ARCH-slackware-linux

make
make install-strip DESTDIR=$PKG
gzip -9 $PKG/usr/man/man*/*

# 20230804 bkw: upstream included prescaled icons in icons.tar.gz.
for i in icons/KDE/icons/*; do
  size="$( basename $i )"
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  cp -a $i/kobodl.png $dir
done

mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
ln -s ../icons/hicolor/48x48/apps/kobodl.png $PKG/usr/share/pixmaps

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a COPYING README* ChangeLog TODO $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

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