Index: /trunk/dports/science/ds9/Portfile
===================================================================
--- /trunk/dports/science/ds9/Portfile	(revision 99595)
+++ /trunk/dports/science/ds9/Portfile	(revision 99595)
@@ -0,0 +1,93 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem              1.0
+
+name                    ds9
+version                 7.1
+categories              science
+platforms               darwin
+maintainers             aronnax
+license                 GPL-2
+description             SAOImage DS9 astronomical imaging and visualization application
+long_description \
+    SAOImage DS9 is an astronomical imaging and data visualization \
+    application. DS9 supports FITS images and binary tables, multiple frame \
+    buffers, region manipulation, and many scale algorithms and colormaps. It \
+    provides for easy communication with external analysis tasks and is highly \
+    configurable and extensible via XPA and SAMP.
+
+homepage                http://hea-www.harvard.edu/RD/ds9
+master_sites            http://hea-www.harvard.edu/saord/download/ds9/source/
+distname                ${name}.${version}
+checksums               sha1    417543d6fd67d4507f4bbe098e22456e11c9373f \
+                        rmd160  6b65af16dfb6320c4d3629b83acda1f2a79dca49
+
+depends_build-append    port:gcc45
+depends_lib-append      port:xorg-libX11
+
+universal_variant       no
+
+worksrcdir              saods9
+
+platform darwin 8 {
+    set ds9platform tiger
+}
+platform darwin 9 {
+    set ds9platform leopard
+}
+platform darwin 10 {
+    set ds9platform snowleopard
+}
+platform darwin 11 {
+    set ds9platofrm lion
+}
+platform darwin 12 {
+    set ds9platform mountainlion
+}
+
+if {${configure.build_arch} == "ppc"} {
+    set ds9arch ppc
+}
+if {${configure.build_arch} == "ppc64"} {
+    set ds9arch ppc
+}
+if {${configure.build_arch} == "i386"} {
+    set ds9arch x86
+}
+if {${configure.build_arch} == "x86_64"} {
+    set ds9arch 64x86
+}
+
+# FIXME: The second and third patches have been contributed upstream and can be
+# removed in a future release of ds9.
+patchfiles              patch-Makefile.diff \
+                        patch-grid25dbase.C.diff \
+                        patch-grid3dbase.C.diff
+
+# The 'ast' component apparently checks for a working Fortran compiler,
+# even though there appears to be no Fortran code. Is it possible to remove this
+# dependency?
+configure.fc            ${prefix}/bin/gfortran-mp-4.5
+
+# The 'configure' stage for ds9 consists of copying or symbolically linking a
+# platform-specific file to 'make.include'.
+configure {
+    file copy ${worksrcpath}/make.darwin${ds9arch}${ds9platform} ${worksrcpath}/make.include
+}
+
+# Disable parallel build.
+build.jobs              1
+
+build.args-append       JOBS=${build.jobs} \
+                        CC=${configure.cc} \
+                        CXX=${configure.cxx} \
+                        FC=${configure.fc} \
+                        X11INCLUDE=${prefix}/include \
+                        X11LIB=${prefix}/lib \
+                        CODESIGN=/usr/bin/true
+
+destroot {
+    xinstall ${worksrcpath}/bin/ds9 ${destroot}${prefix}/bin
+    xinstall -m 644 ${worksrcpath}/bin/ds9.zip ${destroot}${prefix}/bin
+}
Index: /trunk/dports/science/ds9/files/patch-Makefile.diff
===================================================================
--- /trunk/dports/science/ds9/files/patch-Makefile.diff	(revision 99595)
+++ /trunk/dports/science/ds9/files/patch-Makefile.diff	(revision 99595)
@@ -0,0 +1,11 @@
+--- Makefile.orig	2012-11-06 01:57:29.000000000 -0800
++++ Makefile	2012-11-06 01:58:38.000000000 -0800
+@@ -306,7 +306,7 @@
+ 
+ libtiff	: FORCE
+ 	@echo "Installing LIBTIFF..."
+-	cd $(TKIMGDIR)/compat/libtiff; CC='$(CC)' CFLAGS='$(OPTS)' CXX='$(CC)' CXXFLAGS='$(OPTS)' LDFLAGS='$(LIBS)' ./configure --prefix $(root) --disable-shared --cache-file=$(LOCALCACHE)
++	cd $(TKIMGDIR)/compat/libtiff; CC='$(CC)' CFLAGS='$(OPTS)' CXX='$(CC)' CXXFLAGS='$(OPTS)' LDFLAGS='$(LIBS)' ./configure --prefix $(root) --disable-shared --cache-file=$(LOCALCACHE) --disable-jbig --disable-jpeg
+ 	cd $(TKIMGDIR)/compat/libtiff; $(MAKE) -j $(JOBS) ; $(MAKE) install
+ 
+ tkmpeg	: FORCE
Index: /trunk/dports/science/ds9/files/patch-grid25dbase.C.diff
===================================================================
--- /trunk/dports/science/ds9/files/patch-grid25dbase.C.diff	(revision 99595)
+++ /trunk/dports/science/ds9/files/patch-grid25dbase.C.diff	(revision 99595)
@@ -0,0 +1,20 @@
+--- saotk/util/grid25dbase.C.orig	2012-11-05 23:10:38.000000000 -0800
++++ saotk/util/grid25dbase.C	2012-11-05 23:11:02.000000000 -0800
+@@ -26,14 +26,13 @@
+ int Grid25dBase::gLine(int n, float* x, float* y)
+ {
+   Frame3dBase* pp = (Frame3dBase*)parent_;
+-  Vector vv[n];
+   float xx[n];
+   float yy[n];
+ 
+   for (int ii=0; ii<n; ii++) {
+-    vv[ii] = pp->mapFromRef(Vector(x[ii],y[ii]),Coord::WIDGET);
+-    xx[ii] = vv[ii][0];
+-    yy[ii] = vv[ii][1];
++    Vector vv = pp->mapFromRef(Vector(x[ii],y[ii]),Coord::WIDGET);
++    xx[ii] = vv[0];
++    yy[ii] = vv[1];
+   }
+ 
+   switch (renderMode_) {
Index: /trunk/dports/science/ds9/files/patch-grid3dbase.C.diff
===================================================================
--- /trunk/dports/science/ds9/files/patch-grid3dbase.C.diff	(revision 99595)
+++ /trunk/dports/science/ds9/files/patch-grid3dbase.C.diff	(revision 99595)
@@ -0,0 +1,20 @@
+--- saotk/util/grid3dbase.C.orig	2012-11-05 23:09:41.000000000 -0800
++++ saotk/util/grid3dbase.C	2012-11-05 23:09:51.000000000 -0800
+@@ -24,14 +24,13 @@
+ 
+ int Grid3dBase::gLine(int n, float* x, float* y, float* z)
+ {
+-  Vector3d vv[n];
+   float xx[n];
+   float yy[n];
+ 
+   for (int ii=0; ii<n; ii++) {
+-    vv[ii] = Vector3d(x[ii],y[ii],z[ii])*mx_;
+-    xx[ii] = vv[ii][0];
+-    yy[ii] = vv[ii][1];
++    Vector3d vv = Vector3d(x[ii],y[ii],z[ii])*mx_;
++    xx[ii] = vv[0];
++    yy[ii] = vv[1];
+   }
+ 
+   switch (renderMode_) {
