|(186 intermediate revisions by 28 users not shown)|
== Compiling on Mac OS X ==
= Requirements ===
To compile Inkscape from source you will need:
*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].
*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)
You need to install software on which Inkscape depends, using Fink and/ or DarwinPorts.
== Dependencies ===
They are necessary for Inkscape to compile. In a Terminal type:
fink install \
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 \
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.
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]
(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
for each of these you need the developement packages as well (the name ends by <code>-dev</code>)
== Easy Compile ===
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 ===
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:
export CFLAGS="-O3 -Wall"
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:
to <code>set_env_variables.sh</ code>, else (10.3, 10.4-transitional) add:
export CC=" gcc-3.3"
You can also use <code>ccache</code> (<code>fink install ccache</code>) 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 <code>set_env_variables.sh</code>, type:
bash; source set_env_variables.sh
=== 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:
Then run the configure script:
./configure --prefix=/path/to/build/products/ --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 configuration options such as <code>--enable-lcms</code> for color management or <code>--enable-inkboard</code> for whitboard functionality.
=== Starting the Build ===
Piece of cake:
== Packaging Inkscape into an .app bundle ==
=== Creating the .app and a simple .dmg ===
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:
./osx-app.sh -s /path/to/build/products/bin/inkscape ../Info.plist macosx
The <code>-s</code> 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 ===
Many Mac OS applications are distributed in a dmg with a background picture and some basic installation instructions. In order to distribute Inkscape this way you first need to create an .app bundle of Inkscape as described above. Then you need to create a read-write disc image big enough to contain the app bundle:
hdiutil create -size 50m -fs HFS+ -volname "Inkscape" RWinkscape.dmg
This step has only to be done once. For next builds you will just have to re-attach the image and copy the new Inkscape .app inside it. To attach the disc image, double click the .dmg or use:
hdiutil attach RWinkscape.dmg
The second step is to copy everything you need inside the attached disc image (which is available as a white disc icon named "Inskcape" on your Desktop). You need:
*the .app bundle
*an alias to the Applications folder (CTRL+click "Applications" and select "Make Alias")
*the [ http://jo.irisson.free.fr/dropbox/inkscape/background.png background picture]
Finally you need to improve the appearance of the disc image.
First you need to set the background image:
#navigate to the attached disc image with the Finder
#switch the Finder to Icon's view (View > as Icons)
#open the View Options window (View > Show View Options)
#check the radio button to select options for "This window only"
#in the "Background" section, select "Picture" and choose the background picture you just copied in the disc image.
You may want to make the background image file invisible to have a cleaner aspect:
/Developer /Tools/SetFile -a V /Volumes/Inkscape/background.png
The icon of the file should become kind of transparent and you should not see it anymore if you relaunch the Finder.
Then, arrange the Finder window as you want people to see it. You may want to hide the Finder brushed metal skin to have a smaller window (click the elongated transparent button in the top right corner of the Finder window), fit the window to the background image, move Inkscape's icon to be next to the arrow (you may need to deselect some presentation options in View > Show View Options) and center the window in your screen.
You should end up with a window looking like [http://jo.irisson.free.fr/dropbox/inkscape/inkscape_distrib.png this].
The last step consists in creating a compressed read-only disc image from this read-write disc image:
hdiutil detach /Volumes/Inkscape
hdiutil convert -format UDCO -o Inkscape_$DATE.dmg RWinkscape.dmg
This creates a smaller disc image with a name like Inkscape_20060424.dmg.
Everything is summarized in a [http://jo.irisson.free.fr/dropbox/inkscape/bundleosx.sh bash script].
== 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:
Or you can install it from source:
# download the source code from [http://sourceforge.net/project/showfiles.php?group_id=6473 sourceforge]
# unpack the <code>.tar.gz</code> file
# cd into the newly created directory
# set the variable <code>MACOSX_DEPLOYMENT_TARGET</code> 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:<pre>export MACOSX_DEPLOYMENT_TARGET=10.?</pre>
# move the python files and build C extensions<pre>python setup.py build</pre>
# install (the install is system wide so you need administrator rights)<pre>sudo python setup.py install</pre>and type your password.
== 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.
=== Packaging ===
* [http://www.sveinbjorn.org/platypus Sveinbjorn Thordarson's Website] The author of Platypus, the Script Exec wrapper that launches the Inkscape binary.
* [http://freespace.ausgamers.com/2005/02/creating-os-x-application-bundles-step.html 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.
* [http://java.sun.com/developer/technicalArticles/JavaLP/JavaToMac3/ 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 [http://gimp-app.sourceforge.net/gimp.app.howto.txt 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.