# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2
# $Id: Portfile 76566 2011-02-28 12:15:22Z vince@macports.org $

PortSystem						1.0

name									gdal-grass
categories						gis
version								1.4.3
maintainers						vince
description						This plugin allows GDAL to read GRASS files
long_description			This plugin allows GDAL to read GRASS files

homepage							http://grass.osgeo.org/

platforms							darwin

depends_lib						port:gdal \
											port:grass

master_sites					http://download.osgeo.org/gdal/

checksums           md5     2bfb7640e03b4d9d012f1a5d62c0351d \
                    rmd160  60e3866a44d595cbf41368adb1b968387c7852b4 \
                    sha1    63b87ad1688cc365dc6bd6c3ccc854d0e6aa637a

use_configure					yes

configure.args-append	--with-gdal=${prefix}/bin/gdal-config
configure.args-append --with-grass=${prefix}/share/grass-6.4.0

post-configure {
	if {[variant_isset universal]} {
		# Enforce universal flags
		reinplace -E "s|^(CXXFLAGS.*)|\\1 ${configure.universal_cxxflags}|" \
			${worksrcpath}/Makefile
		reinplace -E "s|^(LD_SHARED.*)|\\1 ${configure.universal_cxxflags}|" \
			${worksrcpath}/Makefile
	}
			
	# Fixes destroot issues
	reinplace -E "s|^(GRASSTABLES_DIR\[^/]*)(.*)|\\1${destroot}\\2|" \
		${worksrcpath}/Makefile
	reinplace -E "s|^(AUTOLOAD_DIR\[^/]*)(.*)|\\1${destroot}\\2|" \
		${worksrcpath}/Makefile
	reinplace "s|mkdir|mkdir -p|" ${worksrcpath}/Makefile
}

build.target	
