The official build instructions are located on the XTrkCAD Model RR Track Planner Wiki. These are my working instructions for building. I am still fine tuning these.
Prerequisites
Install Xcode.
Install Xcode Command Line Tools.
Install XQuartz.
Install MacPorts.
Install the following ports from the Terminal using the command sudo port install [portname] for each port:
cmake-gui
gtk2
libzip
freeimage
cmocka
mxml
inkscape
zlib
dbus (runtime dependency)
webkit2-gtk (required to build with the AppleHelp system)
python27 (dependency for gtk-mac-bundler and mercurial)
gtk-mac-bundler (required to package the application within a DMG file for distribution)
mercurial
tortoisehg
Make working directories using the following commands from the Terminal:
mkdir ~/src
mkdir -p ~/build/xtrkcad
mkdir -p ~/install/xtrkcad
Configure Build Environment
NOTE: The first two settings are probably overkill and not necessary for compiling xtrkcad. The third one is mandatory. The fourth one will suppress a mess o’ warnings while inkscape is processing graphics and is optional. You can set these from the Terminal before compiling but adding them to your profile will make them permanent.
If you are using sh as your shell, add the following lines to ~/.profile:
export C_INCLUDE_PATH=/opt/local/include
export CPLUS_INCLUDE_PATH=/opt/local/include
export LIBRARY_PATH=/opt/local/lib
export NO_AT_BRIDGE=1
Then run the following command from the Terminal to reload your profile:
source ~/.profile
If you are using zsh as your shell, add the following lines to ~/.zprofile:
export C_INCLUDE_PATH=/opt/local/include
export CPLUS_INCLUDE_PATH=/opt/local/include
export LIBRARY_PATH=/opt/local/lib
export NO_AT_BRIDGE=1
Then run the following command from the Terminal to reload your profile:
source ~/.zprofile
Fetch Source Code
Fetch source code using the following commands from the Terminal:
cd ~/src
hg clone http://hg.code.sf.net/p/xtrkcad-fork/xtrkcad
Update the source code to the branch you want to build (e.g. v5.3.0) using the following commands from the Terminal:
cd ~/src/xtrkcad
hg update [branch]
Configure the Build
Open CMake App and configure as follows:
Click Browse Source and navigate to your source directory (e.g. /Users/[username]/src/xtrckcad)
Click Browse Build and navigate to your build directory (e.g. /Users/[username]/build/xtrkcad)
Click Configure and click Done
(Optional) Set CMAKE_BUILD_TYPE as required
Set CMAKE INSTALL_PREFIX to your install directory (e.g. /Users/[username/install/xtrkcad)
Select either XTRKCAD_USE_APPLEHELP or XTRKCAD_USE_BROWSER
I have not been able to successfully compile with the Apple Help system, only browser help.
Make sure XTRKCAD_USE_GTK is selected
Click Configure
Make sure there are not items in red or errors.
Click Generate
Build
Run the following commands from the Terminal:
cd ~/build/xtrkcad
make clean
make
Install
Run the following command from the Terminal:
make install
Test
Run the following commands from the Terminal:
cd ~/install/xtrkcad/bin
./xtrkcad
Make sure the program functions as expected.
Exit the program.
Package
Run the following commands from the Terminal using the version you want:
cd ~/build/xtrkcad/distribution/osx/gtk-bundle
bash xtrkcad-bundler.sh -i ~/install/xtrkcad -v [version]
A compressed disk image will be created in the bin folder within the install directory (e.g. /Users/[username]/install/bin) with the filename xtrkcad-OSX-[version].dmg.tar.gz.
Double-click on the file to extract the disk image.
I am still having problems with an empty disk image.