Difference between revisions of "CompilingMacOsX"

From Inkscape Wiki
Jump to navigation Jump to search
(→‎Compiling How To: PRE tag does not allow wiki format in it; also colored text to be changed)
(added new dependencies, refactoring)
Line 14: Line 14:
== Compiling How To ==
== Compiling How To ==


'''Note''': You could use the [http://fink.sourceforge.net/pdb/package.php/inkscape Inkscape package] from the [http://fink.sourceforge.net Fink project] to install Inkscape from source but this package is usally older that the precompiled Development Versions and even that the Official Release so this does not seem useful.
<!--'''Note''': You could use the [http://fink.sourceforge.net/pdb/package.php/inkscape Inkscape package] from the [http://fink.sourceforge.net Fink project] to install Inkscape from source but this package is usally older that the precompiled Development Versions and even that the Official Release so this does not seem useful.-->


'''Requirements''':
'''Requirements''':
#Mac OS X 10.3 of higher
*Mac OS X 10.3 of higher
#A full [http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#unstable unstable fink] installation
*A full [http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#unstable unstable fink] installation
#Inkscape's source code. You can get the [http://www.inkscape.org/download.php official release source code], a [http://www.inkscape.org/cvs-snap/ CVS snapshot] or a copy of the [http://sourceforge.net/cvs/?group_id=93438 cvs repository] (the module name is "inkscape")
*Inkscape's source code. You can get the [http://www.inkscape.org/download.php official release source code], a [http://www.inkscape.org/cvs-snap/ SVN snapshot] or a copy of the [http://www.inkscape.org/svn.php?lang=en SVN repository].
*A [http://darwinports.opendarwin.org/ DarwinPorts] install if you want to use inkboard.


'''Installing dependencies''':
'''Essential dependencies''':


In a Terminal type:
These are necessary for Inkscape to compile. In a Terminal type:
<pre>
<pre>
fink install
fink install \
         intltool
         intltool \
         glib2 glib2-dev glib2-shlibs
         glib2 glib2-dev glib2-shlibs \
         gtk+2 gtk+2-shlibs gtk+2-dev
         gtk+2 gtk+2-shlibs gtk+2-dev \
         libpng3 libpng3-shlibs
         libpng3 libpng3-shlibs \
         libsigc++2 libsigc++2-shlibs
         libsigc++2 libsigc++2-shlibs \
         gtkmm2.4 gtkmm2.4-dev gtkmm2.4-shlibs
         gtkmm2.4 gtkmm2.4-dev gtkmm2.4-shlibs \
         libtool14 libtool14-shlibs
         libtool14 libtool14-shlibs \
         libxml2 libxml2-shlibs
         libxml2 libxml2-shlibs \
         popt popt-shlibs
         popt popt-shlibs \
         gc gc-shlibs automake1.8
         gc gc-shlibs \
        automake1.8
</pre>
</pre>


You need automake 1.8 and not the latest in fink (1.9.6-1). Fink installs many packages from source so this is usually long.
You need automake 1.8 and not the latest in Fink (1.9.6-1). Fink installs many packages from source so this is usually long.
 
'''Optional dependencies''':
 
To enable some additional functionality in Inkscape you might want to install:
* <code>lcms</code> : color management via LittleCMS
* <code>loudmouth-1.0</code> : collaborative whiteboard (only available in DarwinPorts)
* <code>boost1.31</code> : auto-organisation of connectors
* <code>gnome-vfs</code>
* <code>gnome-print</code>
* <code>xft2</code>
for each of these you need the developement packages as well (the name ends by <code>-dev</code>)
 


'''Setting the build environment''':
'''Setting the build environment''':


You need set the following environment variables (taken right out of fink's <code>.info</code> file) for the compilation to work. They are in bash syntax. You can create a file named <code>set_variables</code> for example and copy/paste this inside:
Fink hierarchy is not searched for libraries by default. Therefore, before the configuration starts, some environment variables need to be set<!--(taken right out of fink's <code>.info</code> file)-->. In addition, you must make sure that Inkscape is compiled with the compiler that Fink uses, otherwise Inkscape won't link properly. On old 10.3 and 10.4 Fink installs, you compiler is probably gcc-3.3. On fresh 10.4 Fink installs, your compiler is probably gcc-4.0. In addition, to speed up the compilation a bit you could use <code>ccache</code> if you have it installed.


The environment variables are presented in bash syntax here. You can create a file named <code>set_env_variables.sh</code> for example and copy/paste this inside:
<pre>
  #!/bin/bash
  #!/bin/bash
  FINK="/sw"
  FINK="/sw"
  export [[LIBRARY_PATH]]="/usr[[/X11R6/lib]]:$FINK/lib"
  export LIBRARY_PATH="/usr/X11R6/lib:$FINK/lib"
  export CPATH="$FINK/include"
  export CPATH="$FINK/include"
  export PATH="/usr[[/X11R6/bin]]:$PATH"
  export PATH="/usr/X11R6/bin:$PATH"
export CC="gcc"
export CXX="g++"
  export CPPFLAGS="-I$FINK/include"  
  export CPPFLAGS="-I$FINK/include"  
  export LDFLAGS="-L$FINK/lib"
  export LDFLAGS="-L$FINK/lib"
  export CFLAGS="-O3 -Wall"
  export CFLAGS="-O3 -Wall"
  export CXXFLAGS="$CFLAGS"
  export CXXFLAGS="$CFLAGS"
export PKG_CONFIG_PATH="$FINK/lib/pkgconfig"
</pre>


Optionaly, to speed up the compilation a bit you could use <code>ccache</code> if you have it installed:
And add this couple of line to set the compiler:
 
* On 10.3 and fresh Fink installs on 10.4:
  export CC="ccache gcc"
<pre>
  export CXX="ccache g++"
  export CC="gcc"
 
  export CXX="g++"
'''Note''': Inkscape won't link properly on OS X 10.4.x using gcc 4 (the default) since many of the libraries it needs in fink are still built with gcc-3.3.  Thus, Tiger users will probably want to modify a couple of lines:
</pre>
 
* With old Fink installs on 10.4:
<pre>
  export CC="gcc-3.3"
  export CC="gcc-3.3"
  export CXX="g++-3.3"
  export CXX="g++-3.3"
</pre>
* With ccache:
<pre>
export CC="ccache gcc-??"
export CXX="ccache g++-??"
</pre>


Then, open a Terminal and, in the directory where you created the file <code>set_variables</code>, type:
Then, open a Terminal and, in the directory where you created the file <code>set_env_variables.sh</code>, type:
<pre>
<pre>
bash
bash
source set_variables
source set_env_variables.sh
</pre>
</pre>


Then you need to build the configure script. Cd to Inkscape's source directory and run:
Then you need to build the configure script. Cd to Inkscape's source directory and run:
<pre>
<pre>
autogen.sh
./autogen.sh
</pre>
</pre>


Line 80: Line 103:


Cd to Inkscape's sources directory and type
Cd to Inkscape's sources directory and type
<pre>
./configure --prefix=/path/to/build/products/ --enable-osxapp
</pre>


./configure --prefix=<font color=darkgray>/path/to/build/products/</font> --enable-osxapp
The <code>--prefix</code> option sets the directory where the build products are placed. It must be somewhere you have write access to. The option <code>--enable-osxapp</code> allows you to package Inkscape into an <code>.app</code> bundle in order to access it like a regular OS X application. Remove this option if you only want to build Inskscape, not to package it afterwards. Of course you can add here classic compilation options such as <code>--enable-lcms</code> for color management or <code>--enable-inkboard</code> for whitboard functionality.
 
The <code>--prefix</code> option sets the directory where the build products are placed. It must be somewhere you have write access to. The option <code>--enable-osxapp</code> allows you to package Inkscape into an <code>.app</code> bundle in order to access it like a regular OS X application. Remove this option if you only want to build Inskscape, not to package it afterwards.


'''Building''':
'''Building''':
Line 94: Line 118:


Assuming that you have used the <code>--enable-osxapp</code> option during <code>configure</code>, the process is fully automatized. You just have to open a Terminal, cd to Inkscape's sources directory and type:
Assuming that you have used the <code>--enable-osxapp</code> option during <code>configure</code>, the process is fully automatized. You just have to open a Terminal, cd to Inkscape's sources directory and type:
 
<pre>
cd packaging
cd packaging
./osx-app.sh <font color=darkgray>/path/to/build/products/</font>bin/inkscape ..[[/Info]].plist macosx
./osx-app.sh /path/to/build/products/bin/inkscape ../Info.plist macosx
</pre>


You will end up with two files in current directory: Inkscape.app that you can copy to your Applications directory and Inkscape.dmg for distribution.
You will end up with two files in current directory: Inkscape.app that you can copy to your Applications directory and Inkscape.dmg for distribution.

Revision as of 12:24, 7 April 2006

Compiling and Packaging Inkscape under Mac OS X

Before you start

If you want an Official Release, note that from version 0.42 of Inkscape a Mac OS X package (in .dmg form) will be available. In addition, regular Development Versions will be build. Both can be downloaded from Inkscape's downloads page:

http://www.inkscape.org/download.php

Inkscape for Mac OS X is an X client: it runs under the X Windows System. You will need an X Windows Server installed for it to work. For 10.4.x users, X11 can be installed from your installation DVD. For 10.3.x users, you can get Apple's X Server here:

http://www.apple.com/downloads/macosx/apple/x11formacosx.html

Compiling How To

Requirements:

Essential dependencies:

These are necessary for Inkscape to compile. In a Terminal type:

fink install \
        intltool \
        glib2 glib2-dev glib2-shlibs \
        gtk+2 gtk+2-shlibs gtk+2-dev \
        libpng3 libpng3-shlibs \
        libsigc++2 libsigc++2-shlibs \
        gtkmm2.4 gtkmm2.4-dev gtkmm2.4-shlibs \
        libtool14 libtool14-shlibs \
        libxml2 libxml2-shlibs \
        popt popt-shlibs \
        gc gc-shlibs \
        automake1.8

You need automake 1.8 and not the latest in Fink (1.9.6-1). Fink installs many packages from source so this is usually long.

Optional dependencies:

To enable some additional functionality in Inkscape you might want to install:

  • lcms : color management via LittleCMS
  • loudmouth-1.0 : collaborative whiteboard (only available in DarwinPorts)
  • boost1.31 : auto-organisation of connectors
  • gnome-vfs
  • gnome-print
  • xft2

for each of these you need the developement packages as well (the name ends by -dev)


Setting the build environment:

Fink hierarchy is not searched for libraries by default. Therefore, before the configuration starts, some environment variables need to be set. In addition, you must make sure that Inkscape is compiled with the compiler that Fink uses, otherwise Inkscape won't link properly. On old 10.3 and 10.4 Fink installs, you compiler is probably gcc-3.3. On fresh 10.4 Fink installs, your compiler is probably gcc-4.0. In addition, to speed up the compilation a bit you could use ccache if you have it installed.

The environment variables are presented in bash syntax here. You can create a file named set_env_variables.sh for example and copy/paste this inside:

 #!/bin/bash
 FINK="/sw"
 export LIBRARY_PATH="/usr/X11R6/lib:$FINK/lib"
 export CPATH="$FINK/include"
 export PATH="/usr/X11R6/bin:$PATH"
 export CPPFLAGS="-I$FINK/include" 
 export LDFLAGS="-L$FINK/lib"
 export CFLAGS="-O3 -Wall"
 export CXXFLAGS="$CFLAGS"
 export PKG_CONFIG_PATH="$FINK/lib/pkgconfig"

And add this couple of line to set the compiler:

  • On 10.3 and fresh Fink installs on 10.4:
 export CC="gcc"
 export CXX="g++"
  • With old Fink installs on 10.4:
 export CC="gcc-3.3"
 export CXX="g++-3.3"
  • With ccache:
 export CC="ccache gcc-??"
 export CXX="ccache g++-??"

Then, open a Terminal and, in the directory where you created the file set_env_variables.sh, type:

bash
source set_env_variables.sh

Then you need to build the configure script. Cd to Inkscape's source directory and run:

./autogen.sh

Configuring:

Cd to Inkscape's sources directory and type

./configure --prefix=/path/to/build/products/ --enable-osxapp

The --prefix option sets the directory where the build products are placed. It must be somewhere you have write access to. The option --enable-osxapp allows you to package Inkscape into an .app bundle in order to access it like a regular OS X application. Remove this option if you only want to build Inskscape, not to package it afterwards. Of course you can add here classic compilation options such as --enable-lcms for color management or --enable-inkboard for whitboard functionality.

Building:

 make
 make install

Packaging:

Assuming that you have used the --enable-osxapp option during configure, the process is fully automatized. You just have to open a Terminal, cd to Inkscape's sources directory and type:

cd packaging
./osx-app.sh /path/to/build/products/bin/inkscape ../Info.plist macosx

You will end up with two files in current directory: Inkscape.app that you can copy to your Applications directory and Inkscape.dmg for distribution.

-- Kees Cook, Michael Wybrow, Jean-Olivier Irisson


Enabling python effects

Many "effects" in the Effect menu of Inkscape use python as a scripting language. Mac OS X ships with python but not with pyXML which is needed by Inkscape effects. To install it you need to

  1. download the source code from sourceforge
  2. unpack the .tar.gz file
  3. cd into the newly created directory
  4. set the variable MACOSX_DEPLOYMENT_TARGET to the number of your operating system (10.3 for Panther, 10.4 for Tiger. It probably won't work on previous systems). In bash syntax this means typing:
    [[MACOSX_DEPLOYMENT_TARGET]]=10.?

export [[MACOSX_DEPLOYMENT_TARGET]]

  1. move the python files and build C extensions
    python setup.py build
  2. install (the install is system wide so you need administrator rights)
    sudo python setup.py install
    and type your password.



Interesting links

Some packaging links:

http://freespace.ausgamers.com/2005/02/creating-os-x-application-bundles-step.html

http://java.sun.com/developer/technicalArticles/JavaLP/JavaToMac3/

http://gimp-app.sourceforge.net/gimp.app.howto.txt