# $OpenBSD: Makefile.template,v 1.85 2019/09/09 19:19:05 kmos Exp $

COMMENT =	full-featured LDAP client running as web application

MODPY_EGG_VERSION =	1.5.81
DISTNAME =	web2ldap-${MODPY_EGG_VERSION}

CATEGORIES =	sysutils

HOMEPAGE =	https://web2ldap.de/web2ldap.html

MAINTAINER =	Lucas Raab <tuftedocelot@fastmail.fm>

# Apache 2.0
PERMIT_PACKAGE =	Yes

MASTER_SITES =	https://www.web2ldap.de/download/

MODULES =	lang/python

MODPY_SETUPTOOLS =	Yes
FLAVOR =	python3
FLAVORS =	python3

BUILD_DEPENDS =	devel/py-ldap0 \
		devel/py-xlwt \
		net/py-dnspython${MODPY_FLAVOR} \
		security/py-asn1crypto${MODPY_FLAVOR} \
		security/py-paramiko${MODPY_FLAVOR}
RUN_DEPENDS =	${BUILD_DEPENDS} \
		graphics/py-Pillow${MODPY_FLAVOR} \
		textproc/py-defusedxml${MODPY_FLAVOR}

CONFDIR =	${PREFIX}/share/examples/web2ldap

post-install:
	${INSTALL_DATA_DIR} ${CONFDIR}
	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/web2ldap/{css,download}
	${INSTALL_DATA} ${WRKSRC}/htdocs/*.html \
		${PREFIX}/share/doc/web2ldap
	${INSTALL_DATA} ${WRKSRC}/htdocs/css/web2ldap.de.css \
		${PREFIX}/share/doc/web2ldap/css
	${INSTALL_DATA} ${WRKSRC}/htdocs/download/redirect-to-download.html \
		 ${PREFIX}/share/doc/web2ldap/download
	${INSTALL_DATA_DIR} ${CONFDIR}/css
	${INSTALL_DATA} ${WRKSRC}/etc/web2ldap/css/*.css \
		${CONFDIR}/css
	${INSTALL_DATA_DIR} ${CONFDIR}/templates
	${INSTALL_DATA} ${WRKSRC}/etc/web2ldap/templates/*.{html,ldif,txt} \
		${CONFDIR}/templates
.for template in ae-dir dhcp msad oath openldap
	${INSTALL_DATA_DIR} ${CONFDIR}/templates/${template}
	${INSTALL_DATA} \
		${WRKSRC}/etc/web2ldap/templates/${template}/*.{ldif,html} \
		${CONFDIR}/templates/${template}
.endfor
	${INSTALL_DATA_DIR} ${CONFDIR}/properties
	${INSTALL_DATA} ${WRKSRC}/etc/web2ldap/properties/*.properties \
		${CONFDIR}/properties
	${INSTALL_DATA_DIR} ${CONFDIR}/tls/cacerts
	${INSTALL_DATA} ${WRKSRC}/etc/web2ldap/tls/cacerts/DST_Root_CA_X3.pem \
		${CONFDIR}/tls/cacerts
	${INSTALL_DATA_DIR} ${CONFDIR}/web2ldapcnf
	${INSTALL_DATA} ${WRKSRC}/etc/web2ldap/web2ldapcnf/*.py \
		${CONFDIR}/web2ldapcnf
.for f in ae-suppl-schema.ldif localschema.ldif web2ldap.schema
	${INSTALL_DATA} ${WRKSRC}/etc/web2ldap/${f} ${CONFDIR}
.endfor
	@rm -r ${PREFIX}/etc

.include <bsd.port.mk>
