Difference between revisions of "CompilingMacOsX"

From Inkscape Wiki
Jump to navigation Jump to search
(Added DarwinPorts HowTo (unfinished))
Line 1: Line 1:
== Compiling on Mac OS X ==
+
== Compiling Inkscape ==
  
 
=== Requirements ===
 
=== Requirements ===
 
To compile Inkscape from source you will need:
 
To compile Inkscape from source you will need:
 
*Mac OS X 10.3 (Power PC) or higher
 
*Mac OS X 10.3 (Power PC) or higher
*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/ SVN snapshot] or a copy of the [http://www.inkscape.org/svn.php?lang=en SVN repository].
 
*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.
 
 
*XCode 2.3 on OS X 10.4 (gcc 4.0.1)
 
*XCode 2.3 on OS X 10.4 (gcc 4.0.1)
  
You need to install software on which Inkscape depends, using Fink and/or DarwinPorts.
+
To install inkscape dependencies you can use:
 +
*Fink with an [http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#unstable unstable installation] (does not provide support for loudmouth, the librarie that Inkboard uses, therefore you won't be able to use Inkboard)
 +
*[http://darwinports.opendarwin.org/ DarwinPorts]
  
=== Dependencies ===
+
=== Preparing the build using Fink ===
  
They are necessary for Inkscape to compile. In a Terminal type:
+
====Installing dependencies====
<pre>
+
Inkscape can be installed via Fink. Therefore, as for any other package, Fink provides you with a list of its dependencies:
fink install \
+
<pre>fink show-deps inkscape</pre>
        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
 
</pre>
 
  
You need version 1.8 of automake 1.8 (and not 1.9, the latest in Fink). Fink installs many packages from source so this is usually long.
+
Some are mandatory and you must install them:
 +
<pre>fink install gtkmm2.4-dev  gconf2-dev gtkspell2-dev intltool libbonobo2-dev libxslt gc automake1.8</pre>
 +
You need version 1.8 of automake 1.8 (and not 1.9, the latest in Fink)
  
You may also need to build popt from source (tested on 10.4):
+
Some provide additional functionality in Inkscape
[ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x/popt-1.7.tar.gz]
+
* <code>aspell</code> : check spelling of text elements [Note: I have never seen it working on OS X]
 
 
(Since May 2006, the version of sigc++ required when using gcc 4 is 2.0.12 or greater.  For a short time, only 2.0.11 was available in Fink.  The latest version of libsigc++2, version 2.0.17, has now been added to fink unstable so everything should compile normally again.)
 
 
 
=== Optional Features ===
 
 
 
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>boost >= 1.32</code> : auto-organisation of connectors
 
* <code>boost >= 1.32</code> : auto-organisation of connectors
* <code>gnome-vfs</code>
+
* <code>gnome-vfs2</code>
 
* <code>gnome-print</code>
 
* <code>gnome-print</code>
* <code>xft2</code>
+
* <code>lcms</code> : color management via LittleCMS
for each of these you need the developement packages as well (the name ends by <code>-dev</code>)
+
<pre>fink install aspell-dev boost gnome-vfs2-dev gnome-print-dev lcms</pre>
  
=== Easy Compile ===
+
You may also need to build popt from source (tested on 10.4):
 
+
[ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x/popt-1.7.tar.gz]
You can try to download this [http://jo.irisson.free.fr/dropbox/inkscape/makeosx.sh bash script] which automates the processes of updating Inkscape from the svn repository, setting the build environment, building and producing a simple package of Inkscape. Modify it with your favorite text editor in order to set a correct install prefix and to change configuration options.
 
 
 
Check Inkscape source code [http://www.inkscape.org/svn.php?lang=en from svn] and copy the script to the base of your local svn repository. Make it executable:
 
<pre>chmod +x makeosx.sh</pre>
 
and then simply run it
 
<pre>./makeosx.sh</pre>
 
 
 
If something doesn't run smoothly, refer to the indications underneath.
 
 
 
=== Setting the build environment ===
 
  
 +
====Setting the build environment====
 
Fink's hierarchy 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. You can create a file named <code>set_env_variables.sh</code> and copy/paste this inside:
 
Fink's hierarchy 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. You can create a file named <code>set_env_variables.sh</code> and copy/paste this inside:
 
<pre>
 
<pre>
 +
#!/bin/bash
 
FINK="/sw"
 
FINK="/sw"
 
export CFLAGS="-O3 -Wall"
 
export CFLAGS="-O3 -Wall"
Line 72: Line 46:
 
export PKG_CONFIG_PATH="$FINK/lib/pkgconfig"
 
export PKG_CONFIG_PATH="$FINK/lib/pkgconfig"
 
</pre>
 
</pre>
 
  
 
In addition, you must make sure that Inkscape is compiled with the compiler version that Fink uses, otherwise Inkscape will not link properly. To determine which compiler to use type:
 
In addition, you must make sure that Inkscape is compiled with the compiler version that Fink uses, otherwise Inkscape will not link properly. To determine which compiler to use type:
<pre>
+
<pre>head -n 5 $FINK/etc/fink.conf | grep "Distribution"</pre>
head -n 5 $FINK/etc/fink.conf | grep "Distribution"
 
</pre>
 
 
 
 
If your fink distribution is 10.4 add:
 
If your fink distribution is 10.4 add:
 
<pre>
 
<pre>
Line 97: Line 67:
  
 
Eventually, open a Terminal and, in the directory where you created the file <code>set_env_variables.sh</code>, type:
 
Eventually, open a Terminal and, in the directory where you created the file <code>set_env_variables.sh</code>, type:
<pre>
+
<pre>source set_env_variables.sh</pre>
bash; source set_env_variables.sh
+
You are ready for to compile and install Inkscape.
</pre>
+
 
 +
 
 +
=== Preparing the build using DarwinPorts ===
 +
====Installing dependencies====
 +
You can use DarwinPorts to list Inkscape dependencies:
 +
<pre>port deps inkscape</pre>
 +
Some are mandatory and you can install them with the command:
 +
<pre>sudo port install boehmgc gtkmm intltool libxslt</pre>
 +
Others provide additional functionality to Inkscape:
 +
* <code>aspell</code> : check spelling of text elements [Note: I have never seen it working on OS X]
 +
* <code>boost</code> : auto-organisation of connectors
 +
* <code>gnome-vfs</code>
 +
* <code>libgnomeprintui</code>
 +
* <code>lcms</code> : color management via LittleCMS
 +
* <code>loudmouth</code> : jabber library used by InkBoard
 +
<pre>sudo port install aspell boost gnome-vfs libgnomeprintui lcms loudmouth</pre>
 +
 
 +
====Setting the build environment====
 +
 
 +
 
  
  
Line 105: Line 94:
  
 
You might need to build the configure script first (if you compile Inkscape for the first time). Cd to Inkscape's source directory and run:
 
You might need to build the configure script first (if you compile Inkscape for the first time). Cd to Inkscape's source directory and run:
<pre>
+
<pre>./autogen.sh</pre>
./autogen.sh
 
</pre>
 
  
 
Then run the configure script:
 
Then run the configure script:
<pre>
+
<pre>./configure --prefix=/path/to/build/products/ --enable-osxapp</pre>
./configure --prefix=/path/to/build/products/ --enable-osxapp
 
</pre>
 
  
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 configuration 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. Of course you can add here classic configuration options such as <code>--enable-lcms</code> for color management or <code>--enable-inkboard</code> for whiteboard functionality.
  
=== Starting the Build ===
+
=== Building and Installing ===
  
Piece of cake:
+
Just run:
 
<pre>
 
<pre>
 
make
 
make
Line 125: Line 110:
  
  
 +
===Automated compilation===
 +
You can try downloading a bash script which automates the processes of updating Inkscape from the svn repository, setting the build environment, building and producing a package of Inkscape. Modify it with your favorite text editor in order to set a correct install prefix and to change configuration options according to your needs.
 +
Two scripts are prodived, depending on wether you use Fink or DarwinPorts.
 +
[http://jo.irisson.free.fr/dropbox/inkscape/osxmake_fink.sh]
 +
[http://jo.irisson.free.fr/dropbox/inkscape/osxmake_dp.sh]
 +
 +
To use this script, place it in the directory where Inkscape source code is and make it executable
 +
<pre>chmod +x osxmake_???.sh</pre>
 +
To obtain help on how to use it run it with the <code>-h</code> option:
 +
<pre>./osxmake_???.sh -h</pre>
 +
To run the whole process use the command:
 +
<pre>./osxmake_???.sh -s -a -c -b -i -p</pre>
  
 
== Packaging Inkscape into an .app bundle ==
 
== Packaging Inkscape into an .app bundle ==

Revision as of 16:03, 28 October 2006

Compiling Inkscape

Requirements

To compile Inkscape from source you will need:

To install inkscape dependencies you can use:

  • Fink with an unstable installation (does not provide support for loudmouth, the librarie that Inkboard uses, therefore you won't be able to use Inkboard)
  • DarwinPorts

Preparing the build using Fink

Installing dependencies

Inkscape can be installed via Fink. Therefore, as for any other package, Fink provides you with a list of its dependencies:

fink show-deps inkscape

Some are mandatory and you must install them:

fink install gtkmm2.4-dev  gconf2-dev gtkspell2-dev intltool libbonobo2-dev libxslt gc automake1.8

You need version 1.8 of automake 1.8 (and not 1.9, the latest in Fink)

Some provide additional functionality in Inkscape

  • aspell : check spelling of text elements [Note: I have never seen it working on OS X]
  • boost >= 1.32 : auto-organisation of connectors
  • gnome-vfs2
  • gnome-print
  • lcms : color management via LittleCMS
fink install aspell-dev boost gnome-vfs2-dev gnome-print-dev lcms

You may also need to build popt from source (tested on 10.4): [1]

Setting the build environment

Fink's hierarchy 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. You can create a file named set_env_variables.sh and copy/paste this inside:

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

In addition, you must make sure that Inkscape is compiled with the compiler version that Fink uses, otherwise Inkscape will not link properly. To determine which compiler to use type:

head -n 5 $FINK/etc/fink.conf | grep "Distribution"

If your fink distribution is 10.4 add:

export CC="gcc-4.0"
export CXX="g++-4.0"

to set_env_variables.sh, else (10.3, 10.4-transitional) add:

export CC="gcc-3.3"
export CXX="g++-3.3"

You can also use ccache (fink install ccache) to speed up the compilation a bit. To do so, modify the compiler lines accordingly:

export CC="ccache gcc-??"
export CXX="ccache g++-??"

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

source set_env_variables.sh

You are ready for to compile and install Inkscape.


Preparing the build using DarwinPorts

Installing dependencies

You can use DarwinPorts 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

Others provide additional functionality to Inkscape:

  • aspell : check spelling of text elements [Note: I have never seen it working on OS X]
  • boost : auto-organisation of connectors
  • gnome-vfs
  • libgnomeprintui
  • lcms : color management via LittleCMS
  • loudmouth : jabber library used by InkBoard
sudo port install aspell boost gnome-vfs libgnomeprintui lcms loudmouth

Setting the build environment

Configuring

You might need to build the configure script first (if you compile Inkscape for the first time). Cd to Inkscape's source directory and run:

./autogen.sh

Then run the configure script:

./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 configuration options such as --enable-lcms for color management or --enable-inkboard for whiteboard functionality.

Building and Installing

Just run:

make
make install


Automated compilation

You can try downloading a bash script which automates the processes of updating Inkscape from the svn repository, setting the build environment, building and producing a package of Inkscape. Modify it with your favorite text editor in order to set a correct install prefix and to change configuration options according to your needs. Two scripts are prodived, depending on wether you use Fink or DarwinPorts. [2] [3]

To use this script, place it in the directory where Inkscape source code is and make it executable

chmod +x osxmake_???.sh

To obtain help on how to use it run it with the -h option:

./osxmake_???.sh -h

To run the whole process use the command:

./osxmake_???.sh -s -a -c -b -i -p

Packaging Inkscape into an .app bundle

Creating the .app and a simple .dmg

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 -s /path/to/build/products/bin/inkscape ../Info.plist macosx

The -s options produces an app bundle stripped of debugging information (which is therefore smaller). Omit this option if you want to keep debugging info.

Either way, this creates two files in current directory: Inkscape.app that you can copy to your Applications directory and Inkscape.dmg for distribution.


Creating a more complete .dmg

The steps that used to comprise this section have since been integrated into the official Inkscape.app build script, refered to above.

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. You can install a binary version downloadable with the developement builds of Inkscape:

http://inkscape.modevia.com/macosx-snap/?M=D

Or you can install it from source:

  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:
    export MACOSX_DEPLOYMENT_TARGET=10.?
  5. move the python files and build C extensions
    python setup.py build
  6. install (the install is system wide so you need administrator rights)
    sudo python setup.py install
    and type your password.

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.