aboutsummaryrefslogtreecommitdiff
path: root/games/ds-models/ds-models.SlackBuild
blob: c5da9ad9b4d961b8b6bdc9d42b04f460c32e2cea (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
140
141
142
143
144
145
#!/bin/bash

# Slackware build script for ds-models

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

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

# Note to self: find and package a decent model pack that works
# properly with current gzdoom versions. If such a thing exists.
# Initial searching and testing indicates maybe not...

# 20211103 bkw: BUILD=4
# - fix script being installed to nonexistant /usr/games.
# - remove gzdoom support, since neither gzdoom nor gzdoom-legacy
#   works with these models.

# 20160810 bkw:
# - bump BUILD because:
# - install scripts in /usr/games, not /usr/bin

# 20140324 bkw:
# Updated for version r15
# fixed typos in README
# fixed .def files for recent gzdoom

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

PRGNAM=ds-models
VERSION=${VERSION:-r15}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch

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}

# Which game(s) to support?
# As of r15, Zandronum is also supported, but as there's no SBo build for
# it, I won't bother.
SKULLTAG=yes
GZDOOM=no

if [ "$SKULLTAG" != "yes" -a "$GZDOOM" != "yes" ]; then
  echo "You've set both SKULLTAG=no and GZDOOM=no; nothing to package."
  exit 1
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG/usr/{share/games/doom,games,doc/$PRGNAM-$VERSION} $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$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 {} \+

# The only script provided upstream is for skulltag + gzdoom in one pk3, which
# will only work with skulltag. So we build our own individual skulltag and
# gzdoom packages. Script code based on Build-ST-Complete.sh

# gzdoom. Note that skulltag needs these too, so GZDOOM=no just means we
# don't install the ds-gzdoom wrapper script.
mkdir -p work/Models

for DEF_FILE in \
  $(find ./GZ-Models/Build -maxdepth 2 -type f -name "*.def")
do
  cp ${DEF_FILE} work
done

# get rid of upstream's CRLF endings and stray NBSP characters, which
# confuse recent gzdooms.
perl -i -pe 's,[\xa0\r],,g' work/*.def

for MODEL_DIR in \
  $(find $(pwd)/GZ-Models/Build -maxdepth 2 -mindepth 2 -type d)
do
  cp -R ${MODEL_DIR} work/Models/
done

cp -R GZ-Models/Build/Hires work
cd work
  zip -r $PKG/usr/share/games/doom/GZ-Models.pk3 ./*.def ./Hires ./Models
cd -
rm -rf work

if [ "$GZDOOM" = "yes" ]; then
  install -m0755 $CWD/ds-gzdoom $PKG/usr/games
fi

# ST-Models
if [ "$SKULLTAG" = "yes" ]; then
  mkdir -p work/Models

  for DEF_FILE in \
      $(find ST-Models/Build -maxdepth 2 -type f -name "*.def")
  do
      cp ${DEF_FILE} work
  done

  perl -i -pe 's,[\xa0\r],,g' work/*.def

  for MODEL_DIR in \
      $(find ST-Models/Build -maxdepth 2 -mindepth 2 -type d)
  do
      cp -R ${MODEL_DIR} work/Models/
  done

  cd work
    zip -r $PKG/usr/share/games/doom/ST-Models.pk3 ./*.def ./Models
  cd -

  rm -rf work
  install -m0755 $CWD/ds-skulltag $PKG/usr/games
fi

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a Readme.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# Modify the slack-desc to reflect reality:
if [ "$SKULLTAG" != "yes" ]; then
  GAME="gzdoom only"
elif [ "$GZDOOM" != "yes" ]; then
  GAME="skulltag only"
else
  GAME="skulltag and gzdoom"
fi

mkdir -p $PKG/install
sed "s/@GAME@/$GAME/" $CWD/slack-desc > $PKG/install/slack-desc

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