Partially revert "games-*/*: Remove stable keywords"
[gentoo.git] / games-engines / renpy / renpy-6.99.12.4-r3.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python2_7 )
6 DISTUTILS_IN_SOURCE_BUILD=1
7 inherit eutils gnome2-utils toolchain-funcs versionator 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.7
22         dev-libs/fribidi
23         ~dev-python/pygame_sdl2-${PV}[${PYTHON_USEDEP}]
24         >=dev-lang/python-exec-0.3[${PYTHON_USEDEP}]
25         media-libs/glew:0
26         media-libs/libpng:0
27         media-libs/libsdl2[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 PATCHES=(
38         "${FILESDIR}"/${P}-multiple-abi.patch
39         "${FILESDIR}"/${P}-compat-window.patch #601200
40         "${FILESDIR}"/${P}-compat-style.patch
41         "${FILESDIR}"/${P}-compat-infinite-loop.patch
42 )
43
44 python_prepare_all() {
45         export CFLAGS="${CFLAGS} $($(tc-getPKG_CONFIG) --cflags fribidi)"
46         distutils-r1_python_prepare_all
47
48         einfo "Deleting precompiled python files"
49         find . -name '*.py[co]' -print -delete || die
50
51         sed -i \
52                 -e "s/@SLOT@/${MYSLOT}/" \
53                 renpy.py renpy/common.py || die "setting slot failed!"
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_newscript renpy.py ${PN}-${SLOT}
67
68         python_moduleinto renpy${MYSLOT}
69         python_domodule renpy
70         if use development ; then
71                 python_domodule launcher templates
72         fi
73         if use examples ; then
74                 python_domodule the_question tutorial
75         fi
76 }
77
78 python_install_all() {
79         distutils-r1_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                 insinto "/usr/share/doc/${PF}/html"
87                 doins -r doc/*
88         fi
89         newman "${FILESDIR}/${PN}.1" "${P}.1"
90 }
91
92 pkg_preinst() {
93         use development && gnome2_icon_savelist
94 }
95
96 pkg_postinst() {
97         use development && gnome2_icon_cache_update
98
99         einfo "running: eselect renpy update --if-unset"
100         eselect renpy update --if-unset
101 }
102
103 pkg_postrm() {
104         use development && gnome2_icon_cache_update
105
106         einfo "running: eselect renpy update --if-unset"
107         eselect renpy update --if-unset
108 }