5 |
5 |
|
6 |
6 |
inherit toolchain-funcs
|
7 |
7 |
|
8 |
|
DEB_PATCH_VER=28
|
9 |
|
DESCRIPTION="Collection of games from NetBSD"
|
|
8 |
DESCRIPTION="collection of games from NetBSD"
|
10 |
9 |
HOMEPAGE="https://www.polyomino.org.uk/computer/software/bsd-games/"
|
11 |
|
#SRC_URI="https://www.polyomino.org.uk/computer/software/bsd-games/${PN}-$(ver_cut 1-2).tar.gz"
|
12 |
|
SRC_URI="http://deb.debian.org/debian/pool/main/b/bsdgames/bsdgames_$(ver_cut 1-2).orig.tar.gz"
|
13 |
|
SRC_URI+=" mirror://debian/pool/main/b/bsdgames/bsdgames_$(ver_cut 1-2)-${DEB_PATCH_VER}.debian.tar.xz"
|
14 |
|
S="${WORKDIR}/${PN}-$(ver_cut 1-2)"
|
|
10 |
SRC_URI="https://github.com/msharov/bsd-games/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
|
|
11 |
SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-verbose-build.patch.gz"
|
15 |
12 |
|
16 |
13 |
LICENSE="BSD"
|
17 |
|
SLOT="0"
|
18 |
|
KEYWORDS="~alpha ~amd64 ~x86"
|
|
14 |
# Subslot indicates the fork / new version
|
|
15 |
# 3 doesn't include the same games as the classic variant, etc
|
|
16 |
SLOT="0/3"
|
|
17 |
KEYWORDS="~alpha ~amd64 ~hppa ~mips ~riscv ~x86"
|
|
18 |
|
|
19 |
# 'check' target doesn't exist, nor do any actual tests
|
|
20 |
# bug #779649
|
|
21 |
RESTRICT="test"
|
19 |
22 |
|
20 |
23 |
DEPEND="
|
21 |
24 |
sys-apps/miscfiles
|
22 |
|
sys-libs/ncurses:0=
|
23 |
|
!app-misc/banner
|
24 |
|
!games-misc/wtf
|
|
25 |
sys-libs/ncurses:=[unicode(+)]
|
25 |
26 |
!games-puzzle/hangman
|
|
27 |
!games-misc/wumpus
|
26 |
28 |
"
|
27 |
29 |
RDEPEND="
|
28 |
30 |
${DEPEND}
|
29 |
31 |
acct-group/gamestat
|
30 |
32 |
"
|
31 |
33 |
BDEPEND="
|
|
34 |
sys-apps/which
|
32 |
35 |
sys-devel/bison
|
33 |
36 |
sys-devel/flex
|
34 |
37 |
virtual/pkgconfig
|
35 |
38 |
"
|
36 |
39 |
|
|
40 |
PATCHES=(
|
|
41 |
"${WORKDIR}"/${PN}-3.1-verbose-build.patch
|
|
42 |
"${FILESDIR}"/${PN}-3.1-no-install-manpages-automatically.patch
|
|
43 |
)
|
|
44 |
|
37 |
45 |
# Set GAMES_TO_BUILD variable to whatever you want
|
38 |
|
GAMES_TO_BUILD=${GAMES_TO_BUILD:=adventure arithmetic atc
|
39 |
|
backgammon banner battlestar bcd boggle caesar canfield countmail cribbage
|
40 |
|
dab dm fish gomoku hack hangman hunt mille monop morse
|
41 |
|
number phantasia pig pom primes ppt quiz rain random robots sail snake
|
42 |
|
tetris trek wargames worm worms wtf}
|
|
46 |
GAMES_TO_BUILD=${GAMES_TO_BUILD:=adventure atc battlestar caesar cribbage
|
|
47 |
dab drop4 gofish gomoku hangman klondike robots sail snake spirhunt
|
|
48 |
worm wump}
|
43 |
49 |
|
44 |
50 |
src_prepare() {
|
45 |
|
local debian_patch_dir="${WORKDIR}"/debian/patches
|
46 |
|
for patch in $(<"${debian_patch_dir}"/series) ; do
|
47 |
|
eapply "${debian_patch_dir}"/${patch}
|
48 |
|
done
|
49 |
|
|
50 |
|
# Additional patches on top of Debian patchset
|
51 |
|
eapply "${FILESDIR}"/${PN}-2.17-64bitutmp.patch
|
52 |
|
eapply "${FILESDIR}"/${PN}-2.17-bg.patch
|
53 |
|
eapply "${FILESDIR}"/${PN}-2.17-gcc4.patch
|
54 |
|
eapply "${FILESDIR}"/${PN}-2.17-rename-getdate-clash.patch
|
55 |
|
|
56 |
51 |
default
|
57 |
52 |
|
58 |
|
# Use pkg-config to query Libs: from ncurses.pc (for eg. -ltinfo) wrt #459652
|
|
53 |
# Use completely our own CFLAGS/LDFLAGS, no stripping and so on
|
59 |
54 |
sed -i \
|
60 |
|
-e "/ncurses_lib/s:-lncurses:'$($(tc-getPKG_CONFIG) --libs-only-l ncurses)':" \
|
61 |
|
configure || die
|
|
55 |
-e 's/+= -std=c11 @pkgcflags@ ${CFLAGS}/= -std=c11 @pkgcflags@ ${CFLAGS}/' \
|
|
56 |
-e 's/+= @pkgldflags@ ${LDFLAGS}/= @pkgldflags@ ${LDFLAGS}/' \
|
|
57 |
-e s'/${INSTALL} -m 755 -s/${INSTALL} -m 755/' \
|
|
58 |
-e '/man[6]dir/d' \
|
|
59 |
Config.mk.in || die
|
|
60 |
|
|
61 |
# Yes, this stinks.
|
|
62 |
# Right now, the custom configure script calls pkg-config manually
|
|
63 |
# and seds it a bunch, and this is easier.
|
|
64 |
# Force looking for both ncurses and ncursesw
|
|
65 |
sed -i -e 's/pkgs="ncurses"/pkgs="ncursesw"/' configure || die
|
62 |
66 |
|
63 |
|
sed -i \
|
64 |
|
-e "s:/usr/games:/usr/bin:" \
|
65 |
|
wargames/wargames || die
|
66 |
|
|
67 |
|
sed -i \
|
68 |
|
-e '/^CC :=/d' \
|
69 |
|
-e '/^CXX :=/d' \
|
70 |
|
-e '/^CFLAGS/s/OPTIMIZE/CFLAGS/' \
|
71 |
|
-e '/^CXXFLAGS/s/OPTIMIZE/CXXFLAGS/' \
|
72 |
|
-e '/^LDFLAGS/s/LDFLAGS := /LDFLAGS := \$(LDFLAGS) /' \
|
73 |
|
Makeconfig.in || die
|
74 |
|
|
75 |
|
# Used by config.params
|
76 |
|
export GAMES_BINDIR=/usr/bin
|
77 |
|
export GAMES_DATADIR=/usr/share
|
78 |
|
export GAMES_STATEDIR=/var/games
|
79 |
67 |
cp "${FILESDIR}"/config.params-gentoo config.params || die
|
80 |
|
|
81 |
68 |
echo bsd_games_cfg_usrlibdir=\"$(get_libdir)\" >> ./config.params || die
|
82 |
69 |
echo bsd_games_cfg_build_dirs=\"${GAMES_TO_BUILD}\" >> ./config.params || die
|
83 |
70 |
echo bsd_games_cfg_docdir=\"/usr/share/doc/${PF}\" >> ./config.params || die
|
|
71 |
if use riscv; then
|
|
72 |
sed -i 's/${CC} ${ldflags} -o $@ $^/${CC} ${ldflags} -o $@ $^ -latomic/' ./*/Module.mk || die
|
|
73 |
fi
|
84 |
74 |
}
|
85 |
75 |
|
86 |
|
src_compile() {
|
87 |
|
tc-export CC CXX
|
|
76 |
src_configure() {
|
|
77 |
tc-export AR CC RANLIB
|
88 |
78 |
|
89 |
|
emake
|
|
79 |
econf
|
90 |
80 |
}
|
91 |
81 |
|
92 |
|
src_test() {
|
93 |
|
addwrite /dev/full
|
94 |
|
emake -j1 check
|
|
82 |
src_compile() {
|
|
83 |
emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
|
95 |
84 |
}
|
96 |
85 |
|
97 |
86 |
src_install() {
|
98 |
|
# TODO: ${PN} or no?
|
99 |
|
dodir /var/games /usr/share/man/man{1,6}
|
100 |
|
emake -j1 DESTDIR="${D}" install
|
101 |
|
|
102 |
|
dodoc AUTHORS BUGS ChangeLog ChangeLog.0 \
|
103 |
|
README PACKAGING SECURITY THANKS TODO YEAR2000
|
|
87 |
dodir /var/games
|
|
88 |
emake DESTDIR="${D}" install
|
104 |
89 |
|
105 |
90 |
_build_game() {
|
106 |
91 |
has ${1} ${GAMES_TO_BUILD}
|
... | ... | |
122 |
107 |
_build_game snake && fperms g+s /usr/bin/snake
|
123 |
108 |
_build_game tetris && fperms g+s /usr/bin/tetris-bsd
|
124 |
109 |
|
125 |
|
elog "Renaming monop to monop-bsd to avoid collision with dev-lang/mono"
|
126 |
|
mv "${ED}"/usr/bin/monop "${ED}"/usr/bin/monop-bsd || die
|
127 |
|
|
128 |
110 |
# state files
|
129 |
111 |
_build_game atc && _do_statefile atc_score
|
130 |
112 |
_build_game battlestar && _do_statefile battlestar.log
|
... | ... | |
132 |
114 |
_build_game cribbage && _do_statefile criblog
|
133 |
115 |
_build_game hack && keepdir /var/games/hack
|
134 |
116 |
_build_game robots && _do_statefile robots_roll
|
135 |
|
_build_game sail && _do_statefile sail/saillog
|
|
117 |
_build_game sail && _do_statefile saillog
|
136 |
118 |
_build_game snake && _do_statefile snake.log && _do_statefile snakerawscores
|
137 |
119 |
_build_game tetris && _do_statefile tetris-bsd.scores
|
138 |
120 |
|
139 |
121 |
# extra docs
|
140 |
|
_build_game atc && { docinto atc ; dodoc atc/BUGS; }
|
|
122 |
_build_game atc && docinto atc
|
141 |
123 |
_build_game boggle && { docinto boggle ; dodoc boggle/README; }
|
142 |
124 |
_build_game hack && { docinto hack ; dodoc hack/{OWNER,Original_READ_ME,READ_ME,help}; }
|
143 |
125 |
_build_game hunt && { docinto hunt ; dodoc hunt/README; }
|
144 |
126 |
_build_game phantasia && { docinto phantasia ; dodoc phantasia/{OWNER,README}; }
|
145 |
127 |
|
|
128 |
# Install the man pages manually to make life easier (circumventing compression)
|
|
129 |
local game
|
|
130 |
for game in ${GAMES_TO_BUILD[@]} ; do
|
|
131 |
if [[ -e ${game}/${game}.1 ]] ; then
|
|
132 |
doman ${game}/${game}.1
|
|
133 |
else
|
|
134 |
doman ${game}/${game}.6
|
|
135 |
fi
|
|
136 |
done
|
|
137 |
|
|
138 |
# Since factor is usually not installed, and primes.6 is a symlink to
|
|
139 |
# factor.6, make sure that primes.6 is ok ...
|
|
140 |
if _build_game primes && [[ ! $(_build_game factor) ]] ; then
|
|
141 |
rm -f "${ED}"/usr/share/man/man6/{factor,primes}.6 || die
|
|
142 |
newman factor/factor.6 primes.6
|
|
143 |
fi
|
|
144 |
|
146 |
145 |
# All of this needs to be owned by the gamestat group
|
147 |
146 |
fowners -R :gamestat /var/games/
|
148 |
147 |
# ... and so do the binaries
|
149 |
148 |
fowners -R :gamestat /usr/bin/
|
150 |
149 |
|
151 |
150 |
# State dirs
|
152 |
|
chmod -R ug+rw "${ED}"/var/games/ || die
|
|
151 |
fperms -R ug+rw /var/games/
|
153 |
152 |
}
|