Index: files/patch-Makefile.gnu
===================================================================
--- files/patch-Makefile.gnu	(revision 0)
+++ files/patch-Makefile.gnu	(revision 0)
@@ -0,0 +1,69 @@
+--- Makefile.gnu.orig	2009-06-24 17:19:47.000000000 -0700
++++ Makefile.gnu	2009-06-24 17:57:28.000000000 -0700
+@@ -3,10 +3,14 @@
+ # This file can be generated by ./gensrclist.sh
+ include Makefile.srcs
+ 
++CC = __CC__
++CXX = __CXX__
++LDFLAGS = __LDFLAGS__
++
+ # General configuration variables:
+-DESTDIR ?= /
+-INCDIR ?= $(DESTDIR)/usr/include
+-INSTALLDIR ?= $(DESTDIR)/usr/lib
++DESTDIR ?= 
++INCDIR ?= $(DESTDIR)__PREFIX__/include
++INSTALLDIR ?= $(DESTDIR)__PREFIX__/lib
+ 
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+@@ -15,9 +19,9 @@
+ 
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+-CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
++CFLAGS ?= __CFLAGS__ -fPIC -fexceptions -fvisibility=hidden
+ CFLAGS += $(INCLUDE)
+-CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
++CXXFLAGS ?= __CXXFLAGS__ -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
+ CXXFLAGS += $(INCLUDE)
+ 
+ ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
+@@ -27,9 +31,9 @@
+ 
+ TARGET  = freeimage
+ STATICLIB = lib$(TARGET).a
+-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
+-LIBNAME	= lib$(TARGET).so
+-VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
++SHAREDLIB = lib$(TARGET).$(VER_MAJOR).$(VER_MINOR).dylib
++LIBNAME	= lib$(TARGET).dylib
++VERLIBNAME = lib$(TARGET).$(VER_MAJOR).dylib
+ HEADER = Source/FreeImage.h
+ 
+ 
+@@ -55,16 +59,18 @@
+ 	$(CXX) $(CXXFLAGS) -c $< -o $@
+ 
+ $(STATICLIB): $(MODULES)
+-	$(AR) r $@ $(MODULES)
++	/usr/bin/libtool -o $@ $(MODULES)
+ 
+ $(SHAREDLIB): $(MODULES)
+-	$(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++	$(CC) -dynamiclib -install_name $(INSTALLDIR)/$(VERLIBNAME) -compatibility_version $(VER_MAJOR) -current_version $(VER_MAJOR).$(VER_MINOR) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+ 
+ install:
+ 	install -d $(INCDIR) $(INSTALLDIR)
+-	install -m 644 -o root -g root $(HEADER) $(INCDIR)
+-	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+-	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++	install -m 644 $(HEADER) $(INCDIR)
++	install -m 644 $(STATICLIB) $(INSTALLDIR)
++	install -m 755 $(SHAREDLIB) $(INSTALLDIR)
++	ln -s $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
++	ln -s $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
+ 
+ clean:
+ 	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
Index: files/patch-Makefile.osx-Leopard.diff
===================================================================
--- files/patch-Makefile.osx-Leopard.diff	(revision 52867)
+++ files/patch-Makefile.osx-Leopard.diff	(working copy)
@@ -1,20 +0,0 @@
---- Makefile.osx.orig	2007-08-25 17:00:38.000000000 +0200
-+++ Makefile.osx	2008-02-15 15:41:15.000000000 +0100
-@@ -14,14 +14,14 @@
- COMPILERFLAGS_I386 = -arch i386
- COMPILERPPFLAGS = -Wno-ctor-dtor-privacy
- INCLUDE += 
--INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.3.9.sdk
-+INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.4u.sdk
- INCLUDE_I386 = -isysroot /Developer/SDKs/MacOSX10.4u.sdk
- CFLAGS_PPC = $(COMPILERFLAGS) $(COMPILERFLAGS_PPC) $(INCLUDE) $(INCLUDE_PPC)
- CFLAGS_I386 = $(COMPILERFLAGS) $(COMPILERFLAGS_I386) $(INCLUDE) $(INCLUDE_I386)
- CPPFLAGS_PPC = $(COMPILERPPFLAGS) $(CFLAGS_PPC)
- CPPFLAGS_I386 = $(COMPILERPPFLAGS) $(CFLAGS_I386)
--LIBRARIES_PPC = -Wl,-syslibroot /Developer/SDKs/MacOSX10.3.9.sdk
--LIBRARIES_I386 = -Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk
-+LIBRARIES_PPC = -Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk/usr/lib
-+LIBRARIES_I386 = -Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk/usr/lib
- LIBTOOL = libtool
- LIPO = lipo
- 
Index: Portfile
===================================================================
--- Portfile	(revision 52867)
+++ Portfile	(working copy)
@@ -4,7 +4,7 @@
 PortSystem 1.0
 
 name			freeimage
-version			3.10.0
+version			3.12.0
 categories		graphics
 maintainers		ryand-ruby@zenspider.com
 description		Library for FreeImage, a dependency-less graphics library
@@ -19,25 +19,27 @@
 use_zip			yes
 worksrcdir		FreeImage
 
-checksums		md5 2e57135e26bb487cc8e13ee7b7e0a595 \
-			sha1 9590563e8abade9494fc6db6f6127fa3db42b8e1 \
-			rmd160 9f501e099bca567b2ffedd0f9f00ad6b58021b09
+checksums		md5 47b259102f776a4bcd7affc00942f3b4 \
+			sha1 d9a5efc9590cb45e176c7e5552afef961594a1cb \
+			rmd160 421ddbd81343d14561ade844c67c31802ab444ad
 
-use_configure		no
+patchfiles			patch-Makefile.gnu
 
-destroot.pre_args	-f Makefile.osx ${destroot.target}
-destroot.destdir	PREFIX=${destroot}${prefix}
+configure {
+	reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/Makefile.gnu
 
-default_variants +universal
-variant universal {}
-pre-fetch {
-	if {![variant_isset universal]} {
-		return -code error "${name} is only available in a universal version"
-	}
-}
+	reinplace "s|__LDFLAGS__|${configure.ldflags}|" ${worksrcpath}/Makefile.gnu
 
-platform darwin 9 {
-    patchfiles-append   patch-Makefile.osx-Leopard.diff
+	reinplace "s|__CC__|${configure.cc}|" ${worksrcpath}/Makefile.gnu
+	reinplace "s|__CFLAGS__|${configure.cflags}|" ${worksrcpath}/Makefile.gnu
+
+	reinplace "s|__CXX__|${configure.cxx}|" ${worksrcpath}/Makefile.gnu
+	reinplace "s|__CXXFLAGS__|${configure.cxxflags}|" ${worksrcpath}/Makefile.gnu
 }
 
+build.target		FreeImage
+build.args			-f Makefile.gnu
+
+destroot.args		-f Makefile.gnu
+
 livecheck.regex		<title>Source Distribution (.*) released.*</title>
