# New ports collection makefile for:	restapi
# Date created:			26 Apr 2026
# Whom:					Shin-ichi Nagamura <core@zsc.jp>
#
# $Id: Makefile 259 2026-05-08 01:41:46Z core_agent $
#

PORTNAME=		restapi
PORTVERSION=	${REVISION}
MASTER_SITES=	# empty
DISTFILES=		# empty
EXTRACT_ONLY=	# empty
NO_BUILD=		yes

MAINTAINER=		info@zsc.jp
COMMENT=		ashiato RESTful API

USES=			python apache

RUN_DEPENDS+=	ashiato-python>=0:ashiato/python
RUN_DEPENDS+=	${LOCALBASE}/share/fonts/ipa/ipag.otf:japanese/font-ipa
RUN_DEPENDS+=	${LOCALBASE}/share/fonts/ibm-plex/IBMPlexMono-Regular.ttf:ashiato/ibm-plex-fonts
RUN_DEPENDS+=	${LOCALBASE}/${APACHEETCDIR}/Includes/00.load-proxy.conf:kuon/www-load-proxy

SUB_FILES+=	restapi

PLIST_FILES+=	etc/periodic/weekly/ashiato-housekeeper
PLIST_FILES+=	etc/rc.d/${PKGBASE}
PLIST_FILES+=	share/${PKGBASE}/requirements.txt
PLIST_FILES+=	${APACHEETCDIR}/Includes/vhost-https-ashiato/restapi.conf
PLIST_FILES+=	"@postexec sysrc ashiato_restapi_enable=YES"
PLIST_FILES+=	"@postunexec sysrc -x ashiato_restapi_enable"


do-extract:
	svn export -r ${PORTVERSION} ${SVN_REPO_URL} ${WRKDIR}/${PORTNAME}-${PORTVERSION}


do-install:
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/weekly
	${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME}-${PORTVERSION}/tools/housekeeper ${STAGEDIR}${PREFIX}/etc/periodic/weekly/ashiato-housekeeper
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/rc.d
	${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/etc/rc.d/${PKGBASE}
	${MKDIR} ${STAGEDIR}${PREFIX}/share/${PKGBASE}
	${INSTALL_DATA} ${WRKDIR}/${PORTNAME}-${PORTVERSION}/apps/${PORTNAME}/requirements.txt ${STAGEDIR}${PREFIX}/share/${PKGBASE}
	${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/Includes/vhost-https-ashiato
	${INSTALL_DATA} ${FILESDIR}/restapi.conf ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/Includes/vhost-https-ashiato


.include <bsd.port.mk>
