# $Id: Portfile 36581 2008-05-07 08:25:15Z ryandesign@macports.org $

PortSystem 1.0

name			mod_ssi_func
version			1.0
categories		www
platforms		darwin
maintainers		nomaintainer
description		advanced SSI modules for apache2
long_description	"${description}"

homepage		http://www.bbc.co.uk/opensource/projects/apache/
master_sites	${homepage}
distname		distribution_${version}
checksums		md5 6947621d7a31bff681967282b3ca9eac
use_zip			yes

depends_lib		port:apache20

pre-extract {
	file mkdir ${worksrcpath}
}
extract.dir		${worksrcpath}

pre-patch {
	# Convert Makefiles from DOS to UNIX linefeeds before patching
	reinplace "s/\r$//g" \
		${worksrcpath}/ssi_func/Makefile \
		${worksrcpath}/ssi_func_flastmod/Makefile \
		${worksrcpath}/ssi_func_math/Makefile \
		${worksrcpath}/ssi_func_rnd/Makefile \
		${worksrcpath}/ssi_setsplitvars/Makefile
}

patchfiles		patch-ssi_func-Makefile \
				patch-ssi_func_flastmod-Makefile \
				patch-ssi_func_math-Makefile \
				patch-ssi_func_rnd-Makefile \
				patch-ssi_setsplitvars-Makefile

use_configure	no

set mods		{ssi_func ssi_func_flastmod ssi_func_math ssi_func_rnd ssi_setsplitvars}

build {
	copy ${worksrcpath}/ssi_func/mod_ssi_func.h ${worksrcpath}/ssi_func_flastmod
	copy ${worksrcpath}/ssi_func/mod_ssi_func.h ${worksrcpath}/ssi_func_math
	copy ${worksrcpath}/ssi_func/mod_ssi_func.h ${worksrcpath}/ssi_func_rnd
	foreach mod ${mods} {
		system "cd ${worksrcpath}/${mod} && \
			make APXS=${prefix}/apache20/bin/apxs"
	}
}

destroot {
	foreach mod ${mods} {
		system "cd ${worksrcpath}/${mod} && \
			make install APXS=${prefix}/apache20/bin/apxs DESTDIR=${destroot}"
	}
}
