RESUME
------
Scripts to build binary digiKam packages for MacOS

This scripts build a binary digiKam package for MacOS using Macports 
environnement and Package application.

This script follow instructions from Qt bundle deployement for MacOS as shared libraries
available at this url: http://doc.qt.io/qt-5/osx-deployment.html

AUTHORS
-------
(c)      2015 by Shanti <listaccount at revenant dot org>
(c) 2015-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>

DESCRIPTION
-----------
These files and scripts are used to make binary packages of the digiKam
Software Collection for MacOS. In addition to this README, there are
comments in the scripts that provide some additional explanation for how they
work.

BUNDLE CONTENTS
---------------

Note : the bundle is not rellocable.

   |-- Applications
   |   |-- KF5                                Binary applications directories (digiKam and Showfoto)
   |       |-- digikam.app
   |       |   |-- Contents
   |       |       |-- MacOS
   |       |       |-- Resources              Shared data files (marble, i18n, etc...)
   |       |-- showfoto.app
   |           |-- Contents
   |               |-- MacOS
   |               |-- Resources              ==> symbolic link to Applications/KF5/digikam.app/Contents/Resources
   |-- digiKam                                Link to OSX desktop with scripts.
   |   |-- digikam.app
   |       |-- Contents
   |          |-- MacOS
   |          |-- Resources
   |              |-- Scripts
   |     showfoto.app
   |     |-- Contents
   |         |-- MacOS
   |         |-- Resources
   |             |-- Scripts
   |-- bin                                    Extra binaries
   |-- etc                                    Really need ?
   |   |-- xdg
   |       |-- ui
   |-- lib                                    Shared libraries
   |   |-- mysql56
   |       |-- mysql
   |-- libexec                                Run-times libraries and plugins
   |   |-- qt5
   |       |-- lib
   |       |   |-- QtConcurrent.framework
   |       |   |-- QtCore.framework
   |       |   |-- QtDBus.framework
   |       |   |-- QtGui.framework
   |       |   |-- QtLocation.framework
   |       |   |-- QtMultimedia.framework
   |       |   |-- QtMultimediaWidgets.framework
   |       |   |-- QtNetwork.framework
   |       |   |-- QtOpenGL.framework
   |       |   |-- QtPositioning.framework
   |       |   |-- QtPrintSupport.framework
   |       |   |-- QtQml.framework
   |       |   |-- QtQuick.framework
   |       |   |-- QtScript.framework
   |       |   |-- QtSensors.framework
   |       |   |-- QtSql.framework
   |       |   |-- QtSvg.framework
   |       |   |-- QtWebChannel.framework
   |       |   |-- QtWebKit.framework
   |       |   |-- QtWebKitWidgets.framework
   |       |   |-- QtWidgets.framework
   |       |   |-- QtXml.framework
   |       |   |-- QtXmlPatterns.framework
   |       |-- plugins                              Qt and KF5 plugins
   |           |-- audio
   |           |-- geoservices
   |           |-- iconengines
   |           |-- imageformats
   |           |-- mediaservice
   |           |-- platforms
   |           |-- position
   |           |-- printsupport
   |           |-- sqldrivers


REQUIREMENTS
------------
The scripts build digiKam with MacPorts, so you will need Xcode and the other
prerequisites for Macports. To install it for MacOS versions 10.7 and later,
download Xcode from the AppStore:

http://itunes.apple.com/us/app/xcode/id497799835?mt=12

NOTE: since Xcode 4.3.2, you need to install Xcode Command Line Tools extension package to be able to
use Macport on your computer.
Run Xcode and got to Preference menu entry, Download section, and install Command Line Tools component.
See this url for details : http://guide.macports.org/#installing.xcode.

For all other Macports requirement, see http://www.macports.org/install.php.

You will also need to install Packages software from which does the actual packaging of the files needed to install digiKam:

http://s.sudre.free.fr/Software/Packages/about.html

IMPORTANT:
- You must set the minimal OSX target with relevant SDK installed for backward compatibility.
- You must set the digiKam git tags to checkout right source code to package.
Look in config.sh file for details.

HERE THERE BE DRAGONS
---------------------
Use these scripts at your own risk. For example, both scripts contain
"rm -rf" (to clear previous builds) -- a mistake could wipe your drive. There
is little error checking or validation. I make no claims to be compentent at
coding or packaging, or to the suitability or saftety of the scripts or
software compiled/packaged using them.

COMPONENTS
----------
There are 4 scripts to be run by the user. 2 first ones installs
MacPorts and all dependencies, next one digiKam, and last one makes a
PKG binary installer for MacOS.

SCRIPT DESCRIPTIONS
-------------------
All scripts should be run from within the digikam-package directory.

* 01-build-macports.sh:

This script downloads and configures a custom non-root install
of MacPorts to /opt/digikam. The PKG will install to the same place,
avoiding the confusion associated with relocation and install_name_tool. The
custom location, as opposed to /opt/local, should allow digiKam to co-exist
with a standard Macports installation

* 02-build-extralibs.sh:

This script configures, and compile a custom non-root install to /opt/digikam
of extra libraries, including KF5 frameworks, and most important photo management
libs used by digiKam as Exiv2 and LensFun.

* 03-build-digikam.sh:

This script configures, and compile a custom non-root install of digiKam to
/opt/digikam.

* 04-build-installer.sh:

Once you've successfully built digiKam, /opt/digikam may contain over 10GB of files.
This script grabs the ~250MB needed to run digiKam and Showfoto,
and places them in ./installer/opt. These include applications documentations
and translations.

This script creates Applescript launch applications for the programs that will
be run by the user (digiKam, Showfoto, etc), and preinstall/postinstall
scripts in ./installer.

The launcher applications:
     1) load dbus-session with launchctl if it isn't already loaded
     2) launch kded if it isn't already running and
     3) set "DYLD_IMAGE_SUFFIX=_debug" if the digikam port was built with  the
       +debug variant.

this script also create the pre-install and post-install scripts that are run
when the package is installed. They delete any pre-existing /opt/digikam,
delete and recreate /Applications/digiKam.

Finally, this script sets the version number, and runs Packages to
put everything together.

* rll.py

Run by 04-build-installer.sh. It is a Python script that takes a list of binaries
and libraries supplied by 04-build-installer.sh and recursively lists the dylibs on
which they depend, and their dependencies, etc.. Adapted with minimal
modification (mostly deleting stuff) from
https://github.com/mixxxdj/mixxx/blob/master/build/osx/otool.py.

* makeall.sh

This script permit to build whole package from scratch.

LICENSES
--------
rll.py, like the otool.py source from which it has been adapted, is licensed
under GNU General Public License version 2.

The scripts and other contents of this package that I have created are licensed
licensed under the GNU General Public License version 2, or any later version.
