Merge github#785: net-libs/nodejs: removal
[gentoo.git] / media-gfx / graphite2 / graphite2-1.3.5.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8
9 GENTOO_DEPEND_ON_PERL="no"
10 inherit eutils perl-module python-any-r1 cmake-multilib
11
12 DESCRIPTION="Library providing rendering capabilities for complex non-Roman writing systems"
13 HOMEPAGE="http://graphite.sil.org/"
14 SRC_URI="mirror://sourceforge/silgraphite/${PN}/${P}.tgz"
15
16 LICENSE="LGPL-2.1"
17 SLOT="0"
18 KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~mips ~ppc ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris"
19 IUSE="perl test"
20
21 RDEPEND="
22         perl? ( dev-lang/perl:= )
23 "
24 DEPEND="${RDEPEND}
25         perl? (
26                 dev-perl/Module-Build
27                 dev-perl/Locale-Maketext-Lexicon
28                 )
29         test? (
30                 dev-libs/glib:2
31                 media-libs/fontconfig
32                 media-libs/silgraphite
33                 ${PYTHON_DEPS}
34                 perl? ( virtual/perl-Test-Simple )
35         )
36 "
37
38 PATCHES=(
39         "${FILESDIR}/${PN}-1.3.5-includes-libs-perl.patch"
40 )
41
42 # tests fail, especially on multilib systems, fixed in 1.3.5-r1 but needs additional dependencies
43 RESTRICT=test
44
45 pkg_setup() {
46         use perl && perl_set_version
47         use test && python-any-r1_pkg_setup
48 }
49
50 src_prepare() {
51         cmake-utils_src_prepare
52
53         # make tests optional
54         if ! use test; then
55                 sed -i \
56                         -e '/tests/d' \
57                         CMakeLists.txt || die
58         fi
59 }
60
61 multilib_src_configure() {
62         local mycmakeargs=(
63                 "-DVM_MACHINE_TYPE=direct"
64                 # http://sourceforge.net/p/silgraphite/bugs/49/
65                 $([[ ${CHOST} == powerpc*-apple* ]] && \
66                         echo "-DGRAPHITE2_NSEGCACHE:BOOL=ON")
67         )
68
69         cmake-utils_src_configure
70
71         # fix perl linking
72         if multilib_is_native_abi && use perl; then
73                 _cmake_check_build_dir init
74                 sed -i \
75                         -e "s:@BUILD_DIR@:\"${BUILD_DIR}/src\":" \
76                         "${S}"/contrib/perl/Build.PL || die
77         fi
78 }
79
80 src_compile() {
81         cmake-multilib_src_compile
82         if use perl; then
83                 cd contrib/perl || die
84                 perl-module_src_configure
85                 perl-module_src_compile
86         fi
87 }
88
89 src_test() {
90         cmake-multilib_src_test
91         if use perl; then
92                 cd contrib/perl || die
93                 perl-module_src_test
94         fi
95 }
96
97 src_install() {
98         cmake-multilib_src_install
99         if use perl; then
100                 cd contrib/perl || die
101                 perl-module_src_install
102                 perl_delete_localpod
103         fi
104
105         prune_libtool_files --all
106 }