# $OpenBSD$
# $FreeBSD: ports/devel/cvsweb/Makefile,v 1.28 2000/09/23 20:48:45 knu Exp $

COMMENT=	WWW CGI script to browse CVS repository trees

VERSION=	3.0.6
DISTNAME=	cvsweb-${VERSION}
PKGNAME=	cvsweb3-${VERSION}
CATEGORIES=	devel www
HOMEPAGE=	http://www.freebsd.org/projects/cvsweb.html

# BSD
PERMIT_PACKAGE_CDROM=	Yes
PERMIT_PACKAGE_FTP=	Yes
PERMIT_DISTFILES_CDROM=	Yes
PERMIT_DISTFILES_FTP=	Yes

MASTER_SITES=	${MASTER_SITE_FREEBSD_LOCAL:=scop/} \
		http://people.FreeBSD.org/~scop/cvsweb/

NO_BUILD=	Yes
NO_REGRESS=	Yes

ENSCRIPTDIR=	${PREFIX}
PREFIX=		/var/www
CONFDIR=	${PREFIX}/conf

CONFFILES=	cvsweb.conf cvsweb.conf-freebsd cvsweb.conf-netbsd \
		cvsweb.conf-openbsd cvsweb.conf-ruby
ICONS=		back.gif binary.gif dir.gif text.gif \
		miniback.gif minidir.gif minigraph.png minitext.gif

ENSCRIPTFILES=	lang_cvsweb.st lang_cvsweb_diff.st

SUBST_VARS=	CONFDIR

RUN_DEPENDS=	devel/p5-IPC-Run \
		www/p5-URI

do-configure:
	@perl -i -pe 's@%%CONFDIR%%@${CONFDIR}@g' ${WRKSRC}/cvsweb.cgi

do-install:
	${INSTALL_SCRIPT_DIR} ${PREFIX}/cgi-bin
	${INSTALL_SCRIPT} ${WRKSRC}/cvsweb.cgi ${PREFIX}/cgi-bin/cvsweb
	${INSTALL_DATA_DIR} ${CONFDIR}/cvsweb
.for file in ${CONFFILES}
	${INSTALL_DATA} ${WRKSRC}/${file} ${CONFDIR}/cvsweb/${file}.dist
.endfor
	${INSTALL_DATA_DIR} ${PREFIX}/icons/cvsweb
.for file in ${ICONS}
	${INSTALL_DATA} ${WRKSRC}/icons/${file} ${PREFIX}/icons/cvsweb/${file}
.endfor
	${INSTALL_DATA_DIR} ${PREFIX}/cvsweb
	${INSTALL_DATA} ${WRKSRC}/css/cvsweb.css ${PREFIX}/cvsweb/cvsweb.css
.for file in ${ENSCRIPTFILES}
	${INSTALL_DATA_DIR} ${ENSCRIPTDIR}/share/enscript/hl
	${INSTALL_DATA} ${WRKSRC}/enscript/${file} ${ENSCRIPTDIR}/share/enscript/hl
.endfor

.include <bsd.port.mk>
