PORTNAME=	meson
PORTVERSION=	1.7.2
PORTREVISION=	1
PORTEPOCH=	1
CATEGORIES=	devel python
MASTER_SITES=	https://github.com/mesonbuild/${PORTNAME}/releases/download/${PORTVERSION}/

MAINTAINER=	ports@MidnightBSD.org
COMMENT=	High performance build system
WWW=		https://mesonbuild.com/

LICENSE=	Apache-2.0
LICENSE_FILE=	${WRKSRC}/COPYING


BUILD_DEPENDS=	${PY_SETUPTOOLS} \
		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}

USES=		ninja:run python shebangfix
USE_PYTHON=	allflavors autoplist concurrent pep517
SHEBANG_FILES=	mesonbuild/rewriter.py \
		mesonbuild/scripts/cmake_run_ctgt.py
NO_ARCH=	yes

_USES_fake+=	774:fix-meson-flavor

fix-meson-flavor:
	@if [ "${PYTHON_VER}" != "${PYTHON_DEFAULT}" ]; then \
		${RM} ${FAKE_DESTDIR}${PREFIX}/share/polkit-1/actions/com.mesonbuild.install.policy; \
		${REINPLACE_CMD} -e '/share\/polkit-1\/actions\/com.mesonbuild.install.policy/d' \
			${_PYTHONPKGLIST}; \
	fi

.include <bsd.port.pre.mk>

.if ${PYTHON_VER} != ${PYTHON_DEFAULT}
PKGNAMESUFFIX=	${PYTHON_PKGNAMESUFFIX}
.endif

.include <bsd.port.post.mk>
