SUMMARY="A High productivity build system"
DESCRIPTION="Meson® is a project to create the best possible next-generation \
build system."
HOMEPAGE="https://mesonbuild.com/"
COPYRIGHT="2013-2020 The Meson development team"
LICENSE="Apache v2"
REVISION="2"
SOURCE_URI="https://github.com/mesonbuild/meson/releases/download/$portVersion/meson-$portVersion.tar.gz"
CHECKSUM_SHA256="0233a7f8d959079318f6052b0939c27f68a5de86ba601f25c9ee6869fb5f5889"
PATCHES="meson-$portVersion.patchset"
PYTHON_VERSION="3.7"

ARCHITECTURES="any"

PROVIDES="
	meson = $portVersion
	cmd:meson = $portVersion
	cmd:mesonconf = $portVersion
	cmd:mesonintrospect = $portVersion
	cmd:mesontest = $portVersion
	cmd:wraptool = $portVersion
	"
REQUIRES="
	haiku
	setuptools_python3
	cmd:python$PYTHON_VERSION
	cmd:ninja >= 1.6
	"

BUILD_REQUIRES="
	haiku_devel
	setuptools_python3
	"
BUILD_PREREQUIRES="
	cmd:python$PYTHON_VERSION
	"

TEST_REQUIRES="
	cmd:clang
	cmd:g_ir_scanner
	cmd:gcc
	cmd:ninja >= 1.6
	cmd:pkg_config
	devel:libglib_2.0
	"

INSTALL()
{
	# GENERIC: all python_setuptools-based installs need this
	python=$portPackageLinksDir/cmd~python$PYTHON_VERSION/bin/python3
	pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c3)
	installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
	export PYTHONPATH=$installLocation:$PYTHONPATH
	mkdir -p $installLocation

	$python setup.py install \
		--root=/ --prefix=$prefix

	mkdir -p $docDir
	mv $prefix/share/man $manDir
	rm -rf $prefix/share
}

TEST()
{
	MESON_PRINT_TEST_OUTPUT=1 LC_CTYPE=en_US.UTF-8 ./run_tests.py
}
