# $Id: Portfile,v 1.13 2005/01/13 19:14:39 mww Exp $

PortSystem 1.0
name		viewcvs
version		0.9.2
categories	devel www
maintainers	darwinports@opendarwin.org
description	View CVS repo content with a Webbrowser
long_description	\
	ViewCVS was inspired by cvsweb (Zeller's version).  ViewCVS can \
	browse directories, change logs, and specific revisions of files. It \
	can display diffs between versions and show selections of files \
	based on tags or branches. In addition, ViewCVS has "annotation" or \
	"blame" support, and the beginnings of Bonsai-like query facilities.
homepage	http://viewcvs.sourceforge.net/
platforms	darwin
master_sites	sourceforge
patchfiles	patch-viewcvs-install
checksums	md5 c7857b1ed05240ad1f691ea40044daf2

configure	{}
depends_build   bin:python:python24

pre-build {
	reinplace "s|__ROOTDIR|${prefix}/share/${name}-${version}|g" ${worksrcpath}/viewcvs-install
	reinplace "s|__DESTROOTDIR|${destroot}${prefix}/share/${name}-${version}|g" ${worksrcpath}/viewcvs-install
}

build		{}
build.cmd	./viewcvs-install
post-destroot {
	
	switch ${os.platform} {
		darwin {
			set cgi_path "/Library/WebServer/CGI-Executables/"
		} freebsd {
			set cgi_path "/usr/local/www/cgi-bin/"
		} default {
			puts stdout "and it was like, beep beep beep beep beep..."
		}
	}
	
	# apache port interop
	if {[ file exists ${prefix}/sbin/httpd]} {
		set cgi_path "${prefix}/www/cgi-bin/"
   	}

	system "install -d ${destroot}${cgi_path}"
	system "install -m 755 ${destroot}${prefix}/share/${name}-${version}/cgi/query.cgi ${destroot}${cgi_path}"
	system "install -m 755 ${destroot}${prefix}/share/${name}-${version}/cgi/viewcvs.cgi ${destroot}${cgi_path}"
}
