dev-perl/Class-Inspector: amd64 stable
[gentoo.git] / dev-python / cgkit / cgkit-2.0.0-r1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python{2_7,3_4,3_5} )
7 DISTUTILS_IN_SOURCE_BUILD=1
8
9 inherit distutils-r1 scons-utils toolchain-funcs
10
11 MY_P="${P/_/}"
12
13 DESCRIPTION="Python library for creating 3D images"
14 HOMEPAGE="http://cgkit.sourceforge.net"
15 SRC_URI="
16         $(python_gen_cond_dep mirror://sourceforge/${PN}/${PN}/${P}/${P}-py2k.tar.gz 'python2*')
17         $(python_gen_cond_dep mirror://sourceforge/${PN}/${PN}/${P}/${P}-py3k.tar.gz 'python3*')"
18
19 LICENSE="LGPL-2.1 MPL-1.1 GPL-2"
20 SLOT="0"
21 KEYWORDS="amd64 ppc x86"
22 IUSE="3ds"
23
24 RDEPEND="
25         >=dev-libs/boost-1.48[python,${PYTHON_USEDEP}]
26         $(python_gen_cond_dep 'dev-python/pyprotocols[${PYTHON_USEDEP}]' 'python2*')
27         dev-python/pyopengl[${PYTHON_USEDEP}]
28         dev-python/pygame[${PYTHON_USEDEP}]
29         dev-python/pillow[${PYTHON_USEDEP}]
30         3ds? ( ~media-libs/lib3ds-1.3.0 )"
31 DEPEND="${RDEPEND}"
32
33 src_unpack() {
34         cgkit_unpack() {
35                 local tarball
36                 if python_is_python3; then
37                         tarball=${P}-py3k.tar.gz
38                 else
39                         tarball=${P}-py2k.tar.gz
40                 fi
41                 mkdir "${BUILD_DIR}" || die
42                 tar -C "${BUILD_DIR}" -x --strip-components 1 -f "${DISTDIR}/${tarball}" || die
43         }
44         python_foreach_impl cgkit_unpack
45         mkdir "${S}" || die
46 }
47
48 python_prepare() {
49         eapply \
50                 "${FILESDIR}"/${PN}-2.0.0-fix-build-system.patch \
51                 "${FILESDIR}"/${PN}-2.0.0-fix-c++14.patch
52         if python_is_python3; then
53                 eapply "${FILESDIR}"/${PN}-py3k-pillow.patch
54         else
55                 eapply "${FILESDIR}"/${PN}-py2k-pillow.patch
56         fi
57
58         cp config_template.cfg config.cfg || die
59         cat >> config.cfg <<- _EOF_ || die
60                 BOOST_LIB = 'boost_python-${EPYTHON#python}'
61                 LIBS += ['GL', 'GLU', 'glut']
62                 LIB3DS_AVAILABLE = $(usex 3ds True False)
63         _EOF_
64
65         # Remove invalid test
66         rm -f unittests/test_pointcloud.py || die
67 }
68
69 python_configure_all() {
70         tc-export AR CXX
71 }
72
73 python_compile() {
74         pushd supportlib >/dev/null || die
75         CXXFLAGS="${CXXFLAGS} -fPIC" escons
76         popd >/dev/null || die
77         distutils-r1_python_compile
78 }
79
80 python_test() {
81         pushd unittests >/dev/null || die
82         mkdir tmp || die
83         "${EPYTHON}" all.py || die "Testing failed with ${EPYTHON}"
84         popd >/dev/null || die
85 }