Preface

This guide covers therion 5.3.10 installation on OS X 10.8 Mountain Lion.

We will need

wxWidgets 2.8 will not build on OS X 10.8 - http://lists.macosforge.org/pipermail/macports-users/2012-August/030346.html - so we are forced to use development 2.9 version

:!: Warning: Loch is not working correctly - I am currently not able to open any file

Homebrew

Homebrew is package manager for OS X - Wikipedia

In comparison to other package managers like Fink or MacPorts Homebrew works hard to avoid package duplication - Homebrew compiles its packages against libraries built into OS X.

Install Homebrew - see instructions on http://mxcl.github.com/homebrew/

Install MacTeX package from http://www.tug.org/mactex/

Run following commands in Terminal:

brew install lcdf-typetools
brew install wxmac
brew install freetype
brew install vtk

Building therion/xtherion/loch

Download therion source code from http://therion.speleo.sk/download.php

Extract tarball to ~/Downloads

Preparation

In Terminal run:

sudo mkdir /usr/X11/include
sudo ln -s /System/Library/Frameworks/OpenGL.framework/Headers /usr/X11/include/GL

Now we need to customize several files

Edit ~/Downloads/therion/Makefile

replace line 65:

POBJECTS = extern/getopt.o extern/getopt1.o extern/getline.o

with:

POBJECTS = extern/getopt.o extern/getopt1.o

Edit ~/Downloads/therion/loch/lxFile.cxx

replace section starting on line 22:

#if defined LXWIN32 || defined LXMACOSX || defined THWIN32 || defined THMACOSX
#include "getline.h"
#endif

with:

#if defined LXWIN32 || defined THWIN32
#include "getline.h"
#endif

Edit ~/Downloads/therion/loch/Makefile

replace section starting on line 9 with:

VTKVERSION = 5.10
#VTKVERSION = $(shell tclsh getvtkver.tcl version)
VTKPATH = /usr/local/include/vtk-$(VTKVERSION)
#VTKPATH = $(shell tclsh getvtkver.tcl incpath)
VTKLIBPATH = /usr/local/lib/vtk-$(VTKVERSION)
#VTKLIBPATH = $(shell tclsh getvtkver.tcl libpath)
VTKLIBS = -lvtkHybrid -lvtkImaging -lvtkIO -lvtkGraphics -lvtkFiltering -lvtkCommon -lvtkjpeg -lvtkpng -lvtkzlib -lvtksys -lfreetype
POSTMAKE =
STRIPFLAG = -s

replace section starting on line 54 with:

# PLATFORM MACOSX
CXX = c++
CC = cc
POBJECTS =
CXXPFLAGS = -W -Wall -DLXMACOSX $(shell wx-config --cxxflags) -I$(VTKPATH) -Wno-deprecated -I/usr/X11R6/include $(shell freetype-config --cflags)
CCPFLAGS = -W -Wall -DLXMACOSX $(shell wx-config --cflags) -I/usr/X11R6/include
LXLIBDIR = 
PLIBS = -lz -L/usr/X11R6/lib $(shell wx-config --libs --gl-libs) -L$(VTKLIBPATH) $(VTKLIBS)
POSTMAKE = cp -f ./loch ./loch.app/Contents/MacOS
STRIPFLAG =

Edit ~/Downloads/therion/loch/lxOGLFT.cxx

Replace line 474:

bbox = measure( s.GetChar( 0 ) );

with:

bbox = measure((const wxChar) s.GetChar( 0 ) );

Replace line 478:

BBox char_bbox = measure( s.GetChar( i ) );

with:

BBox char_bbox = measure((const wxChar) s.GetChar( i ) );

Replace line 657:

compile( s.GetChar( i ) );

with:

compile((const wxChar) s.GetChar( i ) );

Replace line 780:

draw( s.GetChar( i ) );

with:

draw((const wxChar) s.GetChar( i ) );

Edit ~/Downloads/therion/loch/lxSTree.cxx

Replace line 55:

: wxMiniFrame(parent, wxID_ANY, _(" Selection"),wxDefaultPosition, wxDefaultSize, (wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxRESIZE_BOX | wxRESIZE_BORDER) & (~(wxMINIMIZE_BOX | wxMAXIMIZE_BOX)))

with:

: wxMiniFrame(parent, wxID_ANY, _(" Selection"),wxDefaultPosition, wxDefaultSize, (wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) & (~(wxMINIMIZE_BOX | wxMAXIMIZE_BOX)))

Compilation

In Terminal run:

cd ~/Downloads/therion
make config-macosx
make
cd loch
make
cd ..
sudo make install

Final steps

Copy ~/Downloads/therion/loch/loch.app to Applications folder