QMapShack (QMS) build process for Mac
The build process relies on a fixed local build environment. The root directory of the local build environment must be empty and referenced as $QMSDEVDIR
This directory contains sub-directories while building:
- routino* : for downloading and building Routino
- proj : for downloading and building PROJ
- gdal : for downloading and building GDAL
- local : contains all files and directories installed by locally built packages
- qmapshack : QMS source downloaded from git
- build_qmapshack : directory were the QMS build process itself happens
- release : contains the created app bundles
Local packages to be built are:
- Routino
- GDAL : if config.sh contains
BUILD_GDAL="x" - PROJ : if config.sh contains
BUILD_PROJ="x"
All other packages are taken from HomeBrew package manager.
The HomeBrew package manager is the package manager of choice.
The package manager MacPorts is also supported.
All packages are taken from MacPorts and no local packages are built.
Important script variables:
- QMSDEVDIR (mandatory)
the build environment - BUILD_RELEASE_DIR (optional)
the location where the app bundles are created
Parameters to configure build:
- XCODE_PROJECT (optional) : Can be set with
-xon the command line
If set, create an XCode project instead of building QMS - BREW_PACKAGE_BUILD : Can be set with
-bon the command line
If set, creates QMS as an app relying on HomeBrew packages on runtime
HomeBrew packages are listed in install-brew-packages.sh - MACPORTS_BUILD : Can be set with
-mon the command line
If set, all packages are taken from MacPorts and no local packages are built - BUILD_GDAL (optional) : Can be set with
-gon command line
If set, build GDAL instead of using the HomeBrew package
To run the complete build process:
- Create a directory and cd into this directory.
This directory will be referenced as $QMSDEVDIR - Clone git repository https://github.com/Maproom/qmapshack.git
- Check build parameters in ./qmapshack/MacOSX/config.sh
- Run
sh ./qmapshack/MacOSX/build-all.sh | tee log.txt - ATTENTION: Manual intervention is needed for applying admin password while changing dylibs (Apple requirement)
- Check log.txt if an error occurred
- After successful built, the app bundles are located in the release folder
- Check brew*.diff for packages installed by HomeBrew during build process
and uninstall them if not needed anymore.
Contents of this folder MacOSX
Folders:
- archive : Outdated scripts to be deleted soon
- resources : Resources like icons, info.plist specifically needed for macOS
Scripts for the overall build process:
- build-all.sh : Automatically builds QMapShack. (calls sub build scripts, more modular)
The only manual intervention is to pass the admin password for changing paths in dylibs
Scripts for partial steps of the build process:
- install-brew-packages.sh : Installs HomeBrew (if needed) and packages for the build process.
Package files are also copied to local environment - build-routino.sh : Builds Routino
- build-gdal.sh : Builds GDAL
- build-proj.sh : Builds PROJ
- build-otoolrecursive.sh : Builds otoolrecursive, a tool for recursively chasing down dylibs dependencies
- build-QMS.sh : Compiles QMapShack
- bundle-all.sh : The complete bundling process (calls (in)directly the other bundle scripts).
Should be called, when everything is built but not yet bundled (build-all.sh includes this script). - bundle-qmapshack.sh : Bundles the app QMapShack
- bundle-qmaptool.sh : Bundles the app QMapTool
- bundle.sh : Bundles and signs QMapShack
- config.sh : Checks for a valid build directory and contains the variables driving the build process
- clean.sh : Cleans all build artifacts, except for brew*diff.txt (which lists HomeBrew packages installed for the build process)
- create_local_env : Creates a local environment where all external libs/packages can be saved
Idea: The libs can be downloaded via package managers and copied or directly downloaded from the internet. From now on, subsequent build processes are based on independent libraries distributed across the file system. Build processes, like bundling still need to be adapted (WiP). - install-packages.sh : Installs packages for the build process