How to make disk image with darktable application bundle (64 bit Intel only):

1). Install MacPorts (instructions and prerequisites can be found on official website), please use default installation path (/opt/local).
    They will need some tuning, so before you build anything add these lines to /opt/local/etc/macports/macports.conf:
     buildfromsource always
     macosx_deployment_target 10.7
     cxx_stdlib libc++
    (practice showed that support for versions older than 10.7 isn't viable)
    and this line to /opt/local/etc/macports/variants.conf:
     +no_gnome +no_x11 +quartz -x11 -gnome +ld64_xcode
    You will also need to add several patches:
     $ mkdir -p ~/ports/lang/python34/files ~/ports/lang/python35/files ~/ports/graphics/GraphicsMagick/files
     $ cp -R /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/python34 ~/ports/lang
     $ curl -Lo ~/ports/lang/python34/files/patch.diff https://raw.github.com/darktable-org/darktable/master/packaging/macosx/python34-stack_size.diff
     $ cp -R /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/python35 ~/ports/lang
     $ curl -Lo ~/ports/lang/python35/files/patch.diff https://raw.github.com/darktable-org/darktable/master/packaging/macosx/python35-stack_size.diff
     $ cp -R /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/GraphicsMagick ~/ports/graphics
     $ curl -Lo ~/ports/graphics/GraphicsMagick/files/patch.diff https://raw.github.com/darktable-org/darktable/master/packaging/macosx/gm-deployment_target.diff
    then add this line:
     patchfiles-append patch.diff
    to ~/ports/*/*/Portfile files you just copied and run
     $ portindex ~/ports
    Add "file:///Users/<username>/ports" (change <username> to your actual login) to /opt/local/etc/macports/sources.conf before [default] line.
    Install required dependencies (be aware of this bug though: https://trac.macports.org/ticket/51736):
     $ sudo port install git exiv2 libgphoto2 gtk-osx-application-gtk3 lensfun librsvg libsoup openexr json-glib flickcurl GraphicsMagick openjpeg lua52 webp libsecret pugixml osm-gps-map adwaita-icon-theme
    To have working OpenMP (at least partly, only for C source files) you will also need gcc6:
     $ sudo port install gcc6
    (llvm port, which gets installed as dependency, won't compile with macosx_deployment_target set, so comment it out when llvm is built)
    Clone darktable git repository (in this example into ~/src):
     $ mkdir ~/src
     $ cd ~/src
     $ git clone git://github.com/darktable-org/darktable.git
    Finally build and install darktable:
     $ cd darktable
     $ mkdir build
     $ cd build
     $ CC=gcc-mp-6 cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DBINARY_PACKAGE_BUILD=ON
     $ make
     $ sudo make install
    After this darktable will be installed in /usr/local directory and can be started by typing "XDG_DATA_DIRS=/opt/local/share darktable" in terminal.

2). Download, patch and install gtk-mac-bundler (assuming darktable was cloned into ~/src directory):
     $ cd ~/src
     $ curl -O http://ftp.gnome.org/pub/gnome/sources/gtk-mac-bundler/0.7/gtk-mac-bundler-0.7.4.tar.xz
     $ tar -xf gtk-mac-bundler-0.7.4.tar.xz
     $ cd gtk-mac-bundler-0.7.4
     $ patch -p1 < ../darktable/packaging/macosx/gtk-mac-bundler-0.7.4.patch
     $ make install

3). Now preparation is done, run image creating script, it should create darktable-<VERSION>.dmg in current (packaging/macosx) directory:
     $ cd ~/src/darktable/packaging/macosx
     $ ./make-app-bundle
    If you have an Apple Developer ID Application certificate and want to produce signed app then replace the previous command with this one:
     $ CODECERT="Developer ID Application" ./make-app-bundle
    You may have to provide more specific name for a certificate if you have several matching in your keychain.

4). Assuming that darktable is the only program installed into /usr/local you should remove the install directory before doing next build:
     $ sudo rm -Rf /usr/local
