Building On Mac OS X

From Synfig Studio :: Documentation
Jump to: navigation, search
(Build using the native GTK port)
 
(20 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{Title|Building On Mac OS X}}
 
<!--Categories-->
 
<!--Categories-->
[[Category:Building]]
+
{{Category|Building}}
  
There is currently no up-to-date build of Synfig for Mac OS X.
+
== Build using the native GTK port ==
 
+
== Build environment ==
+
 
+
Since these instructions assume one is using MacPorts, make sure the following environment variables are set accordingly:
+
 
+
<pre><nowiki>
+
export PATH="/opt/local/bin:$PATH"
+
export ACLOCAL_FLAGS="-I /opt/local/share/aclocal"
+
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
+
</nowiki></pre>
+
 
+
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:
 
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. [http://developer.apple.com/tools/xcode/ XCode])
 
* Mac OS X developer tools (i.e. [http://developer.apple.com/tools/xcode/ XCode])
* git ("git-core" port on macports)
+
* git ("git" on homebrew)
* subversion ("subversion" port on macports)
+
* subversion ("subversion" formula on homebrew)
* jhbuild
+
* Git clone of the synfig source code repository (https://github.com/synfig/synfig.git) - you can use [https://github.com/blackwarthog/synfig.git blackwarthog's] fork
* libxml++
+
* [http://developer.imendio.com/projects/gtk-macosx Imendio's GTK port]'s ".jhbuildrc" file
+
* Subversion checkout of "etl", "synfig-core", and "synfig-studio"
+
  
 
=== Boot strapping ===
 
=== Boot strapping ===
Line 32: Line 16:
 
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.
 
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:
+
This assumes you have the XCode developer tools installed. Next, you'll want to install the homebrew package manager. Visit [https://github.com/mxcl/homebrew/wiki/Installation the docs] for installation instructions. These will ''not'' work for Mac OS X Tiger users, so if you are on Tiger type at your command prompt:
 
+
 
<pre><nowiki>
 
<pre><nowiki>
su <other username>
+
curl -Lsf http://github.com/sceaga/homebrew/tarball/tiger | tar xz --strip 1 -C<your install directory, /usr/local/ recommended >
<type in other username's password>
+
 
</nowiki></pre>
 
</nowiki></pre>
  
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:
+
Now to install git and svn (assuming you've got the homebrew install directory in your path):
  
 
<pre><nowiki>
 
<pre><nowiki>
sudo port install git-core
+
brew install git
sudo port install subversion
+
brew install svn
 
</nowiki></pre>
 
</nowiki></pre>
  
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:
+
=== Compilig GTK and other dependencies ===
 +
 
 +
Then you can install "gtkmm" with homebrew:
  
 
<pre><nowiki>
 
<pre><nowiki>
svn co http://svn.gnome.org/svn/jhbuild/trunk jhbuild
+
brew install gtkmm
cd jhbuild && make -f Makefile.plain install
+
 
</nowiki></pre>
 
</nowiki></pre>
  
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:
+
You will also want gtk+:
 +
<pre><nowiki>
 +
brew install gtk+
 +
</nowiki></pre>
  
 +
Then you'll want libxml++, which is currently only available on the secondplanet fork of homebrew:
 
<pre><nowiki>
 
<pre><nowiki>
curl http://developer.imendio.com/svn/gtk-osx-build/jhbuildrc-gtk-osx > ~/.jhbuildrc
+
brew install libxml++
export PATH="/opt/gtk/bin:~/bin:$PATH"
+
sudo mkdir -p /opt/gtk && sudo chown <username>:<username> /opt/gtk
+
 
</nowiki></pre>
 
</nowiki></pre>
  
Now you can type in the following to build the bootstrap environment:
+
 
 +
=== Synfig itself (Using homebrew and X11)===
 +
 
 +
You should now be able to follow the {{L|Dev:Build_Instructions}} to compile ETL, synfig-core, and synfig-studio. The only difference, of course, are the prefixes. To make all this easier the building can be done with homebrew. First, make sure you have secondplanet's fork of homebrew from github:
  
 
<pre><nowiki>
 
<pre><nowiki>
jhbuild bootstrap
+
git clone git://github.com/secondplanet/homebrew ~/secondplanet-homebrew
 +
# if you installed libxml++ as instructed above, this will already exist. If so, there is no need to execute this command.
 +
cd ~/secondplanet-homebrew/
 
</nowiki></pre>
 
</nowiki></pre>
  
=== Compiling GTK and other dependencies ===
+
Then, build ETL by copying the etl formula and installing:
 
+
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.
+
  
 
<pre><nowiki>
 
<pre><nowiki>
jhbuild build gtkmm
+
cd ~/secondplanet-homebrew/
 +
git checkout -b etl remotes/secondplanet/etl
 +
cp Library/Formula/etl.rb <homebrew install directory>/Library/Formula/
 +
brew install etl
 
</nowiki></pre>
 
</nowiki></pre>
  
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:
+
Then (assuming you are still on secondplanet's fork:
  
 
<pre><nowiki>
 
<pre><nowiki>
curl -L http://ftp.gnome.org/pub/GNOME/sources/libxml++/2.19/libxml++-2.19.2.tar.gz > libxml++-2.19.2.tar.gz
+
git checkout -b synfig remotes/secondplanet/synfig
tar -xzf libxml++-2.19.2.tar.gz
+
cp Library/Formula/synfig.rb <homebrew install directory>/Library/Formula/
cd libxml++-2.19.2 && ./configure --prefix=/opt/gtk && make && sudo make install
+
brew install synfig
 
</nowiki></pre>
 
</nowiki></pre>
  
Optionally you might also want to grab and build [http://www.openexr.com/ OpenEXR]. This should of course be a simple configure, make, make install job like libxml++.
+
And the same for synfigstudio:
  
=== Synfig itself ===
+
<pre><nowiki>
 
+
git checkout -b synfigstudio remotes/secondplanet/synfigstudio
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 --exec-prefix=/opt/gtk" to the "./configure" options when building each package.
+
cp Library/Formula/synfigstudio.rb <homebrew install directory>/Library/Formula/
 +
brew install synfigstudio
 +
</nowiki></pre>
  
 
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:
 
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:
Line 95: Line 88:
 
</nowiki></pre>
 
</nowiki></pre>
  
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.
+
'''WORK IN PROGRESS''':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. Some parts of these instructions are incomplete and are often changing. The package for etl is not part of the main homebrew fork as of this time, and neither are any other synfig packages.
  
'''TODO''': Describe how to properly package everything into an .app.
+
'''TODO''': Describe how to properly package everything into an .app. <strike>Describe how to build "synfig" and "synfig-studio" with homebrew.</strike> Describe build process w/ gtk-osx.
  
 
=== Issues ===  
 
=== Issues ===  
Line 109: Line 102:
 
* No input devices are enumerated by GTK.
 
* 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.
 
* 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.
 
  
[[Image:Picture1kd1.jpg|Obligatory screen shot]]
+
[[File:Synfig_mac_X11.png|800px]]
 
+
== 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:
+
 
+
<pre><nowiki>
+
sudo port install gtkmm libxmlxx2
+
</nowiki></pre>
+
 
+
This will also install all the other dependencies (such as X11), so it make take some time to compile.
+
 
+
You need to set PKG_CONFIG_PATH so that the ETL and synfig-core header files and libraries can be found:
+
 
+
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
+
 
+
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 [[Building_On_Mac_OS_X#Boot_strapping|Boot strapping]] section up to and including the 'jhbuild bootstrap' line and make sure "/opt/gtk/bin" is first in your $PATH in order to properly compile etl,  synfig-core and synfig-studio.
+
 
+
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.
+
 
+
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:
+
 
+
<pre><nowiki>
+
synfigstudio
+
</nowiki></pre>
+
 
+
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.
+
  
 
== Troubleshooting ==
 
== Troubleshooting ==
Line 145: Line 109:
 
=== no "awk" ===
 
=== no "awk" ===
  
If you get an error during building MacPorts ports complaining that a program called "awk" cannot be found, then you should install the 'gawk' port like so:
+
If you get an error during building homebrew formulae complaining that a program called "awk" cannot be found, then you should install the 'gawk' formula like so:
  
 
<pre><nowiki>
 
<pre><nowiki>
sudo port install gawk
+
brew install gawk
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 156: Line 120:
  
 
<pre><nowiki>
 
<pre><nowiki>
$ jhbuild glibmm
+
$ jhbuild meta-gtk-osx-core
jhbuild glibmm: no command found
+
jhbuild meta-gtk-osx-core: no command found
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 163: Line 127:
  
 
<pre><nowiki>
 
<pre><nowiki>
jhbuild build glibmm
+
jhbuild build meta-gtk-osx-core
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 188: Line 152:
 
If you're using native GTK+, change "/opt/local" to "/opt/gtk".
 
If you're using native GTK+, change "/opt/local" to "/opt/gtk".
  
=== other problems building via jhbuild ===
+
==Multiple X11's==
 
+
If you get an error about display ports, you likely have multiple X11's installed. Just open up your favorite, click on the Applications > Customize… option, and then add an application with the name "synfigstudio" and command "synfigstudio" (w/out the quotes).
Solving other issues with building packages in jhbuild is beyond the scope of this document as all of the packages are still under development by their respective authors.
+

Latest revision as of 17:59, 18 October 2015

Build 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:

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.

This assumes you have the XCode developer tools installed. Next, you'll want to install the homebrew package manager. Visit the docs for installation instructions. These will not work for Mac OS X Tiger users, so if you are on Tiger type at your command prompt:

curl -Lsf http://github.com/sceaga/homebrew/tarball/tiger | tar xz --strip 1 -C<your install directory, /usr/local/ recommended >

Now to install git and svn (assuming you've got the homebrew install directory in your path):

brew install git
brew install svn

Compilig GTK and other dependencies

Then you can install "gtkmm" with homebrew:

brew install gtkmm

You will also want gtk+:

brew install gtk+

Then you'll want libxml++, which is currently only available on the secondplanet fork of homebrew:

brew install libxml++


Synfig itself (Using homebrew and X11)

You should now be able to follow the Build Instructions to compile ETL, synfig-core, and synfig-studio. The only difference, of course, are the prefixes. To make all this easier the building can be done with homebrew. First, make sure you have secondplanet's fork of homebrew from github:

git clone git://github.com/secondplanet/homebrew ~/secondplanet-homebrew 
# if you installed libxml++ as instructed above, this will already exist. If so, there is no need to execute this command.
cd ~/secondplanet-homebrew/

Then, build ETL by copying the etl formula and installing:

cd ~/secondplanet-homebrew/
git checkout -b etl remotes/secondplanet/etl
cp Library/Formula/etl.rb <homebrew install directory>/Library/Formula/
brew install etl

Then (assuming you are still on secondplanet's fork:

git checkout -b synfig remotes/secondplanet/synfig
cp Library/Formula/synfig.rb <homebrew install directory>/Library/Formula/
brew install synfig

And the same for synfigstudio:

git checkout -b synfigstudio remotes/secondplanet/synfigstudio
cp Library/Formula/synfigstudio.rb <homebrew install directory>/Library/Formula/
brew install synfigstudio

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

WORK IN PROGRESS: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. Some parts of these instructions are incomplete and are often changing. The package for etl is not part of the main homebrew fork as of this time, and neither are any other synfig packages.

TODO: Describe how to properly package everything into an .app. Describe how to build "synfig" and "synfig-studio" with homebrew. Describe build process w/ gtk-osx.

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.
  • Sometimes mouse focus on windows is lost. To solve this, try moving the affected window. Failing that, you should still be able to use the keyboard to navigate.
  • 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.

Synfig mac X11.png

Troubleshooting

no "awk"

If you get an error during building homebrew formulae complaining that a program called "awk" cannot be found, then you should install the 'gawk' formula like so:

brew install gawk

"no command found" when running jhbuild

When using jhbuild, you might get an error back like this:

$ jhbuild meta-gtk-osx-core
jhbuild meta-gtk-osx-core: no command found

This is because you need to specify the "build" command when building a package, like so:

jhbuild build meta-gtk-osx-core

problem building "doxygen" via jhbuild

When building doxygen, you may get an error during the build process mentioning "lipo" failed to find a file. To fix this, you should go into the shell (option 4) when prompted, and enter the following:

./configure --prefix /opt/gtk --platform macosx-c++ --install /usr/bin/install
make && exit

Then when prompted again, choose "ignore error and continue to build" (option 2).

problems with external libraries

If your build doesn't find external graphics libraries (such as libpng), but you know they're installed, you may need to set some additional environment variables, like so:

export CPPFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib

If you're using native GTK+, change "/opt/local" to "/opt/gtk".

Multiple X11's

If you get an error about display ports, you likely have multiple X11's installed. Just open up your favorite, click on the Applications > Customize… option, and then add an application with the name "synfigstudio" and command "synfigstudio" (w/out the quotes).