# $Id: Portfile,v 1.1 2005/12/06 15:01:39 pkern Exp $

PortSystem 1.0
name		glib2-devel
version		2.9.0
categories	devel
maintainers	pkern@opendarwin.org
description	Library with data structure functions and other constructs
homepage	http://www.gtk.org/
platforms	darwin

long_description Glib is a library which includes support routines for \
		 C, such as lists, trees, hashes, memory allocation, and \
		 many other things.

master_sites	ftp://ftp.gtk.org/pub/gtk/v2.9 \
		gnome:sources/glib/2.9

distname	glib-${portversion}
checksums	md5 b71e24bba5e137d39ed576e1dfdd3680

use_bzip2	yes

depends_build	bin:pkg-config:pkgconfig
depends_lib	lib:libintl.3:gettext

patchfiles	patch-configure patch-glib__gmain.c patch-glib__gutils.c

configure.env	LDFLAGS="-L${prefix}/lib -bind_at_load" \
		CPPFLAGS="-I${prefix}/include" \
		CFLAGS="-O3 -funroll-loops -fstrict-aliasing" 

configure.args   --mandir=${prefix}/share/man

variant puredarwin { depends_run bin:perl:perl5.8 }

post-patch {
	     reinplace "s|data_dirs = \"/usr|data_dirs = \"${prefix}/share:/usr|g" ${worksrcpath}/glib/gutils.c
	     reinplace "s|path = \"/bin|path = \"${prefix}/bin:/bin|g" ${worksrcpath}/glib/gutils.c ${worksrcpath}/glib/gspawn.c
}

post-destroot { file delete ${destroot}${prefix}/lib/charset.alias }

platform darwin 6 {
	depends_lib-append lib:libdl:dlcompat
	post-configure {
		reinplace "s|#define HAVE_WCHAR_T 1|#undef HAVE_WCHAR_T|" \
			${worksrcpath}/config.h
	}
}
