Index: Portfile
===================================================================
--- Portfile	(revision 133600)
+++ Portfile	(working copy)
@@ -2,16 +2,15 @@
 # $Id$
 
 PortSystem          1.0
-PortGroup           muniversal 1.0
+PortGroup           cmake 1.0
 
 name                lensfun
 epoch               1
-version             0.2.8
-revision            1
+version             0.3.0
 categories          graphics
 platforms           darwin
 maintainers         devans openmaintainer
-license             GPL-3 LGPL-3
+license             GPL-3 LGPL-3 CC-BY-SA
 
 description         Library for fixing lens geometry distortion
 
@@ -24,63 +23,38 @@
 master_sites        sourceforge:project/${name}/${version}
 use_bzip2           yes
 
-checksums           rmd160  527b4ca0e9ce40f514e7340548d0d0635bdc875e \
-                    sha256  f88f97fbc78259a2b2edddef295caf50770901107c8469e54bb5e9699faa1a48
+checksums           rmd160  dc39f4708b2632ed6795052d368f3ad847c6704f \
+                    sha256  c2c3c03873cb549d49d42f118fcb0ffa95d1e45b9ff395e19facb63bf699bec1
 
-depends_build       port:pkgconfig bin:makedep:gccmakedep
+depends_build-append \
+                    port:pkgconfig
 
-depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2
+depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
+                    port:libpng
 
-# Ensure lensfun.pc is created
-patchfiles          patch-pkgconfig.diff
+# installs python3 helper scripts lensfun-add-adapter lensfun-update-data
 
-# Set the correct library install_name and current_version
-patchfiles-append   patch-build-tibs-target-mac-mak.diff
-post-patch {
-    reinplace "s|@VERSION@|${version}|g" ${worksrcpath}/build/tibs/target/mac.mak
-}
+depends_run         port:python34
 
