1 # Copyright 2016-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{10..12} pypy3 )
7 DISTUTILS_USE_PEP517=setuptools
9 if [[ ${PV} = *9999* ]]; then
10 EGIT_REPO_URI="https://github.com/mesonbuild/meson"
20 https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz
21 verify-sig? ( https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz.asc )
23 BDEPEND="verify-sig? ( sec-keys/openpgp-keys-jpakkane )"
24 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/jpakkane.gpg
26 if [[ ${PV} != *_rc* ]] ; then
27 KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
31 inherit bash-completion-r1 distutils-r1 toolchain-funcs
33 DESCRIPTION="Open source build system"
34 HOMEPAGE="https://mesonbuild.com/"
39 RESTRICT="!test? ( test )"
44 dev-libs/gobject-introspection
45 app-alternatives/ninja
47 sys-libs/zlib[static-libs(+)]
56 "${FILESDIR}"/${PN}-0.63-xtools-support.patch
59 python_prepare_all() {
60 local disable_unittests=(
61 # ASAN and sandbox both want control over LD_PRELOAD
62 # https://bugs.gentoo.org/673016
63 -e 's/test_generate_gir_with_address_sanitizer/_&/'
65 # ASAN is unsupported on some targets
66 # https://bugs.gentoo.org/692822
67 -e 's/test_pch_with_address_sanitizer/_&/'
69 # https://github.com/mesonbuild/meson/issues/7203
70 -e 's/test_templates/_&/'
72 # Broken due to python2 wrapper
73 -e 's/test_python_module/_&/'
76 sed -i "${disable_unittests[@]}" unittests/*.py || die
78 # Broken due to python2 script created by python_wrapper_setup
79 rm -r "test cases/frameworks/1 boost" || die
81 distutils-r1_python_prepare_all
86 if ${PKG_CONFIG} --exists Qt5Core && ! ${PKG_CONFIG} --exists Qt5Gui; then
87 ewarn "Found Qt5Core but not Qt5Gui; skipping tests"
95 # test_meson_installed
96 unset PYTHONDONTWRITEBYTECODE
98 # https://bugs.gentoo.org/687792
101 # test_cross_file_system_paths
104 # 'test cases/unit/73 summary' expects 80 columns
107 # If JAVA_HOME is not set, meson looks for javac in PATH.
108 # If javac is in /usr/bin, meson assumes /usr/include is a valid
109 # JDK include path. Setting JAVA_HOME works around this broken
110 # autodetection. If no JDK is installed, we should end up with an empty
111 # value in JAVA_HOME, and the tests should get skipped.
112 export JAVA_HOME=$(java-config -O 2>/dev/null)
114 # Call python3 instead of EPYTHON to satisfy test_meson_uninstalled.
116 ) || die "Testing failed with ${EPYTHON}"
119 python_install_all() {
120 distutils-r1_python_install_all
122 insinto /usr/share/vim/vimfiles
123 doins -r data/syntax-highlighting/vim/{ftdetect,indent,syntax}
125 insinto /usr/share/zsh/site-functions
126 doins data/shell-completions/zsh/_meson
128 dobashcomp data/shell-completions/bash/meson