--- Portfile.orig	2013-11-05 14:56:58.000000000 +0100
+++ Portfile	2013-11-08 21:27:09.000000000 +0100
@@ -4,7 +4,7 @@
 PortSystem          1.0
 
 name                gmt4
-version             4.5.9
+version             4.5.11
 categories          science
 platforms           darwin
 maintainers         eprofs.de:florian \
@@ -13,9 +13,9 @@
 description         The Generic Mapping Tools
 long_description GMT is an open source collection of ~65 tools  \
     for manipulating geographic and Cartesian data sets and     \
-    producing Encapsulated PostScript File (EPS) illustrations  \
-    ranging from simple x-y plots via contour maps to           \
-    artificially illuminated surfaces and 3-D perspective views.
+    producing PostScript illustrations ranging from simple x-y  \
+    plots via contour maps to artificially illuminated surfaces \
+    and 3D perspective views.
 conflicts           gmt
 homepage            http://gmt.soest.hawaii.edu/
 master_sites        ftp://ftp.soest.hawaii.edu/gmt          \
@@ -25,26 +25,25 @@
                     ftp://ftp.geologi.uio.no/pub/gmt        \
                     ftp://gd.tuwien.ac.at/pub/gmt           \
                     ftp://ftp.scc.u-tokai.ac.jp/pub/gmt     \
-                    ftp://mirror.geosci.usyd.edu.au/pub/gmt \
                     ftp://gmt.mirror.ac.za/pub/gmt
 use_bzip2           yes
-set nameprefix      gmt
-distname            ${nameprefix}-${version}
-set dfile_gmt_gpl   ${distname}${extract.suffix}
-set dfile_gmt_nogpl ${nameprefix}-${version}-non-gpl${extract.suffix}
+distname            gmt-${version}
+set dfile_gmt_gpl   ${distname}-src${extract.suffix}
+set dfile_gmt_nogpl ${distname}-non-gpl-src${extract.suffix}
 distfiles           ${dfile_gmt_gpl} \
                     ${dfile_gmt_nogpl}
 
 checksums           ${dfile_gmt_gpl} \
-                    md5     9f241e97774eadd1fe79f4d7022fcaed \
-                    sha1    711922fd99dcd47ace522f1e46fcafa5beab8c94 \
-                    rmd160  67d36ecf68b9bcd9a38de61e4f1b3e1120c71823 \
+                    md5     e51a8827d9b0ce3f36cfe6be01f24931 \
+                    sha1    9f226fdb498a6868da98a6014517aa9537542f03 \
+                    rmd160  1665f13e0a877282a57a93989f9ba8fbf49b2645 \
                     ${dfile_gmt_nogpl} \
-                    md5     d61a34a83dc630b464d472c6f0bdfc3a \
-                    sha1    d03651d98a5f010090bceda2bbec09e53a543942 \
-                    rmd160  a562f21b1e474d660cc5b9502543c127fb9fb801
+                    md5     fd4abdbbc5cb48087a12a4c762b87123 \
+                    sha1    67c2dd5ccde9ed661e9e9930785d305f73d3315a \
+                    rmd160  6154cc49792ded6103a907da6fe00d7b9c042541
 
-worksrcdir          GMT${version}
+patchfiles          patch-ps2raster.diff \
+                    patch-grdvector.diff
 
 depends_lib         port:netcdf \
                     port:gshhg-gmt-nc4
@@ -52,7 +51,7 @@
 destroot.target     install-all
 use_parallel_build  no
 universal_variant   no
-default_variants    +gdal
+default_variants    +gdal +triangle
 
 configure.pre_args          --prefix=${prefix}/lib/${name}
 configure.args              --datarootdir=${prefix}/share/${name} \
@@ -65,12 +64,10 @@
                             --enable-flock \
                             --disable-xgrid \
                             --disable-mex
-configure.optflags-delete   -O2
 configure.ldflags-delete    -L${prefix}/lib
 
 post-destroot {
     ln -s ../lib/${name}/bin/GMT ${destroot}${prefix}/bin/${name}
-    ln -s ../lib/${name}/bin/GMT ${destroot}${prefix}/bin/${nameprefix}
     ln -s ../doc/${name} ${destroot}${prefix}/share/${name}/doc
     ln -s ../../share/doc/${name}/man ${destroot}${prefix}/lib/${name}/man
     ln -s ../../share/${name}/include ${destroot}${prefix}/lib/${name}/include
@@ -88,6 +85,8 @@
 }
 
 variant triangle description {use J. Shewchuk's fast, non-GPL triangulation routine} {
+    license-delete          GPL-2
+    license-append          Restrictive
     configure.args-append   --enable-triangle
 }
 
@@ -98,5 +97,5 @@
 }
 
 livecheck.type      regex
-livecheck.url       ${homepage}/gmt/gmt_home.html
-livecheck.regex     {Current version[^0-9]*([0-9]+\.[0-9]+\.[0-9]+)}
+livecheck.url       ${homepage}
+livecheck.regex     {(?i)gmt-(4\.[0-9]+\.[0-9]+)<\/a>}
