Dev:Building On Mac OS X

From Synfig Studio :: Documentation
Revision as of 01:44, 12 September 2007 by Dooglus (Talk | contribs) (Using X11: link 'boot strapping)

Jump to: navigation, search

There is currently no up-to-date build of Synfig for Mac OS X.

Build environment

Since these instructions assume one is using MacPorts, make sure the following environment variables are set accordingly:

export PATH="/opt/local/bin:$PATH"
export ACLOCAL_FLAGS="-I /opt/local/share/aclocal"
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"

There seem to be two ways of building GTK applications for OS X:

Using the native GTK port

In order to build Synfig natively on Mac OS X using the native GTK port (as opposed to using X11), you will require the following:

  • Mac OS X developer tools (i.e. XCode)
  • git ("git-core" port on macports)
  • subversion ("subversion" port on macports)
  • jhbuild
  • libxml++
  • Imendio's GTK port's ".jhbuildrc" file
  • Subversion checkout of "etl", "synfig-core", and "synfig-studio"

Boot strapping

First of all make sure you have a Terminal window open. This will be used in order to perform all the steps necessary to compile synfig.

You might also want to compile as a different user, as one tool used, "jhbuild", requires files to be placed in the current user's home directory. This can be done by typing the following into the terminal:

su <other username>
<type in other username's password>

I shall assume you only have XCode and MacPorts installed. In order to get subversion and git, you should be able to type the following into the terminal:

sudo port install git-core
sudo port install subversion

Assuming MacPorts installed subversion and git correctly, you'll now need to grab and compile a copy of jhbuild from the gnome repository, which can be done like so:

svn co http://svn.gnome.org/svn/jhbuild/trunk jhbuild
cd jhbuild && make -f Makefile.plain install

You will also need the .jhbuildrc file from Imendio. It is also a good idea to ensure your PATH contains your "~/bin" directory and "/opt/gtk/bin", the latter being important when you start to build everything else. Finally, make sure that "/opt/gtk/" exists and is owned by your build user:

curl http://developer.imendio.com/svn/gtk-osx-build/jhbuildrc-gtk-osx > ~/.jhbuildrc
export PATH="/opt/gtk/bin:~/bin:$PATH"
sudo mkdir -p /opt/gtk && chown <username>:<username> /opt/gtk

Now you can type in the following to build the bootstrap environment:

jhbuild bootstrap

Compiling GTK and other dependencies

Assuming jhbuild has finished building all of the bootstrap lib's and such, you will not have to tell it to build "gtkmm", which is the C++ interface to GTK.

jhbuild gtkmm

This will also build GTK and all of its dependencies. However it falls short of providing another dependency which Synfig requires, which is libxml++. This can be grabbed and built as follows:

curl -L http://ftp.gnome.org/pub/GNOME/sources/libxml++/2.19/libxml++-2.19.2.tar.gz > libxml++-2.19.2.tar.gz
tar -xzf libxml++-2.19.2.tar.gz
cd libxml++-2.19.2 && ./configure --prefix=/opt/gtk && make && sudo make install

Optionally you might also want to grab and build OpenEXR. This should of course be a simple configure, make, make install job like libxml++.

Synfig itself

You should now be able to follow the Build instructions to compile ETL, synfig-core, and synfig-studio. The only thing different you should do is add "--prefix=/opt/gtk" to the "./configure" options when building each package.

Assuming you manage to build it correctly, you should now be able to type the following in order for Synfig to pop up on your desktop:

synfigstudio

Note though that this isn't the end of the story: we still need to package everything up into an .app so that the more sane of us can run Synfig without having to resort to opening a terminal.

TODO: Describe how to properly package everything into an .app.

Issues

There are currently numerous issues with Synfig with Imendio's GTK port. Watch out for:

  • Window focus can sometimes be lost. If this happens, just select a window from another Mac OS X app and then select the Synfig window again.
  • Menus do not function correctly.
  • The file browser doesn't work, so you have to load files from startup.
  • No input devices are enumerated by GTK.
  • XCode project files exist, but they are currently broken. Thus we just use the terminal to compile everything.
  • Because we made the prefix "/opt/gtk", synfig will go looking for interface images there, which obviously won't quite work right if we want to package everything into an .app.

Obligatory screen shot

Using X11

In order to compile synfig for X11, you will need to install gtkmm and libxml++ via MacPorts (or Fink). This can be done as follows:

sudo port install gtkmm libxmlxx2

This will also install all the other dependencies (such as X11), so it make take some time to compile.

You should now be able to follow the Build instructions to compile ETL, synfig-core, and synfig-studio. The only thing different you should do is add "--prefix=/opt/local --exec-prefix=/opt/local" to the "./configure" options when building each package.

In addition, for some unknown reason compiling ETL, synfig-core and synfig-studio doesn't work properly when using MacPorts auto* tools. However, it does work with the bootstrap toolset used to compile Imendio's native GTK port. So it is suggested that you follow the Boot strapping section and make sure "/opt/gtk/bin" is first in your $PATH in order to properly compile etl, synfig-core and synfig-studio.

Assuming you manage to build it correctly, you should now be able to type the following in order for Synfig to pop up on your desktop:

synfigstudio

Note though that this isn't the end of the story: we still need to package everything up into an .app so that the more sane of us can run Synfig without having to resort to opening a terminal.

TODO: Describe how to properly package everything into an .app.