Howto build Synfig Studio on MacOSX (10.9.x) via macport

This is a quick instruction to build Synfig Studio on OSX via MacPort, and I add some additional development tools for my personal use.

If you get trubles while following this recipe, please read the original post, or post your question here, I will try my best to help. It is really simple, you can just open your terminal and copy those command listed below and hit [Enter] and then you will get a newest Synfig Studio for OSX.

0) Some tools you need before we start
Xcode and its command tools, SourceTree , Sublime Text 2 , iTerm2

Xcode: You can install it via App Store
Xcode command tools: open a terminal and run: xcode-select --install
The below three apps are optional.
SourceTree: the GUI tool of GIT on OSX, you can get it from App Store
Sublime Text 2: the best(?) text editor on OSX, I use it as my source editor
iTerm2: the best(?) terminal on OSX

1) macport: guide.macports.org/chunked/insta … ports.html
download the latest version, install following the installation instruction in above page.

2) selfupdate the macport: guide.macports.org/chunked/using.html#using.port
sudo port selfupdate port list

3) search / list packages
sudo port list sudo port search
sometimes you need clean option when your installation was terminated for some reasones and you can not continue
sudo port clean your-pack

4) install cairo and other libs
sudo port install cario cairomm gtk2 gtkmm libxmlxx2
install build tools
sudo port install intltool ccache boost
install output target libs (optional)
sudo port install libpng imagemagick ffmpeg

	if you don't have sourceTree install you have to install git
	[code]
	sudo port install git-core git-extras
	[/code]

5) fetch the synfig source tree
prepare the folder under your home:
mdkir ~/Source && cd ~/Source

	fetch the code of Synfig Studio
	[code]
	git clone git://github.com/synfig/synfig.git
	[/code]

6) Now you’re almost ready to build your Synfig Studio Binary, copy the below code into your favor text editor (Subline Text 2, for example), save as build-synfig.sh under ~/Source/

#!/bin/sh
CPUS=4
cd synfig
prefix=$(pwd)/install
export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
export ACLOCAL_FLAGS="-I $prefix/share/aclocal"
export PATH=$(pwd)/synfig-core/src/tool/.libs:$PATH
export CXX="/opt/local/bin/ccache /usr/bin/g++"
export CPPFLAGS="-I/opt/local/include"
export LDFLAGS="-L/opt/local/lib"

cd ETL &&
autoreconf --install --force &&
./configure --prefix $prefix &&
make --debug=b install &&
\
cd ../synfig-core &&
glibtoolize --copy --force &&
autoreconf --install --force &&
./configure --prefix $prefix --enable-optimization=0 --enable-debug &&
make --debug=b -j $CPUS install &&
\
cd ../synfig-studio &&
autoreconf --install --force &&
make --debug=b -j $CPUS install

7) Start your building:
sh build-synfig.sh

8 ) If everyting just works fine, you can test your new Synfig Studio:
~/Source/synfig/install/bin/synfigstudio