summaryrefslogtreecommitdiffstats
path: root/games/ace/ace.SlackBuild
blob: cdf87fb06af5759933e8d993cbaaee404a8c78df (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 ace.

# Originally written by G. Schoenmakers.
# Updated and now maintained by B. Watson (urchlay@slackware.uk).

# Original had no license. Modified version licensed under the
# WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# 20231130 bkw: BUILD=2
# - take over maintenance.
# - add .desktop files.
# - add icon.
# - add doinst.sh for desktop/icon.
# - include AUTHORS ChangeLog NEWS README in doc dir.
# - include images used by the HTML docs.
# - tweak README and slack-desc slightly.

# 20220219 bkw: Modified by SlackBuilds.org:
# - fix build on Slackware 15.0.
# - binaries in /usr/games.
# - remove .la file.
# - install binaries with -ace suffix, to avoid conflicting with
#   canfield from Slackware's bsd-games and spider from xgames.

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

PRGNAM=ace
VERSION=${VERSION:-1.4}
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
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 {} +

# Patch for libpng and other fixes thanks to Arch Linux
patch -p1 < $CWD/ace14_fixes.patch

SLKCFLAGS+=" -fcommon"

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

make
make install-strip DESTDIR=$PKG

# Icon made from a chunk of as.gif. All the games use the same icon,
# which shouldn't matter much. Might confuse the user if he's playing
# 2 of these games at once, but who does that?
# Install as aceofpeng.png because ace.png is pretty generic, might
# conflict with something.
for px in 16 22 32 48 64; do
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  convert -resize $size $CWD/$PRGNAM.png $dir/aceofpeng.png
done

dir=$PKG/usr/share/pixmaps
mkdir -p $dir
ln -s ../icons/hicolor/48x48/apps/aceofpeng.png $dir/aceofpeng.png

# Generate the .desktop files.
dir=$PKG/usr/share/applications
mkdir -p $dir
for exe in $PKG/usr/games/*; do
  exe="$( basename $exe )"
  name="$( basename ${exe^} -ace )"
  cat > $dir/$exe.desktop <<EOF
[Desktop Entry]
Name=$name (Ace of Penguins)
Exec=/usr/games/$exe
Terminal=false
Type=Application
Icon=aceofpeng
Categories=Game;CardGame;
EOF
done

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

rm -f $PKG/usr/lib*/*.la

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