# Created by: Koop Mast <kwm@FreeBSD.org>
# $FreeBSD: head/print/harfbuzz/Makefile 545445 2020-08-19 17:47:03Z jbeich $

PORTNAME=	harfbuzz
DISTVERSION=	2.7.2
#DISTNAME=	${PORTNAME}-${PORTVERSION}
PORTREVISION?=	0
CATEGORIES=	print

MAINTAINER=	gnome@FreeBSD.org
COMMENT?=	OpenType text shaping engine

LICENSE=	MIT
LICENSE_FILE=	${WRKSRC}/COPYING

LIB_DEPENDS=	libfreetype.so:print/freetype2 \
		libgraphite2.so:graphics/graphite2

USES=		compiler:c++11-lib gnome meson curl \
		pkgconfig python:3,build shebangfix
USE_GITHUB=	yes
USE_GNOME=	glib20 introspection:build
USE_LDCONFIG=	yes
SHEBANG_GLOB=	*.py
MESON_ARGS=	-Dglib=enabled -Dgobject=enabled -Dgraphite=enabled \
		-Dfreetype=enabled -Dbenchmark=disabled

PLIST_SUB+=	LIBVER=0.20702.0

HARFBUZZ_SLAVE?=	no

CFLAGS+=	"-std=c99"
.if ${HARFBUZZ_SLAVE} == no
OPTIONS_DEFINE=	DOCS TEST
OPTIONS_SUB=	yes

DOCS_BUILD_DEPENDS=	gtkdoc-scan:textproc/gtk-doc
DOCS_MESON_ENABLED=	docs
TEST_MESON_ENABLED=	tests
.endif

.if ${HARFBUZZ_SLAVE} == no
MESON_ARGS+=	-Dicu=disabled -Dcairo=disabled
.elif ${HARFBUZZ_SLAVE} == icu
MESON_ARGS+=	-Dicu=enabled -Dcairo=disabled -Ddocs=disabled \
		-Dtests=disabled
LIB_DEPENDS+=	libharfbuzz.so:print/harfbuzz \
		libicudata.so:devel/icu

.elif ${HARFBUZZ_SLAVE} == hb-view
MESON_ARGS+=	-Dcairo=enabled -Dicu=disabled -Ddocs=disabled \
		-Dtests=disabled
LIB_DEPENDS+=	libharfbuzz.so:print/harfbuzz
USE_GNOME+=	cairo
.endif

.include <bsd.port.mk>