aboutsummaryrefslogtreecommitdiff
path: root/games/bsd_games/bsd_games.build
blob: 30bccc74aeee25310911de1f57a513de1f954e58 (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
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=bsd_games
VERSION=2.17
BUILD=2

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: bsd_games (Classic BSD text games collection)
${NAME}:
${NAME}: Contains the following console classics : adventure arithmetic atc
${NAME}: backgammon banner battlestar bcd caesar canfield cfscores countmail
${NAME}: cribbage factor fish fortune gomoku hangman hunt mille monop morse
${NAME}: number phantasia pig pom ppt primes quiz rain random robots rot13
${NAME}: sail snake snscore teachgammon trek wargames worm worms wump
${NAME}:
${NAME}: Adds a call to 'fortune' to /etc/profile.d/ so that users will get a
${NAME}: fortune message when they log in.
${NAME}:
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh
config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

for file in \$(find var/lib/bsdgames -type f ); do
  config \${file}
  rm -f \${file}
done
EOF

# Sources

SRCNAME[0]=bsd-games
SRCVERS[0]=${VERSION}
SRCPACK[0]=ftp://ftp.ibiblio.org/pub/Linux/games/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz

build0()
{
sed -i "s|@PKGDIR@|${PKG}|g" config.params
cp fortune/datfiles/unamerican-o.real fortune/datfiles/unamerican-o.fake
cp fortune/datfiles/unamerican-o.real unamerican-o
./configure
make ${JOBS}
make install
doc AUTHORS BUGS THANKS
changelog NEWS
install.dir ${PKG}${SYS_DIR[etc]}/{profile.d,tmpfiles.d}
install.bin fortune.{sh,csh} ${PKG}${SYS_DIR[etc]}/profile.d
install.dat hunt.conf.tmpfiles ${PKG}${SYS_DIR[etc]}/tmpfiles.d/hunt.conf
install.dir ${PKG}${SYS_DIR[share]}/dict
install.dat hangman-words ${PKG}${SYS_DIR[share]}/dict/words
# Scores etc...
find ${PKG}${SYS_DIR[var]}/lib/bsdgames -type f -exec mv {} {}.new \;
chown -R root.games ${PKG}${SYS_DIR[var]}/lib/bsdgames
chmod 0664 ${PKG}${SYS_DIR[var]}/lib/bsdgames/*
chmod 0664 ${PKG}${SYS_DIR[var]}/lib/bsdgames/{hack,phantasia}/*
chmod 0775 ${PKG}${SYS_DIR[var]}/lib/bsdgames/{hack,phantasia}
#FIXME: this should not go here
#install.dir ${PKG}${SYS_DIR[share]}/application-data/bsdgames/data/hack/save
# Conflicting files
mv ${PKG}${SYS_DIR[bin]}/fish ${PKG}${SYS_DIR[bin]}/go-fish
mv ${PKG}${SYS_DIR[man]}/man6/fish.6 ${PKG}${SYS_DIR[man]}/man6/go-fish.6
mv ${PKG}${SYS_DIR[man]}/man6/worm.6 ${PKG}${SYS_DIR[man]}/man6/worm-game.6
# Extra fortunes
rm -f ${PKG}${SYS_DIR[share]}/application-data/bsdgames/fortune/limerick{,.dat}
install.dat extra-fortunes/* ${PKG}${SYS_DIR[share]}/application-data/bsdgames/fortune
(
cd ${PKG}${SYS_DIR[share]}/application-data/bsdgames/fortune
rm -f *.dat
for file in ./*; do
  ${PKG}${SYS_DIR[bin]}/strfile -r $(basename ${file} .dat)
done
for file in ./*-o; do
  ${PKG}${SYS_DIR[bin]}/strfile -r -x $(basename ${file} .dat)
done
)
# Clean-up
rm -rf \
 ${PKG}/tmp \
 ${PKG}${SYS_DIR[doc]}/trek.me
}