cb6cdf9910cd5564be2d7f9296eef111ed39edf8
[gentoo.git] / dev-util / meson / meson-0.51.2.ebuild
1 # Copyright 2016-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python3_{6,7} )
6
7 if [[ ${PV} = *9999* ]]; then
8         EGIT_REPO_URI="https://github.com/mesonbuild/meson"
9         inherit git-r3
10 else
11         SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
12         KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
13 fi
14
15 inherit distutils-r1 toolchain-funcs
16
17 DESCRIPTION="Open source build system"
18 HOMEPAGE="http://mesonbuild.com/"
19
20 LICENSE="Apache-2.0"
21 SLOT="0"
22 IUSE="test"
23 RESTRICT="!test? ( test )"
24
25 RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
26 DEPEND="${RDEPEND}
27         test? (
28                 dev-libs/glib:2
29                 dev-libs/gobject-introspection
30                 dev-util/ninja
31                 dev-vcs/git
32                 sys-libs/zlib[static-libs(+)]
33                 virtual/pkgconfig
34         )
35 "
36
37 python_prepare_all() {
38         # ASAN and sandbox both want control over LD_PRELOAD
39         # https://bugs.gentoo.org/673016
40         sed -i -e 's/test_generate_gir_with_address_sanitizer/_&/' run_unittests.py || die
41
42         # ASAN is unsupported on some targets
43         # https://bugs.gentoo.org/692822
44         sed -i -e 's/test_pch_with_address_sanitizer/_&/' run_unittests.py || die
45
46         distutils-r1_python_prepare_all
47 }
48
49 src_test() {
50         tc-export PKG_CONFIG
51         if ${PKG_CONFIG} --exists Qt5Core && ! ${PKG_CONFIG} --exists Qt5Gui; then
52                 ewarn "Found Qt5Core but not Qt5Gui; skipping tests"
53         else
54                 # https://bugs.gentoo.org/687792
55                 unset PKG_CONFIG
56                 distutils-r1_src_test
57         fi
58 }
59
60 python_test() {
61         (
62                 # test_meson_installed
63                 unset PYTHONDONTWRITEBYTECODE
64
65                 # test_cross_file_system_paths
66                 unset XDG_DATA_HOME
67
68                 ${EPYTHON} -u run_tests.py
69         ) || die "Testing failed with ${EPYTHON}"
70 }
71
72 python_install_all() {
73         distutils-r1_python_install_all
74
75         insinto /usr/share/vim/vimfiles
76         doins -r data/syntax-highlighting/vim/{ftdetect,indent,syntax}
77         insinto /usr/share/zsh/site-functions
78         doins data/shell-completions/zsh/_meson
79 }