summaryrefslogtreecommitdiff
path: root/games/worldofpadman/worldofpadman.SlackBuild
blob: 42f45c58cb591bcf9dab0263e8cb252573a41ca3 (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
137
138
139
#!/bin/bash

# Slackware build script for worldofpadman

# Copyright 2013 - Fernando Giannasi - São Paulo - Brasil
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# 20220427 bkw: Modified by SlackBuilds.org, BUILD=2:
# - don't install both 32-bit and 64-bit binaries (rm the ones
#   not needed for the current ARCH).
# - don't install windows .ico or mac .icns icons.
# - new-style icons (multiple sizes, plus scalable).
# - wrapper executables in /usr/games, so people can launch them
#   from the command line without knowing the full path in /opt.
# - fix .desktop file (this isn't a Qt nor KDE app).

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

PRGNAM=worldofpadman
VERSION=${VERSION:-1.6}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
SRCVER=${SRCVER:-1.5}
PATCHVER=$VERSION

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i386 ;;
    x86_64) ARCH=x86_64 ;;
       *) echo "Architecture $(uname -m) not suported" && exit 1 ;;
  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}

# No flags/configure needed as it is just a binary repackaging.

set -e 

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
mkdir -p $PKG/opt/$PRGNAM
cd $PKG/opt/$PRGNAM
unzip $CWD/*$SRCVER-unified.zip

# Patch the new version if available
if [ -f $CWD/*$PATCHVER-patch-unified.zip ]; then
  unzip -o $CWD/*$PATCHVER-patch-unified.zip
fi

cd $PKG
chown -R root:root .

# 20220428 bkw: fix permissions, remove what we don't need:
find . -type d -exec chmod 0755 {} \+
find . -type f -exec chmod 0644 {} \+
cd $PKG/opt/$PRGNAM
if [ "$ARCH" = "x86_64" ]; then
  rm -f *i386*
else
  rm -f *x86_64*
fi
rm -rf *.exe *.dll wop.app # windows and mac stuff, don't need
chmod +x *.so wop.* wopded.*

# 20220428 bkw: XTRAS is mostly documentation, plus icons.
# interestingly enough, the documentation includes the source.
cd XTRAS

for px in 16 32 48 64 128; do
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  convert -background none -geometry $size icon.svg $dir/$PRGNAM.png
done
mkdir -p $PKG/usr/share/icons/hicolor/scalable/apps
mv icon.svg $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg

# 20220428 bkw: don't need windows and mac icons.
rm -f *.ico *.icns

# 20220428 bkw: what's left is just docs, move it to correct Slackware dir.
cd ..
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
mv XTRAS/* $PKGDOC
rm -rf XTRAS
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

# Install a .desktop launcher:
mkdir -p $PKG/usr/share/applications
cat $CWD/worldofpadman.desktop > $PKG/usr/share/applications/worldofpadman.desktop

# 20220428 bkw: wrapper scripts. this allows CLI users to run the game
# or server by typing "wop" or "wopded", and keeps us from having to
# change the .desktop file for different ARCHes.
mkdir -p $PKG/usr/games
for exe in wop wopded; do
  sed -e "s,@ARCH@,$ARCH,g" -e "s,@EXE@,$exe,g" \
    < $CWD/wrapper.sh \
    > $PKG/usr/games/$exe
  chmod 0755 $PKG/usr/games/$exe
done

# 20220428 bkw: for compatibility with previous version of this script:
ln -s wop $PKG/usr/games/padman

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

# Pack it all
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE