# $Id: Portfile,v 1.2 2004/03/20 07:52:03 olegb Exp $

PortSystem 1.0
name		libgeotiff
version		1.2.1
set libver	1
categories	graphics
maintainers	shadow@dementia.org
description	Library and tools for dealing with GeoTIFF
long_description This software provides support for the Tag Image File \
		 Format (TIFF) Geo extensions.
homepage	http://www.remotesensing.org/geotiff/
platforms	darwin
master_sites	ftp://ftp.remotesensing.org/pub/geotiff/libgeotiff/
distname	${portname}-${portversion}
checksums	md5 cd02f28915f964e4aa914e0e1b39ab4b

patchfiles 	patch-incode

depends_lib	lib:libtiff.3.6:tiff lib:libproj.0:proj lib:libz.1:zlib

configure.env	MANPATH=${prefix}/share/man

configure.args	--with-zip=${prefix} --with-jpeg=${prefix} \
                --with-proj=${prefix} --enable-incode-epsg

destroot.destdir
build.env	DESTDIR=${destroot}
destroot.env	DESTDIR=${destroot}

post-build	{ cd ${worksrcpath}
		  system "cc -dynamiclib -all_load \
		  -install_name ${prefix}/lib/libgeotiff.${portversion}.dylib \
		  -compatibility_version ${portversion} \
		  -o libgeotiff.${portversion}.dylib libgeotiff.a -L${prefix}/lib \
		  -lproj -ltiff -ljpeg -lz" }

pre-destroot	"file mkdir ${destroot}/${prefix}"

post-destroot	{ system "rm ${destroot}/${prefix}/lib/libgeotiff.a"
		  cd ${worksrcpath}
		  system "install -m 755 -d ${destroot}/${prefix}/lib"
		  system "install -m 644 -c \
		    libgeotiff.${portversion}.dylib ${destroot}${prefix}/lib"
		  system "ln -sf libgeotiff.${portversion}.dylib \
		    ${destroot}/${prefix}/lib/libgeotiff.${libver}.dylib"
		  system "ln -sf libgeotiff.${portversion}.dylib \
		    ${destroot}/${prefix}/lib/libgeotiff.dylib" }
