media-gfx/graphite2: amd64 stable wrt bug #716822
[gentoo.git] / media-gfx / graphite2 / graphite2-1.3.14.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7,8} )
7
8 CMAKE_ECLASS=cmake
9 GENTOO_DEPEND_ON_PERL="no"
10 inherit perl-module python-any-r1 cmake-multilib
11
12 DESCRIPTION="Library providing rendering capabilities for complex non-Roman writing systems"
13 HOMEPAGE="https://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_home"
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 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
19 IUSE="perl test"
20 RESTRICT="!test? ( test )"
21
22 RDEPEND="
23         perl? ( dev-lang/perl:= )
24 "
25 DEPEND="${RDEPEND}
26         perl? (
27                 dev-perl/Locale-Maketext-Lexicon
28                 dev-perl/Module-Build
29         )
30         test? (
31                 ${PYTHON_DEPS}
32                 dev-libs/glib:2
33                 $(python_gen_any_dep 'dev-python/fonttools[${PYTHON_USEDEP}]')
34                 media-libs/fontconfig
35                 perl? ( virtual/perl-Test-Simple )
36         )
37 "
38
39 PATCHES=( "${FILESDIR}/${PN}-1.3.5-includes-libs-perl.patch" )
40
41 pkg_setup() {
42         use perl && perl_set_version
43         use test && python-any-r1_pkg_setup
44 }
45
46 python_check_deps() {
47         has_version "dev-python/fonttools[${PYTHON_USEDEP}]"
48 }
49
50 src_prepare() {
51         cmake_src_prepare
52
53         # make tests optional
54         if ! use test; then
55                 sed -e '/tests/d' -i CMakeLists.txt || die
56         fi
57 }
58
59 multilib_src_configure() {
60         local mycmakeargs=(
61                 # Renamed VM_MACHINE_TYPE to GRAPHITE2_VM_TYPE
62                 -DGRAPHITE2_VM_TYPE=direct
63         )
64         # https://sourceforge.net/p/silgraphite/bugs/49/
65         [[ ${CHOST} == powerpc*-apple* ]] && mycmakeargs+=(
66                 -DGRAPHITE2_NSEGCACHE:BOOL=ON
67         )
68
69         cmake_src_configure
70
71         # fix perl linking
72         if multilib_is_native_abi && use perl; then
73                 # we rely on the fact that cmake_src_configure sets BUILD_DIR
74                 sed -e "s:@BUILD_DIR@:\"${BUILD_DIR}/src\":" \
75                         -i "${S}"/contrib/perl/Build.PL || die
76         fi
77 }
78
79 src_compile() {
80         cmake-multilib_src_compile
81         if use perl; then
82                 cd contrib/perl || die
83                 perl-module_src_configure
84                 perl-module_src_compile
85         fi
86 }
87
88 multilib_src_test() {
89         if multilib_is_native_abi; then
90                 cmake_src_test
91         else
92                 einfo "Cannot test since python is not multilib."
93         fi
94 }
95
96 src_test() {
97         cmake-multilib_src_test
98         if use perl; then
99                 # Perl tests fail due to missing POD coverage...
100                 perl_rm_files "contrib/perl/t/pod.t" "contrib/perl/t/pod-coverage.t"
101                 cd contrib/perl || die
102                 perl-module_src_test
103         fi
104 }
105
106 src_install() {
107         cmake-multilib_src_install
108         if use perl; then
109                 cd contrib/perl || die
110                 perl-module_src_install
111                 perl_delete_localpod
112         fi
113
114         find "${ED}" \( -name '*.a' -o -name '*.la' \) -delete || die
115 }