Difference between revisions of "CompilingMacOsX"
m (→Requirements) |
(Overall review, updated according to progress on MacPorts side) |
||
Line 1: | Line 1: | ||
== Requirements | = For the impatient = | ||
To compile Inkscape from source you | |||
1. Install [http://developer.apple.com/tools/xcode/ XCode tools] from your OS X installation DVD | |||
2. Download and install [http://www.macports.org/ MacPorts] | |||
3. In Terminal (Applications>Utilities>Terminal) type | |||
<pre>sudo port sync | |||
sudo port selfupdate | |||
sudo port install cairo +pdf boehmgc gtkmm intltool libxslt lcms popt poppler boost gnome-vfs \ | |||
libgnomeprintui automake autoconf subversion</pre> | |||
Grab a cup of cofee | |||
4. In Terminal, get and build Inkscape | |||
<pre> | |||
svn co https://inkscape.svn.sourceforge.net/svnroot/inkscape/inkscape/trunk inkscape | |||
cd inkscape/packaging/macosx/ | |||
./osx-build.sh a c b i -s p</pre> | |||
''Et voilà''. If you want to understand what you've just did, read on. | |||
= Requirements = | |||
To compile Inkscape from source you need: | |||
*Mac OS X > 10.3 | *Mac OS X > 10.3 | ||
*XCode Tools. They are on your installation DVD in the optional installs or can be download from [http://developer.apple.com/tools/xcode/ Apple Developer Connection]. You can customize the install to make it smaller (avoir documentation and example software for example). You need at least: gcc, XCode, X11SDK. | *XCode Tools. They are on your installation DVD, in the optional installs, or can be download from [http://developer.apple.com/tools/xcode/ Apple Developer Connection]. You can customize the install to make it smaller (avoir documentation and example software for example). You need at least: gcc, XCode, X11SDK. | ||
*Inkscape's source code. You can download | *Inkscape's source code. You can download an [http://www.inkscape.org/download.php official release source code], a [http://inkscape.modevia.com/svn-snap/?M=D development snapshot] or checkout a copy of the current state of the [http://www.inkscape.org/svn.php?lang=en SVN repository] using [http://subversion.tigris.org/ subversion]. Subversion comes pre-installed on Leopard. On previous system, subversion can be installed by package management systems (see point below) or with an OS X installer [http://homepage.mac.com/martinott/ package] | ||
*A means of getting Inkscape's numerous dependencies: glibmm, gtkmm, lmcs, | *A means of getting Inkscape's numerous dependencies: glibmm, gtkmm, lmcs, boehmgc... We recommend the use of [http://www.macports.org/ MacPorts] right now. [http://www.finkproject.org/ Fink] was used in the past but there is no information about wether it meets Inkscape needs currently. Alternatively you could use Inkscape all-in-one universal build script to install them (see below). | ||
= Compiling Inkscape with X11, using MacPorts [Recommended method]= | |||
== Installing dependencies == | |||
You can use MacPorts to list Inkscape dependencies: | You can use MacPorts to list Inkscape dependencies: | ||
<pre>port deps inkscape</pre> | <pre>port deps inkscape</pre> | ||
Line 20: | Line 41: | ||
* <code>libgnomeprintui</code> | * <code>libgnomeprintui</code> | ||
* <code>loudmouth</code> : jabber library used by InkBoard | * <code>loudmouth</code> : jabber library used by InkBoard | ||
< | * <code>cairo +pdf</code> (cairo with the pdf variant) : better pdf export | ||
* <code>poppler</code> : better pdf import | |||
<pre>sudo port install gnome-vfs aspell libgnomeprintui loudmouth cairo +pdf poppler</pre> | |||
NB: Cairo was already installed at previous step as a GTK dependency. You need to either deactivate the old version and install this one, or directly write it on the command line above. | |||
< | |||
<pre> | |||
or | |||
In addition, Inkscape requires versions of the autotools more recent thant those that ship with OS X. Install them: | |||
<pre>sudo port install autoconf automake</pre> | |||
== Setting the build environment == | |||
MacPorts's hierarchy (/opt/local/) is not searched for libraries by default. Therefore, before the configuration starts, some environment variables need to be set. The environment variables are presented in bash syntax here. | MacPorts's hierarchy (/opt/local/) is not searched for libraries by default. Therefore, before the configuration starts, some environment variables need to be set. The environment variables are presented in bash syntax here. | ||
<pre>export LIBPREFIX="/opt/local" | <pre>export LIBPREFIX="/opt/local" | ||
Line 55: | Line 66: | ||
export CXX="ccache g++"</pre> | export CXX="ccache g++"</pre> | ||
== Configuring == | |||
If you compile Inkscape for the first time from an svn checkout you | If you compile Inkscape for the first time from an svn checkout you need to generate the configure script. Navigate to Inkscape's source directory and run: | ||
<pre>./autogen.sh</pre> | <pre>./autogen.sh</pre> | ||
Line 62: | Line 73: | ||
<pre>./configure --disable-static --enable-shared --prefix=/path/to/build/products/</pre> | <pre>./configure --disable-static --enable-shared --prefix=/path/to/build/products/</pre> | ||
I you want to package Inkscape into a double-clickable <code>.app</code> bundle in order to access it like a regular OS X application (you probably want to | I you want to package Inkscape into a double-clickable <code>.app</code> bundle in order to access it like a regular OS X application (you probably want to), you need to add the option <code>--enable-osxapp</code>: | ||
<pre>./configure {...} --enable-osxapp</pre> | <pre>./configure {...} --enable-osxapp</pre> | ||
Line 70: | Line 81: | ||
<pre>./configure --help</pre> | <pre>./configure --help</pre> | ||
== Building and Installing == | |||
Just run: | Just run: | ||
<pre>make | <pre>make | ||
make install</pre> | make install</pre> | ||
== Creating an .app bundle == | |||
Assuming that you have used the <code>--enable-osxapp</code> option during <code>configure</code>, navigate to Mac OS X packaging directory in Inkscape source code and use the automated script: | Assuming that you have used the <code>--enable-osxapp</code> option during <code>configure</code>, navigate to Mac OS X packaging directory in Inkscape source code and use the automated script: | ||
<pre>cd packaging/macosx | <pre>cd packaging/macosx | ||
Line 81: | Line 92: | ||
The script copies Inkscape binary and all its dependencies into the app bundle. The <code>-s</code> options strips libraries from debugging information (the bundle is therefore smaller). Omit this option if you want to keep debugging info. | The script copies Inkscape binary and all its dependencies into the app bundle. The <code>-s</code> options strips libraries from debugging information (the bundle is therefore smaller). Omit this option if you want to keep debugging info. | ||
== Creating a disk image to distribute Inkscape == | |||
Inkscape.app created at the previous step is completely independent from the original location of MacPorts libraries and can therefore be distributed. It will only work on your platform though (PPC or Intel) and incompatibilities are known between X11 versions on different major versions of OS X (Panther, Tiger and Leopard). The general rule is that versions are not backward compatible. | |||
The most widespread way of distributing applications on Mac OS X is via .dmg images. You can created a dmg image of Inkscape, with a nice background and all, using the script: | |||
The most widespread way of distributing applications on Mac OS X is via .dmg images. You can created a dmg image of Inkscape, with a nice background, | |||
<pre>./osx-dmg.sh -p Inkscape.app</pre> | <pre>./osx-dmg.sh -p Inkscape.app</pre> | ||
in the packaging directory for Mac OS X (where your app bundle should be, otherwise modify the path to Inkscape.app). | in the packaging directory for Mac OS X (where your app bundle should be, otherwise modify the path to Inkscape.app). | ||
== Compiling a Universal Binary of Inkscape with X11, using the all-in-one build script | == Automated build script == | ||
All these steps are automated by a build script: <code>osx-build.sh</code>. It has built-in help so to known how to use it just type: | |||
<pre>./osx-build.sh help</pre> | |||
= Compiling a Universal Binary of Inkscape with X11, using the all-in-one build script [untested]= | |||
To build a Universal Binary of Inkscape you also need to build Universal versions of all its dependencies (i.e., gtk+, cairo, pango, etc). You can do this using the build-gtk.sh script from the Inkscape repository (it's in packaging/macosx/native-gtk/). | To build a Universal Binary of Inkscape you also need to build Universal versions of all its dependencies (i.e., gtk+, cairo, pango, etc). You can do this using the build-gtk.sh script from the Inkscape repository (it's in packaging/macosx/native-gtk/). | ||
Line 97: | Line 111: | ||
The process is: | The process is: | ||
<pre>export PREFIX=/your/install/prefix | |||
export UNIVERSAL_BUILD=Yes | |||
./build-gtk bootstrap | |||
./build-gtk build inkscape | |||
</pre> | |||
= Compiling Inkscape with native GTK using MacPorts [experimental] = | |||
This process is very similar to compiling an X11 version of Inkscape except for the building of dependencies: need to build native versions of Inkscape dependencies. At the moment (2007-12-17) this process does not produce a usable version of Inkscape but the more people try to use it, the quicker the bugs will be ironed out! | |||
== | == Native version of Inkscape dependencies == | ||
Thanks to the power of port "variants" and port "deactivation" you can install native versions of gtk, cairo, pango and such, alongside the regular X11 ones. To know which ports have a <code>quartz</code> or <code>no_x11</code> variant, use the command: | |||
<pre>port list variant:quartz variant:no_x11</pre> | |||
This will give you an idea of what need to be replaced. | |||
Assuming your MacPorts tree has been already used to build regular versions of Inkscape, you first need to deactivate (suppress from the tree without really uninstalling) the X11 versions of gtk, cairo, cairomm and pango: | |||
<pre>sudo port deactivate gtk2 cairo cairomm pango</pre> | |||
Then install native variants: | Then install native variants: | ||
<pre>sudo port install cairo +quartz cairomm +quartz | <pre>sudo port install cairo +quartz+pdf+no_x11 cairomm +quartz pango +no_x11 poppler +quartz gtk2 +quartz</pre> | ||
== | == Install the rest == | ||
Eventually, follow the regular install procedure for the rest: | |||
<pre>sudo port install libxslt boost boehmgc gtkmm lcms intltool popt</pre> | |||
If your MacPorts tree was already ready to compile Inkscape, you should not need to reinstall anything, with the possible exception of gtkmm, which may need to be rebuilt against the native version of gtk rather than against the X11 one (please someone confirm this). | |||
Get inkscape source code and go in the mac OS X specific packaging directory | Get inkscape source code and go in the mac OS X specific packaging directory | ||
<pre>cd packaging/macosx</pre> | <pre>cd packaging/macosx</pre> | ||
There edit osx-build.sh to remove the configure option <code>--enable-osxapp</code> because it puts inkscape in a .app bundle where it is started together with X11, which would defeat the purpose of this native compilation. You can also specify an alternative install prefix if you want. Then | There edit <code>osx-build.sh</code> to remove the configure option <code>--enable-osxapp</code> because it puts inkscape in a .app bundle where it is started together with X11, which would defeat the purpose of this native compilation. You can also specify an alternative install prefix if you want. Then | ||
<pre>./osx-build.sh u a c b i</pre> | <pre>./osx-build.sh u a c b i</pre> | ||
and a native version of Inkscape is installed in the prefix you specified or in the <code>Build/bin</code> directory of Inkscape's source code. You can test it by | and a native version of Inkscape is installed in the prefix you specified or in the <code>Build/bin</code> directory of Inkscape's source code. You can test it by | ||
<pre> cd ../../Build/bin/ | <pre> cd ../../Build/bin/ | ||
./inkscape</pre> | ./inkscape</pre> | ||
NB: if you compiled a GTK theme engine against your old GTK install (i.e. the one with X11) and try to use it with the new install, it will complain, so edit <code>~/.gtkrc-2.0</code> to remove the offending theme or recompile it with the new native GTK. | |||
= Compiling Inkscape with native GTK using the all in one build script [experimental] = | |||
To build a native-GTK build of Inkscape, GTK and some of its dependencies must be built with special options. You can do this using the build-gtk.sh script from the Inkscape repository (it's in packaging/macosx/native-gtk/). This is a modified version of the Imendio native build script, found with instructions on this page: | To build a native-GTK build of Inkscape, GTK and some of its dependencies must be built with special options. You can do this using the build-gtk.sh script from the Inkscape repository (it's in packaging/macosx/native-gtk/). This is a modified version of the Imendio native build script, found with instructions on this page: | ||
Line 156: | Line 154: | ||
The process is: | The process is: | ||
<pre>export PREFIX=/your/install/prefix | |||
./build-gtk bootstrap | |||
./build-gtk build inkscape | |||
</pre> | |||
= Enabling python effects = | |||
moved to [[GettingEffectsWorking]] | moved to [[GettingEffectsWorking]]. They should work out of the box in the new versions anyway. | ||
= Links = | |||
== Apple Documentation == | |||
* [http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/BPRuntimeConfig.html Introduction to Runtime Configuration] Covers the Info.plist files, Preferences, Environment variables and has a list of the most important Properties that the Property List should contain. | * [http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/BPRuntimeConfig.html Introduction to Runtime Configuration] Covers the Info.plist files, Preferences, Environment variables and has a list of the most important Properties that the Property List should contain. | ||
== Packaging == | |||
* [http://www.sveinbjorn.org/platypus Sveinbjorn Thordarson's Website] The author of Platypus, the Script Exec wrapper that launches the Inkscape binary. | * [http://www.sveinbjorn.org/platypus Sveinbjorn Thordarson's Website] The author of Platypus, the Script Exec wrapper that launches the Inkscape binary. |
Revision as of 23:29, 16 December 2007
For the impatient
1. Install XCode tools from your OS X installation DVD
2. Download and install MacPorts
3. In Terminal (Applications>Utilities>Terminal) type
sudo port sync sudo port selfupdate sudo port install cairo +pdf boehmgc gtkmm intltool libxslt lcms popt poppler boost gnome-vfs \ libgnomeprintui automake autoconf subversion
Grab a cup of cofee
4. In Terminal, get and build Inkscape
svn co https://inkscape.svn.sourceforge.net/svnroot/inkscape/inkscape/trunk inkscape cd inkscape/packaging/macosx/ ./osx-build.sh a c b i -s p
Et voilà. If you want to understand what you've just did, read on.
Requirements
To compile Inkscape from source you need:
- Mac OS X > 10.3
- XCode Tools. They are on your installation DVD, in the optional installs, or can be download from Apple Developer Connection. You can customize the install to make it smaller (avoir documentation and example software for example). You need at least: gcc, XCode, X11SDK.
- Inkscape's source code. You can download an official release source code, a development snapshot or checkout a copy of the current state of the SVN repository using subversion. Subversion comes pre-installed on Leopard. On previous system, subversion can be installed by package management systems (see point below) or with an OS X installer package
- A means of getting Inkscape's numerous dependencies: glibmm, gtkmm, lmcs, boehmgc... We recommend the use of MacPorts right now. Fink was used in the past but there is no information about wether it meets Inkscape needs currently. Alternatively you could use Inkscape all-in-one universal build script to install them (see below).
Compiling Inkscape with X11, using MacPorts [Recommended method]
Installing dependencies
You can use MacPorts to list Inkscape dependencies:
port deps inkscape
Some are mandatory and you can install them with the command:
sudo port install boehmgc gtkmm intltool libxslt lcms popt boost
Others provide additional functionality to Inkscape:
gnome-vfs
: access to remote servers, in particular import from Open Clipart Libraryaspell
: check spelling of text elements [Note: I have never seen it working on OS X]libgnomeprintui
loudmouth
: jabber library used by InkBoardcairo +pdf
(cairo with the pdf variant) : better pdf exportpoppler
: better pdf import
sudo port install gnome-vfs aspell libgnomeprintui loudmouth cairo +pdf poppler
NB: Cairo was already installed at previous step as a GTK dependency. You need to either deactivate the old version and install this one, or directly write it on the command line above.
In addition, Inkscape requires versions of the autotools more recent thant those that ship with OS X. Install them:
sudo port install autoconf automake
Setting the build environment
MacPorts's hierarchy (/opt/local/) is not searched for libraries by default. Therefore, before the configuration starts, some environment variables need to be set. The environment variables are presented in bash syntax here.
export LIBPREFIX="/opt/local" # automake seach path export CPATH="$LIBPREFIX/include" # configure search path export CPPFLAGS="-I$LIBPREFIX/include" export LDFLAGS="-L$LIBPREFIX/lib" # compiler arguments export CFLAGS="-O3 -Wall" export CXXFLAGS="$CFLAGS"
You can also use ccache
(sudo port install ccache
) to speed up the compilation a bit. To do so, add compiler variables:
export CC="ccache gcc" export CXX="ccache g++"
Configuring
If you compile Inkscape for the first time from an svn checkout you need to generate the configure script. Navigate to Inkscape's source directory and run:
./autogen.sh
Then run configure with the options --disable-static --enable-shared
and --prefix
which sets the directory where the build products are placed. It must be somewhere you have write access to.
./configure --disable-static --enable-shared --prefix=/path/to/build/products/
I you want to package Inkscape into a double-clickable .app
bundle in order to access it like a regular OS X application (you probably want to), you need to add the option --enable-osxapp
:
./configure {...} --enable-osxapp
If you have loudmouth installed and you want to enable whiteboard functionality in Inkscape, add --enable-inkboard
.
Other configuration options can be set, check the list of options by issuing:
./configure --help
Building and Installing
Just run:
make make install
Creating an .app bundle
Assuming that you have used the --enable-osxapp
option during configure
, navigate to Mac OS X packaging directory in Inkscape source code and use the automated script:
cd packaging/macosx ./osx-app.sh -s -b /path/to/install/prefix/bin/inkscape -p ../Info.plist macosx
The script copies Inkscape binary and all its dependencies into the app bundle. The -s
options strips libraries from debugging information (the bundle is therefore smaller). Omit this option if you want to keep debugging info.
Creating a disk image to distribute Inkscape
Inkscape.app created at the previous step is completely independent from the original location of MacPorts libraries and can therefore be distributed. It will only work on your platform though (PPC or Intel) and incompatibilities are known between X11 versions on different major versions of OS X (Panther, Tiger and Leopard). The general rule is that versions are not backward compatible.
The most widespread way of distributing applications on Mac OS X is via .dmg images. You can created a dmg image of Inkscape, with a nice background and all, using the script:
./osx-dmg.sh -p Inkscape.app
in the packaging directory for Mac OS X (where your app bundle should be, otherwise modify the path to Inkscape.app).
Automated build script
All these steps are automated by a build script: osx-build.sh
. It has built-in help so to known how to use it just type:
./osx-build.sh help
Compiling a Universal Binary of Inkscape with X11, using the all-in-one build script [untested]
To build a Universal Binary of Inkscape you also need to build Universal versions of all its dependencies (i.e., gtk+, cairo, pango, etc). You can do this using the build-gtk.sh script from the Inkscape repository (it's in packaging/macosx/native-gtk/).
This process is relatively untested, as it is only being used by Michael Wybrow for official Inkscape release builds. If you have any troubles using this process then please report them to Michael (mjwybrow on sourceforge).
The process is:
export PREFIX=/your/install/prefix export UNIVERSAL_BUILD=Yes ./build-gtk bootstrap ./build-gtk build inkscape
Compiling Inkscape with native GTK using MacPorts [experimental]
This process is very similar to compiling an X11 version of Inkscape except for the building of dependencies: need to build native versions of Inkscape dependencies. At the moment (2007-12-17) this process does not produce a usable version of Inkscape but the more people try to use it, the quicker the bugs will be ironed out!
Native version of Inkscape dependencies
Thanks to the power of port "variants" and port "deactivation" you can install native versions of gtk, cairo, pango and such, alongside the regular X11 ones. To know which ports have a quartz
or no_x11
variant, use the command:
port list variant:quartz variant:no_x11
This will give you an idea of what need to be replaced.
Assuming your MacPorts tree has been already used to build regular versions of Inkscape, you first need to deactivate (suppress from the tree without really uninstalling) the X11 versions of gtk, cairo, cairomm and pango:
sudo port deactivate gtk2 cairo cairomm pango
Then install native variants:
sudo port install cairo +quartz+pdf+no_x11 cairomm +quartz pango +no_x11 poppler +quartz gtk2 +quartz
Install the rest
Eventually, follow the regular install procedure for the rest:
sudo port install libxslt boost boehmgc gtkmm lcms intltool popt
If your MacPorts tree was already ready to compile Inkscape, you should not need to reinstall anything, with the possible exception of gtkmm, which may need to be rebuilt against the native version of gtk rather than against the X11 one (please someone confirm this).
Get inkscape source code and go in the mac OS X specific packaging directory
cd packaging/macosx
There edit osx-build.sh
to remove the configure option --enable-osxapp
because it puts inkscape in a .app bundle where it is started together with X11, which would defeat the purpose of this native compilation. You can also specify an alternative install prefix if you want. Then
./osx-build.sh u a c b i
and a native version of Inkscape is installed in the prefix you specified or in the Build/bin
directory of Inkscape's source code. You can test it by
cd ../../Build/bin/ ./inkscape
NB: if you compiled a GTK theme engine against your old GTK install (i.e. the one with X11) and try to use it with the new install, it will complain, so edit ~/.gtkrc-2.0
to remove the offending theme or recompile it with the new native GTK.
Compiling Inkscape with native GTK using the all in one build script [experimental]
To build a native-GTK build of Inkscape, GTK and some of its dependencies must be built with special options. You can do this using the build-gtk.sh script from the Inkscape repository (it's in packaging/macosx/native-gtk/). This is a modified version of the Imendio native build script, found with instructions on this page: http://developer.imendio.com/projects/gtk-macosx/build-instructions
This process is relatively untested. If you have any troubles using this process then please report them to Michael Wybrow (mjwybrow on sourceforge).
The process is:
export PREFIX=/your/install/prefix ./build-gtk bootstrap ./build-gtk build inkscape
Enabling python effects
moved to GettingEffectsWorking. They should work out of the box in the new versions anyway.
Links
Apple Documentation
- Introduction to Runtime Configuration Covers the Info.plist files, Preferences, Environment variables and has a list of the most important Properties that the Property List should contain.
Packaging
- Sveinbjorn Thordarson's Website The author of Platypus, the Script Exec wrapper that launches the Inkscape binary.
- Creating OS X application bundles step by step Covers the bundle concepts, copying libraries into the bundle, editing libraries with the install_name_tool, the Info.plist file and adding an icon.
- Bringing your Java Application to Mac OS X I would regard this a little dated, and the detail is (unsurprisingly) Java-related, but it is a gentle introduction to the role of the .app bundle and give a most clear account of how to create one.
- The Gimp .app Howto This is a very bare document, and would be of little help to you if you were new to making packages. Note that it seems to refer to a more mature Clipboard technique and Online help than we currently have; and we ought to move to parity in these areas.