Index: Portfile
===================================================================
--- Portfile	(revision 133600)
+++ Portfile	(working copy)
@@ -6,8 +6,7 @@
 PortGroup               wxWidgets 1.0
 
 name                    hugin-app
-version                 2013.0.0
-revision                7
+version                 2014.0.0
 set branch              [join [lrange [split ${version} .] 0 1] .]
 categories              graphics
 maintainers             nomaintainer
@@ -28,6 +27,7 @@
 wxWidgets.use           wxWidgets-3.0
 
 depends_build-append    port:pkgconfig
+
 depends_lib             port:boost \
                         port:exiv2 \
                         port:flann \
@@ -40,6 +40,7 @@
                         port:libpng \
                         port:libxml2 \
                         port:openexr \
+                        port:p5.16-image-exiftool \
                         port:swig-python \
                         port:tclap \
                         port:tiff \
@@ -46,7 +47,13 @@
                         port:python27 \
                         port:${wxWidgets.port}
 
+depends_run             port:enblend
 
+post-extract {
+    # DOS to UNIX line endings.
+    reinplace -W ${worksrcpath} "s|\r||g" src/tools/ParseExp.cpp
+}
+
 # TODO dependencies:
 # - freeglut or glut, the OpenGL utility toolkit
 # - optionally, lapack
@@ -60,23 +67,29 @@
 
 # TODO: try to see where MAC_SELF_CONTAINED_BUNDLE gets defined
 
-# patch-src-foreign-vigra-vigra-cachedfileimage.hxx.patch - https://bugs.launchpad.net/bugs/1213586
-# patch-src-foreign-zthread-include-zthread-Guard.h.diff  - https://bugs.launchpad.net/bugs/1213585
 # patch-src-hugin1-hugin1.pch.diff                        - moderately helps with compiler issues
-patchfiles              patch-src-foreign-vigra-vigra-cachedfileimage.hxx.patch \
-                        patch-src-foreign-zthread-include-zthread-Guard.h.diff \
-                        patch-src-hugin1-hugin1.pch.diff \
-                        patch-src-hugin1-icpfind-AutoCtrlPointCreator.cpp.diff
+patchfiles-append       patch-src-hugin1-hugin1.pch.diff
+patchfiles-append       patch-src-hugin1-icpfind-AutoCtrlPointCreator.cpp.diff
+patchfiles-append       patch-src-tools-ParseExp.cpp.diff
 
-depends_run             port:enblend \
-                        port:p5.16-image-exiftool
+# patch-src-hugin_base-lensdb-LensDB.cpp.diff FOV1 model (enum LF_DIST_MODEL_FOV1) removed in lensfun 0.3.0
+# see http://sourceforge.net/p/lensfun/code/ci/048eb3c4e562b8d3b00068f6f42c7900865d3358/ for rationale
+patchfiles-append       patch-src-hugin_base-lensdb-LensDB.cpp.diff
 
-checksums               rmd160  73261aa925d6284c6950c84fbfdd77e8b0a2ee7d \
-                        sha256  484e1ed58fa6fe4bae1f423967101549345bcca2653b992afbc0ed9ec0dbebd5
+# fix recognition of lensfun during configure after upgrade to version 0.3.0.
 
+post-patch {
+    reinplace "s|/usr/local|${prefix}|" ${worksrcpath}/CMakeModules/FindLensfun.cmake
+}
+
+checksums               rmd160  2184d85f2dd5ada20884bd80f2e4d18c99db294e \
+                        sha256  f098aa0ede44010d3bb2bb38693177533fd776c45063a338c4c483d7e471ec29
+
 # Per the README: "Hugin can be compiled with gcc-4.4.4, gcc-4.5.1, and gcc-4.6"
 compiler.blacklist      gcc-* apple-gcc-* macports-gcc-4.2 macports-gcc-4.3
 
+configure.env           PATH="${prefix}/libexec/perl5.16:$env(PATH)"
+
 # TODO: fix this
 configure.args-append   -DINSTALL_OSX_BUNDLE_DIR=${applications_dir} \
                         -DPYTHON_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/2.7/bin/python \
