# $Id: Portfile 50980 2009-05-14 19:41:55Z and.damore@macports.org $

PortSystem 1.0

name		rpm2html
version		1.9.6
platforms	darwin freebsd
categories	sysutils
maintainers	afb
description	Translates an RPM database and dependency information into HTML
long_description \
The rpm2html utility automatically generates web pages that describe a \
set of RPM packages.  The goals of rpm2html are to identify the \
dependencies between various packages, and to find the package(s) that \
will provide the resources needed to install a given package. \
Rpm2html analyzes the provides and requires of the given set of RPMs, \
and then shows the dependency cross-references using hypertext links.

homepage	http://www.nongnu.org/rpm2html/
master_sites	http://savannah.nongnu.org/download/rpm2html/
checksums	md5 15ffa538f6fe3d6080bfd4e68b3e67e2

depends_lib	lib:librpm:rpm lib:libxml2:libxml2 port:zlib port:bzip2
depends_build	bin:autoconf:autoconf bin:automake:automake

patchfiles	patch-rpmopen.c patch-memory.c patch-rpmdata.c patch-rpm2html.config

pre-configure	{ system "cd ${worksrcpath} && ./autogen.sh --version" }
configure.args	--with-rpm-prefix=${prefix}

post-destroot {
	set config ${destroot}${prefix}/etc/rpm2html.config
	reinplace "s|/usr/src/redhat|${prefix}/src/macports|" ${config}
	reinplace "s|ftp://ftp.redhat.com/pub/redhat/linux/7.1/en/os/i386/RedHat/RPMS/|ftp=http://macports.org/packages/${os.platform}/${os.arch}/RPMS/|" ${config}
	reinplace "s|ftpsrc=ftp://ftp.redhat.com/pub/redhat/linux/7.1/en/os/i386/SRPMS/|ftpsrc=http://macports.org/packages/SRPMS/|" ${config}
	reinplace "s|/var/www/html|${prefix}/www|" ${destroot}${prefix}/etc/rpm2html.config
}

variant template description "Use separate template file instead of hard-coded markup" {
depends_build-append	lib:template:libtemplate
configure.args-append	--with-template
post-configure { reinplace "s|^;html_template=rpm2html.tpl|html_template=${prefix}/etc/rpm2html.tpl|g" rpm2html.config }
post-destroot { xinstall -m 644 ${worksrcpath}/rpm2html.tpl ${destroot}${prefix}/etc/rpm2html.tpl }
}
