summaryrefslogtreecommitdiffstats
path: root/games/oblige-legacy4/oblige-legacy4.SlackBuild
blob: 80bf4403e7edb88b7d363f8a52cd315f7e8638a1 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash

# Slackware build script for oblige-legacy4

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# 20230107 bkw: BUILD=4, remove INSTALL.txt from doc dir.

# 20211020 bkw: BUILD=3
# - make the icon transparent
# - new-style icons (also transparent)
# - update man page, README, slack-desc slightly

# 20170621 bkw: fix build on -current.

# 20140916 bkw: bump BUILD to 2.
# - add man page
# - add mention of Hexen in README

# 20140827 bkw:
# - rename this build to oblige-legacy4 so we can update oblige to v6.
#   keep both around for now, as v6 lacks heretic/quake support.

# 20140213 bkw: bump BUILD to 2.
# Makefile.unixy updated so it installs data/doom[12]_boss (thanks to Black
# Rider for the bug report). Also get rid of +x permissions on the data files
# in /usr/share.

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

PRGNAM=oblige-legacy4
VERSION=${VERSION:-4.28b}
BUILD=${BUILD:-4}
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

OLDNAM="oblige"
SRCVER=${VERSION//./}
SRCNAM="Oblige" # grrrr!

rm -rf $PKG
mkdir -p $TMP $PKG/usr/bin $PKG/usr/share/$PRGNAM $OUTPUT
cd $TMP
rm -rf ${SRCNAM}-${VERSION}-source
unzip $CWD/$OLDNAM-$SRCVER-source.zip
cd ${SRCNAM}-${VERSION}-source
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 {} \+

# Makefile.unixy originally came from the oblige author, I've hacked
# it up to make it work with oblige 4.x and SBo's fltk13.
cp $CWD/Makefile.unixy Makefile

# Fix a missing include
sed -i '1i#include <unistd.h>' gui/lib_util.cc

# -current's gcc doesn't allow assigning a bool to a pointer without
# a cast:
sed -i '/button_line *= *false/s,false,0,' gui/ui_console.cc

# Legacy version shouldn't use same /usr/share and dotfile dir as
# current version.
sed -i "s,\.$OLDNAM,.$PRGNAM,g" doc/File_Layout.txt gui/main.cc
sed -i "s,share/$OLDNAM,share/$PRGNAM," gui/main.cc

make INSTALL_PREFIX=/usr OPTIMISE="$SLKCFLAGS"
make install INSTALL_PREFIX=$PKG/usr

mkdir -p $PKG/usr/share/pixmaps $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

# 128.png was created by extracting oblige.ico, then using the gimp
# to turn the white background into transparency. The rest were scaled
# down from that, with convert -resize.
for i in $CWD/icons/*.png; do
  px=$( basename $i | cut -d. -f1 )
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  cat $i > $dir/$PRGNAM.png
done

ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

# man page written for this build
mkdir -p $PKG/usr/man/man6
gzip -9c < $CWD/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
rm -f INSTALL.txt
cp *.txt doc/*.txt $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

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