-set cxx_stdlibflags {}
-if {[string match *clang* ${configure.cxx}]} {
-    set cxx_stdlibflags -stdlib=${configure.cxx_stdlib}
+pre-patch {
+    copy ${worksrcpath}/docs/CMakeLists.txt ${worksrcpath}/docs/CMakeLists.txt.orig
 }
 
-configure.args      -v
-configure.env       LD="${configure.cxx} ${cxx_stdlibflags}"
+patchfiles          patch-docs-CMakeLists.txt.diff
 
-platform darwin 8 {
-    # lensfun requires make >= 3.81; Tiger comes with 3.80
-    depends_build-append port:gmake
-    # fix configure script check which is hardcoded to using "make"
-    post-extract {
-        xinstall -d ${workpath}/bin
-        ln -s ${prefix}/bin/gmake ${workpath}/bin/make
-    }
-    configure.env PATH=${workpath}/bin:$env(PATH)
-    # fix build and destroot
-    build.cmd ${prefix}/bin/gmake
+post-patch {
+                    reinplace "s|^#!.*|#!${prefix}/bin/python3.4|" \
+                         ${worksrcpath}/apps/lensfun-add-adapter \
+                         ${worksrcpath}/apps/lensfun-update-data
 }
 
-if {[variant_isset universal]} {
-    foreach arch ${configure.universal_archs} {
-        set merger_host($arch) ""
-    }
-    set merger_configure_args(ppc64)  "--target=mac.powerpc64.G5 --vectorization=''"
-    set merger_configure_args(ppc)    "--target=mac.powerpc.powerpc --vectorization=''"
-    set merger_configure_args(i386)   "--target=mac.x86.i686"
-    set merger_configure_args(x86_64) "--target=mac.x86_64.generic"
-} elseif {${build_arch} eq "ppc64"} {
-    configure.args-append --target=mac.powerpc64.G5 --vectorization=''
-} elseif {${build_arch} eq "ppc"} {
-    configure.args-append --target=mac.powerpc.powerpc --vectorization=''
-} elseif {${build_arch} eq "i386"} {
-    configure.args-append --target=mac.x86.i686
-} elseif {${build_arch} eq "x86_64"} {
-    configure.args-append --target=mac.x86_64.generic
+variant doc description {Build API and man documentation using doxygen, rst2man} {
+    depends_build-append \
+                    port:doxygen \
+                    port:py34-docutils
+
+    configure.args-append \
+                    -DBUILD_DOC=ON
 }
 
-configure.universal_args-delete --disable-dependency-tracking
-
-build.args          V=1 GCC.LD="${configure.cxx} ${cxx_stdlibflags}"
-
 livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
Index: files/patch-build-tibs-target-mac-mak.diff
===================================================================
--- files/patch-build-tibs-target-mac-mak.diff	(revision 133600)
+++ files/patch-build-tibs-target-mac-mak.diff	(working copy)
@@ -1,10 +0,0 @@
---- build/tibs/target/mac.mak.orig	2011-01-17 20:34:03.000000000 +1300
-+++ build/tibs/target/mac.mak	2011-01-17 20:35:12.000000000 +1300
-@@ -12,6 +12,6 @@
- _EX =
- 
- # Flag to tell Darwin linker to set the library name:
--GCC.LDFLAGS.SHARED = -dynamiclib -Wl,"-dylib_install_name,$1"
-+GCC.LDFLAGS.SHARED = -dynamiclib -Wl,"-install_name,$(CONF_LIBDIR)$1" -Wl,"-current_version,@VERSION@"
- # Set to non-empty if platform supports versioned shared libraries
- SO.VERSION = 1
Index: files/patch-docs-CMakeLists.txt.diff
===================================================================
--- files/patch-docs-CMakeLists.txt.diff	(revision 0)
+++ files/patch-docs-CMakeLists.txt.diff	(working copy)
@@ -0,0 +1,22 @@
+--- docs/CMakeLists.txt.orig	2014-09-30 10:37:34.000000000 -0700
++++ docs/CMakeLists.txt	2015-03-06 08:19:31.000000000 -0800
+@@ -26,9 +26,9 @@
+ ADD_CUSTOM_TARGET(man ALL)
+ ADD_CUSTOM_COMMAND(
+   TARGET man
+-  COMMAND rst2man ${CMAKE_CURRENT_SOURCE_DIR}/man/g-lensfun-update-data.1.rst > ${CMAKE_CURRENT_BINARY_DIR}/g-lensfun-update-data.1
+-  COMMAND rst2man ${CMAKE_CURRENT_SOURCE_DIR}/man/lensfun-update-data.1.rst > ${CMAKE_CURRENT_BINARY_DIR}/lensfun-update-data.1
+-  COMMAND rst2man ${CMAKE_CURRENT_SOURCE_DIR}/man/lensfun-add-adapter.1.rst > ${CMAKE_CURRENT_BINARY_DIR}/lensfun-add-adapter.1
++  COMMAND rst2man-3.4.py ${CMAKE_CURRENT_SOURCE_DIR}/man/g-lensfun-update-data.1.rst > ${CMAKE_CURRENT_BINARY_DIR}/g-lensfun-update-data.1
++  COMMAND rst2man-3.4.py ${CMAKE_CURRENT_SOURCE_DIR}/man/lensfun-update-data.1.rst > ${CMAKE_CURRENT_BINARY_DIR}/lensfun-update-data.1
++  COMMAND rst2man-3.4.py ${CMAKE_CURRENT_SOURCE_DIR}/man/lensfun-add-adapter.1.rst > ${CMAKE_CURRENT_BINARY_DIR}/lensfun-add-adapter.1
+   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ )
+ 
+@@ -36,5 +36,5 @@
+     ${CMAKE_CURRENT_BINARY_DIR}/g-lensfun-update-data.1 
+     ${CMAKE_CURRENT_BINARY_DIR}/lensfun-update-data.1 
+     ${CMAKE_CURRENT_BINARY_DIR}/lensfun-add-adapter.1 
+-    DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1
++    DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
+ )
Index: files/patch-pkgconfig.diff
===================================================================
--- files/patch-pkgconfig.diff	(revision 133600)
+++ files/patch-pkgconfig.diff	(working copy)
@@ -1,13 +0,0 @@
---- build/tibs/compiler/pkgconfig.mak.orig	2010-03-23 09:32:47.000000000 +1300
-+++ build/tibs/compiler/pkgconfig.mak	2011-01-16 13:37:03.000000000 +1300
-@@ -3,8 +3,9 @@
- ifdef CONF_LIBDIR
- # Try to guess here if target supports pkgconfig
- # - Any POSIX platform
-+# - Macintosh
- # - Cross-compiling on a POSIX target for WINDOWS (mingw32)
--ifneq ($(findstring /posix/,/$(TARGET)/)$(findstring /posix-windows/,/$(HOST)-$(TARGET)/),)
-+ifneq ($(findstring /posix/,/$(TARGET)/)$(findstring /mac/,/$(TARGET)/)$(findstring /posix-windows/,/$(HOST)-$(TARGET)/),)
- 
- XFNAME.PKGCONFIG = $(addprefix $$(OUT),$1)
- MKDEPS.PKGCONFIG = $1
