# $Id: Portfile,v 1.39 2006/08/05 17:45:39 rhwood Exp $
PortSystem 1.0
name		gnome-vfs
version		2.15.2
description	This is the GNOME Virtual File System.
long_description        This is the GNOME Virtual File System. \
			GNOME VFS is currently used as one of the \
			foundations of the Nautilus file manager.
maintainers	gnome-darwinports@opendarwin.org rhwood@opendarwin.org
categories	gnome
platforms	darwin 
homepage	http://www.gnome.org/
master_sites    gnome:sources/${name}/2.15/
checksums	md5 a2bfa7c76d77d777589995634051b293 \
		sha1 68311644d88ca2b2a76cdf2207b1b76762e138ef \
		rmd160 7d5cfd57fa2f20b532e79607c77b3b55d6bbc3b3

depends_lib	\
		port:gnome-mime-data \
		port:gconf \
		port:howl \
		port:neon \
		port:dbus \
		port:openssl

use_bzip2 	yes

patchfiles	\
		configure.patch \
		daemon_Makefile.in.patch \
		modules_file-method-acl.c.patch

configure.args  --mandir=${prefix}/share/man \
		--enable-ipv6 \
		--enable-howl \
		--with-openssl-libs=${prefix}/lib \
		--with-openssl-includes=${prefix}/include \
		--disable-gnutls
configure.env   CPPFLAGS="-L${prefix}/lib -I${prefix}/include" \
		LDFLAGS="-lresolv"

post-patch {
	reinplace "s|open64||g" ${worksrcpath}/configure
	reinplace "s|posix_fadvise||g" ${worksrcpath}/configure
	reinplace "s|data_dirs = \"/usr|data_dirs = \"${prefix}/share:/usr|g" \
		${worksrcpath}/libgnomevfs/xdgmime.c \
		${worksrcpath}/libgnomevfs/gnome-vfs-mime-info.c 
	reinplace "s|\"/etc/fstab\"|\"/etc/fstab.hd\"|g" \
		${worksrcpath}/libgnomevfs/gnome-vfs-unix-mounts.c

	if {[variant_isset darwin_6]} {
        reinplace "s|#include <arpa/nameser.h>|#include <arpa/nameser.h>\\
		#ifndef T_SRV\\
		#define T_SRV 33\\
		#endif|g" \
			${worksrcpath}/libgnomevfs/gnome-vfs-dns-sd.c 
        reinplace "s|#include <limits.h>|#include <limits.h>\\
		#if \!defined getc_unlocked \\&\\& \!defined HAVE_GETC_UNLOCKED\\
		#define getc_unlocked(fp) getc (fp)\\
		#endif|g" \
			${worksrcpath}/libgnomevfs/xdgmimemagic.c
    	reinplace "s|socklen_t|int|g" ${worksrcpath}/modules/ftp-method.c
	}
	
	if {[variant_isset darwin_7]} {
		reinplace "s|#include <stdio.h>|#include <stdio.h>\\
		#include <stdint.h>|g" ${worksrcpath}/libgnomevfs/xdgmimecache.c
	}

}

pre-build {
	reinplace "s|-lkrb5support||g" \
		${worksrcpath}/Makefile ${worksrcpath}/daemon/Makefile \
		${worksrcpath}/devel-docs/Makefile ${worksrcpath}/doc/Makefile \
		${worksrcpath}/devel-docs/gnome-vfs-tutorial/Makefile \
		${worksrcpath}/imported/Makefile ${worksrcpath}/imported/neon/Makefile \
		${worksrcpath}/libgnomevfs/Makefile ${worksrcpath}/modules/Makefile \
		${worksrcpath}/monikers/Makefile ${worksrcpath}/programs/Makefile \
		${worksrcpath}/schemas/Makefile 
}

platform darwin 6 {
        configure.env-delete LDFLAGS="-lresolv"
	patchfiles	patch-xdgmimecache.c
}

platform darwin 7 {
	patchfiles	patch-xdgmimecache.c
}

variant use_system_dependencies {
	depends_lib	\
		lib:gnome-mime-magic:gnome-mime-data \
		lib:gconf-2:gconf
}
