# $Id: Portfile,v 1.17 2004/08/13 09:48:49 mww Exp $

PortSystem 1.0
name		gd
version		1.8.4
set libver	1.8
revision        3
categories	graphics
maintainers	michaelm@opendarwin.org
description	GD creates PNG and JPEG images, among other formats
long_description	gd is a graphics library. It allows your code to quickly draw images \
			complete with lines, arcs, text, multiple colors, cut and paste from \
			other images, and flood fills, and write out the result as a .PNG file. \
			This is particularly useful in World Wide Web applications, where .PNG \
			is the format used for inline images. \
			gd is not a paint program. If you are looking for a paint program, you \
			are looking in the wrong place. If you are not a programmer, you are \
			looking in the wrong place.

platforms	darwin
master_sites	http://www.boutell.com/gd/http/ 
checksums	md5 2aef76e79f206f9798233f025f5dd28d
patchfiles	patch-Makefile patch-gdcache.h
depends_lib	lib:libpng:libpng lib:libjpeg:jpeg
build.type	gnu
build.env	CPPFLAGS='-fno-common -no-cpp-precomp'
configure	{}
build.args	PREFIX=${prefix}
post-build	{ cd ${worksrcpath}
		      system "cc -fno-common -dynamiclib -o libgd.${libver}.dylib \
		      -install_name ${prefix}/lib/libgd.1.dylib -compatibility_version ${libver} \
		      -current_version ${libver} -all_load libgd.a -L${prefix}/lib -lpng -lz -ljpeg" }

destroot.args PREFIX=${destroot}/${prefix}
pre-destroot	{ system "install -d ${destroot}/${prefix}/bin"
		  system "install -d ${destroot}/${prefix}/share/man/man1"
		  system "install -d ${destroot}/${prefix}/include"
		  system "install -d ${destroot}/${prefix}/lib" }


post-destroot	{ system "rm ${destroot}/${prefix}/lib/libgd.a" 
				  system "install ${worksrcpath}/libgd.${libver}.dylib \
				    ${destroot}/${prefix}/lib/libgd.${libver}.dylib" 
				  system "ln -s ${prefix}/lib/libgd.${libver}.dylib \
				    ${destroot}/${prefix}/lib/libgd.dylib"
				  system "ln -s ${prefix}/lib/libgd.${libver}.dylib \
				    ${destroot}/${prefix}/lib/libgd.1.dylib"
				  }
 
			
variant x11 {	patchfiles patch-x11-Makefile patch-gdcache.h }
