blob: c05893d27990f51de1099b0deb812a5bdc479623 (
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
|
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7..9} )
inherit desktop python-single-r1 toolchain-funcs xdg
# Tarball from py3 port branch:
# https://github.com/spirali/rmahjong/tree/py3
# At least "Furiten", "Red fives" rules aren't implemented.
PKG_sha="7a37ade640bc24eb2cc9f0ad6c7ce26773be2856"
DESCRIPTION="Riichi Mahjong, the Japanese variant of the Chinese game Mahjong for 4 players"
HOMEPAGE="https://github.com/spirali/rmahjong"
# PNG icon is taken from Kmahjongg project (GPL-2), renamed to avoid pkgs conflicts
SRC_URI="
https://github.com/spirali/${PN}/archive/${PKG_sha}.tar.gz -> ${P}.tar.gz
https://github.com/KDE/kmahjongg/raw/master/icons/48-apps-kmahjongg.png -> kmahjongg_${PN}.png"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
S="${WORKDIR}/${PN}-${PKG_sha}"
RDEPEND="
${PYTHON_DEPS}
dev-python/pygame[X,opengl]
$(python_gen_cond_dep '
dev-python/pygame[${PYTHON_MULTI_USEDEP}]
dev-python/pyopengl[${PYTHON_MULTI_USEDEP}]
')
"
src_prepare(){
default
# Disable logging as application log into directory where user access is denied
sed -i "/logging.basicConfig/d" "${S}/client/client.py" || die
sed -i "/logging.basicConfig/d" "${S}/server/server.py" || die
sed -i "/logging.info/d" "${S}/server/server.py" || die
echo $'#!/bin/sh\ncd '"$(python_get_sitedir)/${PN}"' && ./start.sh' > "${S}/rmahjong"
# pass compiler and CFLAGS to 'Bot' makefile
sed -i -e 's:gcc:'"$(tc-getCC)"':g' bot/makefile \
-e 's:CFLAGS=-Wall -O3 -march=native:CFLAGS='"${CFLAGS}"':'|| die
}
src_compile() {
# Build bots
cd "${S}/bot/" && emake
}
src_test() {
cd "${S}/server/" && python3 test.py -v
}
src_install() {
python_moduleinto ${PN}
python_domodule {client/,server/,start.sh}
fperms 755 $(python_get_sitedir)/${PN}/start.sh
fperms 755 $(python_get_sitedir)/${PN}/server/run_server.sh
python_moduleinto ${PN}/bot
python_domodule bot/bot
fperms 755 $(python_get_sitedir)/${PN}/bot/bot
python_optimize "${D}/$(python_get_sitedir)/${PN}/"{client,server}/*.py
dobin "rmahjong"
doicon -s 48 "${DISTDIR}/kmahjongg_${PN}.png"
make_desktop_entry "${PN}" "RMahjong" "kmahjongg_${PN}" "Game;BoardGame;" || die "Failed making desktop entry!"
}
|