# $Id: Portfile 56093 2009-08-24 06:39:49Z ryandesign@macports.org $

PortSystem 1.0
name		shapelib
version		1.2.10
set libver	1
categories	graphics
maintainers	nomaintainer
description	Library and tools for dealing with ESRI ShapeFiles
long_description This software provides support for the ESRI ShapeFiles.
homepage	http://gdal.velocet.ca/projects/shapelib/index.html
platforms	darwin
master_sites	http://dl.maptools.org/dl/shapelib/
checksums	md5 4d96bd926167193d27bf14d56e2d484e

use_configure	no
build.target    all shptree.o

destroot.destdir

build.env		CC=${configure.cc}

post-build	{
		  system "cd ${worksrcpath} && ${configure.cc} -dynamiclib -all_load \
		  -install_name ${prefix}/lib/libshp.${version}.dylib \
		  -compatibility_version ${version} \
		  -o libshp.${version}.dylib shpopen.o shptree.o \
		  dbfopen.o" }

destroot.target

post-destroot	{
		  xinstall -m 755 -d \
		    ${destroot}${prefix}/include
		  xinstall -m 755 -d \
		    ${destroot}${prefix}/lib
		  xinstall -m 644 -c -W ${worksrcpath} \
		    shapefil.h ${destroot}${prefix}/include
		  xinstall -m 644 -c -W ${worksrcpath} \
		    libshp.${version}.dylib ${destroot}${prefix}/lib
		  system "ln -sf libshp.${version}.dylib \
		    ${destroot}/${prefix}/lib/libshp.${libver}.dylib"
		  system "ln -sf libshp.${version}.dylib \
		    ${destroot}/${prefix}/lib/libshp.dylib" }
