# $Id: Portfile,v 1.5 2006/06/22 13:24:14 jwa Exp $

PortSystem 1.0
name		midgard-core
version		1.7.6
revision	0
categories	www
maintainers	jwa@opendarwin.org
description	"A content management system"
long_description "Midgard is a content management system\
		platform using Apache, PHP and MySQL."
platforms	darwin
homepage	http://www.midgard-project.org/

master_sites	http://www.midgard-project.org/midcom-serveattachmentguid-06614d88f3f91d7fc2d1dc447d62415a/

use_bzip2	yes
checksums	sha1 c422d79566260d382da8d51551868cf89686889b
depends_lib	port:expat \
		port:gettext \
		port:glib2 \
		port:libiconv \
		port:libxml2 \
		port:mysql5 \
		port:openssl \
		port:zlib

post-extract {
	file mkdir ${workpath}/mysql5/
	system "cd ${workpath}/mysql5/ \
		&& ln -s ${prefix}/include/mysql5 include \
		&& ln -s ${prefix}/lib/mysql5/ lib"
}

configure.args	--sysconfdir=${prefix}/etc/midgard/ \
		--with-expat=${prefix} --with-mysql=${workpath}/mysql5 \
		--with-iconv=${prefix}

post-destroot {
	reinplace "s;${workpath}/mysql5/lib;${prefix}/lib/mysql5;" ${destroot}${prefix}/bin/midgard-config
	reinplace "s;${workpath}/mysql5/include;${prefix}/include/mysql5;" ${destroot}${prefix}/bin/midgard-config
}

variant check {
	depends_lib-append port:check
	configure.args-append --with-check=${prefix}
}

post-install	{
	ui_msg "NB! The other parts of the package are:"
	ui_msg "midgard-apache2, midgard-php4 and midgard-data"
}

platform darwin 8 {
	configure.env CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0
}
