Partially revert "games-*/*: Remove stable keywords"
[gentoo.git] / games-engines / renpy / renpy-6.17.7.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 PYTHON_COMPAT=( python2_7 )
6 DISTUTILS_IN_SOURCE_BUILD=1
7 inherit eutils toolchain-funcs python-r1 versionator gnome2-utils games distutils-r1
8
9 DESCRIPTION="Visual novel engine written in python"
10 HOMEPAGE="http://www.renpy.org"
11 SRC_URI="http://www.renpy.org/dl/${PV}/${P}-source.tar.bz2"
12
13 LICENSE="MIT"
14 SLOT="$(get_version_component_range 1-2)"
15 MYSLOT=$(delete_all_version_separators ${SLOT})
16 KEYWORDS="amd64 x86"
17 IUSE="development doc examples"
18 REQUIRED_USE="examples? ( development )"
19
20 RDEPEND="
21         >=app-eselect/eselect-renpy-0.4
22         dev-libs/fribidi
23         dev-python/pygame[X,${PYTHON_USEDEP}]
24         >=dev-lang/python-exec-0.3[${PYTHON_USEDEP}]
25         media-libs/glew:0
26         media-libs/libpng:0
27         media-libs/libsdl[X,video]
28         media-libs/freetype:2
29         sys-libs/zlib
30         virtual/ffmpeg"
31 DEPEND="${RDEPEND}
32         dev-python/cython[${PYTHON_USEDEP}]
33         virtual/pkgconfig"
34
35 S=${WORKDIR}/${P}-source
36
37 pkg_setup() {
38         games_pkg_setup
39         export CFLAGS="${CFLAGS} $($(tc-getPKG_CONFIG) --cflags fribidi)"
40 }
41
42 python_prepare_all() {
43         # wooosh! this should fix multiple abi
44         epatch "${FILESDIR}"/${P}-multiple-abi.patch
45
46         einfo "Deleting precompiled python files"
47         find . -name '*.py[co]' -print -delete || die
48
49         sed -i \
50                 -e "s/@SLOT@/${MYSLOT}/" \
51                 renpy.py renpy/common.py || die "setting slot failed!"
52
53         distutils-r1_python_prepare_all
54 }
55
56 python_compile() {
57         cd "${S}"/module || die
58         distutils-r1_python_compile
59 }
60
61 python_install() {
62         cd "${S}"/module || die
63         distutils-r1_python_install --install-lib="$(python_get_sitedir)/renpy${MYSLOT}"
64
65         cd "${S}" || die
66         python_scriptinto "${GAMES_BINDIR}"
67         python_newscript renpy.py ${PN}-${SLOT}
68
69         python_moduleinto renpy${MYSLOT}
70         python_domodule renpy
71         if use development ; then
72                 python_domodule launcher templates
73         fi
74         if use examples ; then
75                 python_domodule the_question tutorial
76         fi
77 }
78
79 python_install_all() {
80         if use development; then
81                 newicon -s 32 launcher/game/images/logo32.png ${P}.png
82                 make_desktop_entry ${PN}-${SLOT} "Ren'Py ${PV}" ${P}
83         fi
84
85         if use doc; then
86                 dohtml -r doc
87         fi
88
89         prepgamesdirs
90 }
91
92 pkg_preinst() {
93         games_pkg_preinst
94         use development && gnome2_icon_savelist
95 }
96
97 pkg_postinst() {
98         games_pkg_postinst
99         use development && gnome2_icon_cache_update
100
101         einfo "running: eselect renpy update --if-unset"
102         eselect renpy update --if-unset
103 }
104
105 pkg_postrm() {
106         use development && gnome2_icon_cache_update
107
108         einfo "running: eselect renpy update --if-unset"
109         eselect renpy update --if-unset
110 }