PORTNAME=	mgenplus
PORTVERSION=	20150602
PORTREVISION=	1
CATEGORIES=	japanese x11-fonts
MASTER_SITES=	OSDN_CHAMBER/8/8597
PKGNAMEPREFIX=	ja-font-

MAINTAINER=	ume@FreeBSD.org
COMMENT=	Mgen+ Japanese TrueType fonts
WWW=		http://jikasei.me/font/mgenplus/

LICENSE=	OFL11

USES=		7z fonts:fc
FONTNAME=	${PORTNAME}
NO_ARCH=	yes
NO_BUILD=	yes
PKGINSTALL=	${WRKDIR}/pkg-install
PKGDEINSTALL=	${WRKDIR}/pkg-install
SUB_FILES=	pkg-install
NO_WRKSUBDIR=	yes
PORTDOCS=	*

OPTIONS_DEFINE=	DOCS
OPTIONS_MULTI=			FONT_FAMILY
OPTIONS_MULTI_FONT_FAMILY=	MGENPLUS_1C MGENPLUS_1CP MGENPLUS_1M \
				MGENPLUS_1MN MGENPLUS_1P MGENPLUS_1PP \
				MGENPLUS_2C MGENPLUS_2CP MGENPLUS_2M \
				MGENPLUS_2P MGENPLUS_2PP
OPTIONS_DEFAULT=		MGENPLUS_1C MGENPLUS_1CP MGENPLUS_1M \
				MGENPLUS_1MN MGENPLUS_1P MGENPLUS_1PP \
				MGENPLUS_2C MGENPLUS_2CP MGENPLUS_2M \
				MGENPLUS_2P MGENPLUS_2PP
OPTIONS_SUB=			yes
MGENPLUS_1C_DESC=		Mgen+ 1c
MGENPLUS_1CP_DESC=		Mgen+ 1cp
MGENPLUS_1M_DESC=		Mgen+ 1m
MGENPLUS_1MN_DESC=		Mgen+ 1mn
MGENPLUS_1P_DESC=		Mgen+ 1p
MGENPLUS_1PP_DESC=		Mgen+ 1pp
MGENPLUS_2C_DESC=		Mgen+ 2c
MGENPLUS_2CP_DESC=		Mgen+ 2cp
MGENPLUS_2M_DESC=		Mgen+ 2m
MGENPLUS_2P_DESC=		Mgen+ 2p
MGENPLUS_2PP_DESC=		Mgen+ 2pp

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MMGENPLUS_1C}
FAMILY=	1c
.endif
.if ${PORT_OPTIONS:MMGENPLUS_1CP}
FAMILY+=1cp
.endif
.if ${PORT_OPTIONS:MMGENPLUS_1M}
FAMILY+=1m
.endif
.if ${PORT_OPTIONS:MMGENPLUS_1MN}
FAMILY+=1mn
.endif
.if ${PORT_OPTIONS:MMGENPLUS_1P}
FAMILY+=1p
.endif
.if ${PORT_OPTIONS:MMGENPLUS_1PP}
FAMILY+=1pp
.endif
.if ${PORT_OPTIONS:MMGENPLUS_2C}
FAMILY+=2c
.endif
.if ${PORT_OPTIONS:MMGENPLUS_2CP}
FAMILY+=2cp
.endif
.if ${PORT_OPTIONS:MMGENPLUS_2M}
FAMILY+=2m
.endif
.if ${PORT_OPTIONS:MMGENPLUS_2P}
FAMILY+=2p
.endif
.if ${PORT_OPTIONS:MMGENPLUS_2PP}
FAMILY+=2pp
.endif

do-install:
	${MKDIR} ${STAGEDIR}${FONTSDIR}
.for FAM in ${FAMILY}
	${INSTALL_DATA} ${WRKSRC}/mgenplus-${FAM}-*.ttf \
	    ${STAGEDIR}${FONTSDIR}
.endfor
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/fonts/conf.avail \
	    ${STAGEDIR}${PREFIX}/etc/fonts/conf.d
	${INSTALL_DATA} ${FILESDIR}/20-unhint-${PORTNAME}.conf \
	    ${FILESDIR}/62-fonts-${PORTNAME}.conf \
	    ${STAGEDIR}${PREFIX}/etc/fonts/conf.avail
	${LN} -s -f ../conf.avail/20-unhint-${PORTNAME}.conf \
	    ${STAGEDIR}${PREFIX}/etc/fonts/conf.d/20-unhint-${PORTNAME}.conf
	${LN} -s -f ../conf.avail/62-fonts-${PORTNAME}.conf \
	    ${STAGEDIR}${PREFIX}/etc/fonts/conf.d/62-fonts-${PORTNAME}.conf

post-install-DOCS-on:
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} \
		"! -name *\.ttf"

.include <bsd.port.mk>
