|
|
(35 intermediate revisions by 7 users not shown) |
Line 1: |
Line 1: |
| {{Needs_update}}
| | __TOC__ |
|
| |
|
| = For the impatient = | | <span style="color:darkred;font-weight:bold">THIS PAGE IS OUTDATED AND UNMAINTAINED!</span> |
|
| |
|
| 1. Install [http://developer.apple.com/tools/xcode/ Xcode tools] from your OS X installation DVD
| | = Using MacPorts = |
|
| |
|
| 2. Download and install [http://www.macports.org/ MacPorts]
| | If you can build successfully with MacPorts, please update this file and remove above comment. |
|
| |
|
| 3. In Terminal (Applications>Utilities>Terminal) type
| | <ol> |
| <pre>sudo port selfupdate | | <li>Download and install [http://www.macports.org/ MacPorts] |
| sudo port install cairo boehmgc gtkmm gtk-engines2 intltool libxslt lcms popt poppler boost \
| | <li>Edit the MacPorts variants config (optional). |
| gsl gnome-vfs libgnomeprintui automake autoconf bzr</pre>
| | <br>Add this line to <code>/opt/local/etc/macports/variants.conf</code> |
| | <pre>-x11 +quartz</pre> |
| | <li>In Terminal (Applications>Utilities>Terminal) type |
| | <syntaxhighlight lang="bash">sudo port install \ |
| | adwaita-icon-theme \ |
| | boehmgc \ |
| | boost \ |
| | cairo \ |
| | ccache \ |
| | cmake \ |
| | double-conversion \ |
| | gdl3 \ |
| | gettext \ |
| | gsl \ |
| | gtkmm3 \ |
| | gtk-osx-application-gtk3 \ |
| | lcms2 \ |
| | libsoup \ |
| | libxslt \ |
| | ninja \ |
| | poppler \ |
| | potrace \ |
| | py-lxml \ |
| | py-numpy \ |
| | -x11 +quartz |
| | </syntaxhighlight> |
| | <li>In Terminal, get Inkscape |
| | <syntaxhighlight lang="bash">git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git</syntaxhighlight> |
| | <li>And build inkscape |
| | <syntaxhighlight lang="bash"> |
| | # use a clean MacPorts environment (optional) |
| | LIBPREFIX="/opt/local" |
| | export PATH="$LIBPREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin" |
|
| |
|
| <!-- Note: subversion is pre-installed on Leopard, so you may be fine leaving subversion out of the port install command chain.
| | # where to install |
| --> | | PREFIX="$PWD/install-prefix" |
| Grab a cup of coffee
| |
|
| |
|
| 4. In Terminal, get Inkscape
| | # where to build |
| <pre>
| | mkdir build |
| bzr branch lp:inkscape</pre>
| | cd build |
|
| |
|
| Grab another cup of coffee. This will take a while, as the full Inkscape source is nearly 500MB.
| | cmake \ |
| | -G Ninja \ |
| | -DCMAKE_PREFIX_PATH="$LIBPREFIX" \ |
| | -DCMAKE_INSTALL_PREFIX="$PREFIX" \ |
| | -DCMAKE_C_COMPILER_LAUNCHER=ccache \ |
| | -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ |
| | -DWITH_OPENMP=OFF \ |
| | ../inkscape |
|
| |
|
| 5. And build inkscape
| | ninja |
| <pre> | | ninja install |
| cd inkscape/packaging/macosx/
| | </syntaxhighlight> |
| ./osx-build.sh a c b i -s p</pre>
| | ''Note: Using [https://en.wikipedia.org/wiki/Ccache ccache] and [https://ninja-build.org/ ninja] is not required, but very common because it speeds up compilation.'' |
| | <li>Run Inkscape |
| | <syntaxhighlight lang="bash"> |
| | $PREFIX/bin/inkscape |
| | </syntaxhighlight> |
| | </ol> |
|
| |
|
| ''Et voilà''. If you want to understand what you just did, read on.
| | = Using Homebrew = |
|
| |
|
| = Requirements =
| | If you are using [https://brew.sh/ Homebrew] instead, you can still use the above guidelines with small modifications. |
| To compile Inkscape from source you need:
| | (Make sure you don't have any MacPorts stuff in your PATH.) |
| *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 (avoid documentation and example software for example). You need at least: gcc, Xcode, X11SDK.
| |
| *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 create a local branch of the current state of the [http://inkscape.org/bzr.php?lang=en BZR repository] using [http://bazaar.canonical.com/ bazaar]. <!-- 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] --> Bazaar is not pre-installed on Leopard - it is recommended to install a current version with MacPorts (<tt>sudo port install bzr</tt>).
| |
| *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 it no longer meets Inkscape's needs currently.)
| |
| * Working version of the <tt><tr1/unordered_set></tt> and <tt><tr1/unordered_map></tt> headers.
| |
|
| |
|
| Configure or build can fail on OS X Tiger and Leopard due to broken <tr1/unordered_set> header files because Apple's default compiler ([http://gcc.gnu.org/gcc-4.0/ GNU Compiler Collection 4.0.1]) and libstdc++ library ([http://gcc.gnu.org/libstdc++/ GNU Standard C++ Library v3]) installed by Xcode have never been fully updated to the last released version of the [http://gcc.gnu.org/gcc-4.0/changes.html#4.0.1 GCC 4_0 release series].
| | List of '''packages''' to install with brew |
| | (for Inkscape 1.4): |
|
| |
|
| If Inkscape 0.47+devel fails to configure with "error: You have a broken version of the <tr1/unordered_set> header. …" or fails to build with an [[build failure in tr1/hashtable|error]] in <tt>/usr/include/c++/4.0.0/tr1/hashtable</tt> it is necessary to either
| | <syntaxhighlight lang="bash"> |
| | brew install \ |
| | adwaita-icon-theme \ |
| | bdw-gc \ |
| | boost \ |
| | cairomm \ |
| | ccache \ |
| | cmake \ |
| | double-conversion \ |
| | gettext \ |
| | gsl \ |
| | gspell \ |
| | gtk-mac-integration \ |
| | gtkmm3 \ |
| | imagemagick \ |
| | intltool \ |
| | lcms2 \ |
| | libomp \ |
| | libsoup@2 \ |
| | libxslt \ |
| | ninja \ |
| | pkg-config \ |
| | poppler \ |
| | potrace |
| | </syntaxhighlight> |
|
| |
|
| a) install a [http://trac.macports.org/wiki/UsingTheRightCompiler newer version of GCC] via MacPorts and make it the default compiler with MacPorts 'gcc_select' or
| | You may substitute <code>imagemagick</code> with <code>graphicsmagick</code>. |
|
| |
|
| b) patch the installed <tt>tr1/hashtable</tt> header file of libstdc++-v3 as described in [[HashtableFixOSX]]
| | <code>gtk-mac-integration</code> is not needed with latest <code>1.2-dev</code>. |
|
| |
|
| ; gcc/g++ versions by Apple known to fail to compile Inkscape 0.47+devel bzr revno >= 8976 are
| | Some keg-only libraries need to be added to <code>$PKG_CONFIG_PATH</code> |
| : powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370)
| |
| : i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
| |
| : i686-apple-darwin9-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5577)
| |
|
| |
|
| = Compiling Inkscape with X11, using MacPorts [Recommended method]=
| | Some libraries can cause trouble if they are picked up from the SDK instead of Homebrew (observed with <code>libxslt</code> and <code>libxml2</code>). Adding them to <code>$PKG_CONFIG_PATH</code> should fix this. |
|
| |
|
| == Installing dependencies ==
| | Check out the source if you haven't already: |
| You can use MacPorts to list Inkscape dependencies:
| |
| <pre>port deps inkscape</pre>
| |
|
| |
|
| Some are mandatory and you can install them with the command:
| | <syntaxhighlight lang="bash">git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git</syntaxhighlight> |
| <pre>sudo port install boehmgc gtkmm gtk-engines2 intltool libxslt lcms popt boost gsl</pre> | |
|
| |
|
| Others provide additional functionality to Inkscape:
| | Then <code>cd inkscape</code> and follow the steps below. |
| * <code>gnome-vfs</code> : access to remote servers, in particular import from Open Clipart Library
| |
| * <code>aspell</code> : check spelling of text elements [Note: I have never seen it working on OS X, though at least it should install fine]
| |
| * <code>libgnomeprintui</code>
| |
| * <code>cairo</code> : ps and pdf export
| |
| * <code>poppler</code> : better pdf import
| |
| <pre>sudo port install gnome-vfs aspell libgnomeprintui cairo 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.
| |
| If you're unsure about MacPorts commands, you can find a guide that is easy to skim here: [http://guide.macports.org/ MacPorts Guide]
| |
|
| |
|
| In addition, Inkscape requires versions of the autotools more recent thant those that ship with OS X. Install them:
| | Tested with: |
| <pre>sudo port install autoconf automake</pre>
| | * M1 MacBook Air with macOS 11.6 and Inkscape 1.2-dev |
| | * M2 MacBook Air with macOS 13.0.1 and Inkscape 1.2.1, 1.2.x from git. |
| | * M2 Mac Mini with macOS 14.2 and Inkscape 1.4-dev. (After adding pkg-config.) |
|
| |
|
| More recent (Sep 2008) pre-packaged nightly builds for Mac OS X also feature additional dependencies:
| | <syntaxhighlight lang="bash"> |
| <pre>sudo port install librsvg libwpd libwpg libcroco</pre>
| | # use a clean Homebrew environment (optional) |
| | LIBPREFIX="/opt/homebrew" |
| | export PATH="$LIBPREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin" |
|
| |
|
| NB: At the time of editing (2008-12-01) there was a problem fetching "lzmautils" as the URL MacPorts tried to use as download source dies in a timeout.
| | # keg-only libraries |
| As this package is needed as a dependency for one or more packages noted above you need to download the source tarball of lzmautils from somewhere else (for example, from [ftp://sunfreeware.mirrors.tds.net/pub/sunfreeware/SOURCES/lzma-4.32.7.tar.gz here]) and put that into the local MacPorts repository at "/opt/local/var/macports/distfiles/lzmautils". You should now be able to run the commands above.
| | export PKG_CONFIG_PATH="$LIBPREFIX/opt/icu4c/lib/pkgconfig" |
| | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libsoup@2/lib/pkgconfig" |
|
| |
|
| Also make sure that you have "libxml2" and "libxslt" installed with MacPorts. This should have been installed previously, either directly or as a dependency.
| | # prevent picking up libxslt and libxml2 from the (wrong) SDK |
| You will need those later to compile the "lxml" Python module if you want to use Python effects. First check what's installed and if they are missing from your MacPorts repository install them by doing:
| | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libxslt/lib/pkgconfig" |
| | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libxml2/lib/pkgconfig" |
|
| |
|
| <pre>port installed
| | # where to install |
| sudo port install libxml2 libxslt</pre>
| | PREFIX="$PWD/install-prefix" |
|
| |
|
| == Pre-compiling the Python modules ==
| | mkdir -p build |
| | cd build |
|
| |
|
| If you cannot use the pre-built Python modules from [http://inkscape.modevia.com/macosx-snap/?C=M;O=D Modevia], say, because you're using an unsupported Python version or you just want to install from source you need to pre-compile both modules.
| | cmake \ |
| | -G Ninja \ |
| | -DCMAKE_SHARED_LINKER_FLAGS="-L$LIBPREFIX/lib" \ |
| | -DCMAKE_EXE_LINKER_FLAGS="-L$LIBPREFIX/lib" \ |
| | -DCMAKE_INSTALL_PREFIX=$PREFIX \ |
| | -DCMAKE_C_COMPILER_LAUNCHER=ccache \ |
| | -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ |
| | -DWITH_DBUS=OFF \ |
| | .. |
|
| |
|
| In case you are using a Python version installed through MacPorts do a search for both modules and install the ones suitable for the Python version activated within MacPorts.
| | ninja |
| <pre>port search lxml numpy</pre>
| | ninja install |
| | </syntaxhighlight> |
|
| |
|
| If you are using Leopard's default Python 2.5.1 installation or a more recent one (e.g. MacPython 2.6) you will need to compile both modules outside of MacPorts. Download both modules from [http://pypi.python.org PyPI] if they are available there for your Python version. At the time of editing (2008-12-01) both modules were only available through SVN for Python 2.6.
| | =Packaging= |
|
| |
|
| There are lots of tutorials for building and installing the "numpy" module. One good place to start looking is the [[GettingEffectsWorking#on_Mac_OS_X|Getting Effects Working]] entry referenced at the end of this guide.
| | If <code>$PREFIX/bin/inkscape</code> works when executed and you want to turn it into an app or a DMG, have a look at the files inside the <code>inkscape/packaging/macos</code> directory. More info can be found on upstream mibap: |
|
| |
|
| Building the "lxml" module deviates a little from the standard way, so if you cannot install it try the following command:
| | * https://github.com/dehesselle/mibap |
| <pre>cd /path/to/lxml/source
| |
| sudo python setup.py install \
| |
| --with-xslt-config=/opt/local/bin/xslt-config \
| |
| --with-xml2-config=/opt/local/bin/xml2-config</pre>
| |
| | |
| This tells it to use the libxml2 and libxslt packages we installed earlier with MacPorts instead of Mac OS X' default versions, which have been known to cause problems when trying to build "lxml".
| |
| | |
| If you are compiling the Python modules outside of MacPorts you will need to make a mental note for after running the .app-bundle building script (detailed [[CompilingMacOsX#Creating_an_.app_bundle|later]] in this guide) to copy the "lxml" and "numpy" dirs from the standard installation destination (by default "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages" for MacPython 2.6 and "/Library/Python/2.5/site-packages/" for Leopard's default Python 2.5.1 installation) to either
| |
| * the "extensions" folder inside the Inkscape.app bundle ("Inkscape.app/Contents/Resources/extensions") if all you care about is getting the Inkscape build to work with your Python version. This method is more foolproof but supports only one Python version.
| |
| * the "site-packages" folder inside the Inkspace.app bundle. The "site-packages" folder is the right place for putting your pre-compiled Python modules if you want to redistribute your build. Make a subfolder within "site-packages" with the name of your arch ("i386" for Intel, "PPC" for PowerPC or type <code>arch</code> into a Terminal window) and another subfolder within the arch folder with the name of your Python version (e.g. "2.5" or "2.6" etc.). This allows you to include support for multiple Python versions with your Inkscape build. Note, however, that if someone has multiple Python versions installed they may run into problems with the PATH order exported by the internal script ("Inkspace.app/Contents/Resources/bin/inkscape") responsible for preparing the Inkscape launch environment. | |
| | |
| Armed with this knowledge you should be able to take care of the "...needs the fantastic libxml2 wrapper..." message when executing Python effects. Normally the <code>osx-app.sh</code> script (detailed [[CompilingMacOsX#Creating_an_.app_bundle|later]]) should take care of this for you, but if for whatever reason it didn't you know how to copy the modules manually.
| |
| | |
| For further info refer to the [[GettingEffectsWorking#on_Mac_OS_X|Getting Effects Working]] section of this wiki.
| |
| | |
| == 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.
| |
| <pre>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"
| |
| </pre>
| |
| | |
| You can also use <code>[http://en.wikipedia.org/wiki/Ccache ccache]</code> (<code>sudo port install ccache</code>) to speed up the compilation a bit. To do so, add compiler variables:
| |
| <pre>export CC="ccache gcc"
| |
| export CXX="ccache g++"</pre>
| |
| | |
| == Configuring ==
| |
| If you compile Inkscape for the first time from a [http://inkscape.org/bzr.php?lang=en bzr branch] or checkout you need to generate the configure script. (not needed for tar builds)
| |
| Navigate to Inkscape's source directory and run:
| |
| <pre>./autogen.sh</pre>
| |
| | |
| Then run configure with the options <code>--disable-static --enable-shared</code> and <code>--prefix</code> which sets the directory where the build products are placed. It must be somewhere you have write access to.
| |
| <pre>./configure --disable-static --enable-shared --prefix=/path/to/build/products/</pre>
| |
| | |
| If 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>
| |
| | |
| Other configuration options can be set, check the list of options by issuing:
| |
| <pre>./configure --help</pre>
| |
| | |
| Here's an example which covers most options that can be set:
| |
| <pre>./configure --disable-static --enable-shared --prefix=/path/to/build/products/ --with-xft \
| |
| --with-gnome-vfs --with-python=/path/to/python/modules --enable-osxapp --enable-lcms \
| |
| --enable-poppler-cairo</pre>
| |
| | |
| | |
| If you see errors like "WARNING: aclocal's directory is /usr/share/aclocal, but... no file /usr/share/aclocal/glib-2.0.m4" during configure, you will need to find location of those files and set the flag as below (10.5)
| |
| | |
| <pre>export ACLOCAL_FLAGS="-I /opt/local/share/aclocal"</pre>
| |
| | |
| == Building and Installing ==
| |
| Just run:
| |
| <pre>make
| |
| 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:
| |
| <pre>cd packaging/macosx
| |
| ./osx-app.sh -s -b /path/to/install/prefix/bin/inkscape -p ../../Info.plist</pre>
| |
| 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:
| |
| <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).
| |
| | |
| == Automated build script ==
| |
| All essential steps are automated by a build script: <code>osx-build.sh</code>. It has built-in help so to know how to use it just type:
| |
| <pre>./osx-build.sh help</pre>
| |
| | |
| NB: Excluded steps involve Pre-compiliation of the Python modules and installing the additional nightly build features.
| |
| | |
| = Compiling a Universal Binary of Inkscape with X11, using MacPorts=
| |
| | |
| These instructions should work on both 10.4 and 10.5 machines with the latest Xcode version installed.
| |
| | |
| == Build Universal dependencies ==
| |
| | |
| The easiest way to do this is to create a new MacPorts installation. It is recommended that you install macports from source into a long prefix (of 50 character) such as "/opt/local-macports-with-a-really-long-directory-name/" -- this will allow enough space to later perform path rewriting on all the bundled libraries.
| |
| | |
| Once you have installed MacPorts, edit the $PREFIX/etc/macports/variants.conf file to have the following line:
| |
| <pre>+universal</pre>
| |
| This will cause MacPorts to install the Universal variant of each package you later ask it to install.
| |
| | |
| If you already have non-universal versions of some ports installed, for each of these you may need to deactivate the port and rebuild it, e.g.
| |
| <pre>sudo port -f uninstall cairo
| |
| sudo port clean cairo
| |
| sudo port -v install cairo +universal</pre>
| |
| | |
| == Build Universal Inkscape ==
| |
| | |
| First, Set your SDK, 10.5 for Leopard, 10.4u for TIger:
| |
| | |
| <CODE>export SDK=/Developer/SDKs/MacOSX10.5.sdk</code> (For Leopard)<br />
| |
| <CODE>export SDK=/Developer/SDKs/MacOSX10.4u.sdk</code> (For Tiger)<br />
| |
| | |
| Then, set up your environment to point to the MacPorts libraries:
| |
| <pre>export MACPORTS="/opt/local"
| |
| export PATH=$MACPORTS/bin:$MACPORTS/sbin:/usr/X11R6/bin:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin
| |
| # automake seach path
| |
| export CPATH="$MACPORTS/include"
| |
| # configure search path
| |
| export CPPFLAGS="-I$MACPORTS/include"
| |
| export LDFLAGS="-L$MACPORTS/lib"
| |
| # compiler arguments
| |
| export CFLAGS="-O3 -Wall -isysroot $SDK -arch ppc -arch i386"
| |
| export CXXFLAGS="$CFLAGS"</pre>
| |
| | |
| The final step is to configure and compile Inkscape. Inkscape must be configured with the following options:
| |
| | |
| <code>--enable-osxapp</code> Sets the correct path for Inkscape to be used from an .app bundle<br />
| |
| <code>--disable-dependency-tracking</code> Dependency tracking can't be used when compiling universal binaries.
| |
| | |
| Inkscape can then be built (with make), installed, and packaged into a Universal .app bundle using the standard .app bundle building instruction above.
| |
| | |
| = 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!
| |
| | |
| ++++++++++++++++++++++++++++++++++++++++++++++++++++
| |
| | |
| addition in Nov-2009 by Wolf:
| |
| Meanwhile building a native inkscape aqua version is quite easy - dont be afraid! I do ask every Mac OS X user to try it and to file or to support bug reports. The more bug report come in, the quicker we'll have a really working inkscape aqua. I'll try to provide binaries, but making them seem to be a bit more tricky. Here is a set of instructions - should be quite comprehensive: [[#Building Aqua November 2009]]
| |
| | |
| ++++++++++++++++++++++++++++++++++++++++++++++++++++
| |
| | |
| == 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:
| |
| <pre>sudo port install cairo +quartz+no_x11 cairomm pango +no_x11 poppler +quartz gtk2 +quartz</pre>
| |
| | |
| == Installing a second MacPorts tree (recommended approach) ==
| |
| Rather than deactivating and reactivating ports, you can also keep two MacPorts trees side by side, provided you install the second one from source. Let's say I want to install a new tree for native versions in /opt/local-native. I would do
| |
| <pre>export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
| |
| cd ~/MacPorts-1.x.x/
| |
| ./configure --prefix=/opt/local-native --with-tclpackage=/Library/Tcl/macports-native
| |
| make
| |
| sudo make install</pre>
| |
| | |
| You can set this second tree up to always build packages with specific variants. For example, you can edit the /opt/local-native/etc/macports/variants.conf file to have the following line:
| |
| <pre>+universal +no_x11 +quartz</pre>
| |
| You can omit the +universal if you only want to build inkscape for your host architecture.
| |
| You should also set alternate applications_dir and frameworks_dir variables in the /opt/local-native/etc/macports/macports.conf file so that applications and frameworks installed by this MacPorts (for example by python) don't clash with your standard MacPorts tree.
| |
| | |
| Then you need to have only one version of the port command in the PATH at any time so you need to setup your .bashrc (or .bash_profile or .profile) accordingly. I use shell aliases to quickly and temporarily switch to the native version:
| |
| <pre>alias portpathregular="export PATH=/opt/local/bin:/opt/local/sbin:/Developer/Tools:/usr/local/bin: \
| |
| /usr/X11R6/bin:/bin:/sbin:/usr/bin:/usr/sbin"
| |
| alias portpathnative="export PATH=/opt/local-native/bin:/opt/local-native/sbin:/Developer/Tools:/usr/local/bin: \
| |
| /usr/X11R6/bin:/bin:/sbin:/usr/bin:/usr/sbin"</pre>
| |
| NB: the \ are just to mark line continuation here. Omit them when editing your shell configuration file and put everything on one line.
| |
| | |
| == 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
| |
| <pre>cd packaging/macosx</pre>
| |
| 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>
| |
| 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/
| |
| ./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.
| |
| | |
| == Building Aqua from scratch, 2010 ==
| |
| As I had a nicely working X11 version, I didnt care about compiling for X11, so this is an aqua-only procedure, which fairly started from scratch.
| |
| | |
| Here is what was to do on a G4 (PPC) with Mac OS X 10.4.11:
| |
| | |
| Install [http://developer.apple.com/tools/xcode/ Xcode tools] from your OS X installation DVD.
| |
| Make sure you checked the optional install of MacOSX10.4u.sdk - this especially applies for Snow Leopard 10.6.
| |
| | |
| Install [http://www.macports.org macports], retrieve the inkscape sources.
| |
| | |
| In order to install gtk2 on a PowerPC, you may have to apply this workaround: [http://trac.macports.org/ticket/20372]. (Maybe this is obsolete by Feb, 2010).
| |
| | |
| If you want to use bazaar in order to keep your sources up to date, install it:
| |
| | |
| <pre>
| |
| sudo port install bzr
| |
| </pre>
| |
| | |
| How to use bazaar, have a look here: [[Working with Bazaar]].
| |
| | |
| Then copy into the terminal:
| |
| | |
| <pre>sudo port install autoconf automake
| |
| | |
| sudo port install librsvg libwpd libwpg libcroco
| |
| | |
| # older versionsof gtk2 than 2.18.8 need to be patched according to these instructions:
| |
| # http://trac.macports.org/ticket/22451
| |
| | |
| # so rather make sure you installed the latest gtk2 >=2.18.8:
| |
| | |
| sudo port install gtk2 +quartz+no_x11
| |
| | |
| sudo port install libxslt boost boehmgc gtkmm lcms intltool popt
| |
| | |
| sudo port install cairo +quartz+no_x11 cairomm pango +quartz+no_x11 poppler +quartz gtk-engines2
| |
| | |
| sudo port install gsl
| |
| | |
| sudo port install hicolor-icon-theme
| |
| | |
| sudo port install libxml2 libxslt
| |
| | |
| | |
| # optional to speed up the compiling process:
| |
| sudo port install ccache
| |
| export CC="ccache gcc"
| |
| export CXX="ccache g++"
| |
| # ++++++++++++++++++++++++++++++++++++++++++++++++++++
| |
| | |
| cd path-to-inkscape-sources/packaging/macosx
| |
| | |
| # Edit the file osx-build.sh to uncomment (enable) the configure option --enable-osxapp
| |
| # (line 24), if neccessary. I used TextWrangler for this, pico or another command line editor will do the same.
| |
| | |
| # Back to the terminal:
| |
| | |
| # autogen
| |
| sudo ./osx-build.sh a
| |
| | |
| # configure it:
| |
| sudo ./osx-build.sh c
| |
| | |
| # build it:
| |
| sudo ./osx-build.sh b
| |
| | |
| # install it:
| |
| sudo ./osx-build.sh i
| |
| | |
| # test it:
| |
| cd ../../Build/bin/./inkscape
| |
| | |
| # or double click the inkscape image in path-to-inkscape-sources/Build/bin
| |
| | |
| # (This may not work - not reason to fall into despair so far, just go ahead an pack it…)
| |
| | |
| # Build a Mac OS X package:
| |
| | |
| # download python packages at http://inkscape.modevia.com/macosx-snap/Python-packages.dmg
| |
| # put the contents in a folder named "python" and put it somewhere - the following command
| |
| # expects it in the folder in which the inkscape sources folder lives
| |
| | |
| # edit <path-to-inkscape-sources>/packaging/macosx/Resources/bin/inkscape and
| |
| # uncomment line 33:
| |
| | |
| # export DYLD_LIBRARY_PATH="$TOP/lib"
| |
| | |
| cd <path-to-inkscape-sources>/packaging/macosx
| |
| | |
| # and pack:
| |
| | |
| ./osx-build.sh p -py ../../../python/
| |
| | |
| | |
| # If your building runs through smoothly, you can automate the build process for the next version by doing all at once:
| |
| | |
| sudo ./osx-build.sh a c b i -py ../../../python/ p d
| |
| | |
| # To avoid X11 from launching simultaneously), edit
| |
| inkscape.app/Contents/Resources/script and add at line 45
| |
| | |
| killall X11
| |
| | |
| # Hopefully more skilled people than me will find a nicer solution than this very brutal hack.
| |
| | |
| </pre>
| |
| In the end this procedure works pretty straightforward, delivering a native inkscape which works fairly well.
| |
| | |
| As the author of this lines knows very little about compiling etc., I do recommend to send requests for support to the devel mailing list (mailto: inkscape-devel@lists.sourceforge.net). I'm reading there and may occasionally have the chance to answer some questions.
| |
| | |
| = Compiling with clang 3.3 and libc++ (c++11 enabled) (2013) =
| |
| This is a quick outline on how to compile Inkscape on Mac OS X 10.6.8 Snow Leopard with a c++11 enabled compiler and c++ library.
| |
| The default compiler for Snow Leopard is gcc 4.2 which does not support any c++11 features. Thus, the following steps will compile and install clang 3.3 and libc++ first. These are used by Apple on newer Mac OS versions, so probably some of these steps are not necessary there.
| |
| | |
| Starting with a clean installation of Snow Leopard, do the following:
| |
| | |
| 1. Install XCode from your Mac OS DVD and update it.
| |
| | |
| 2. Get the Snow Leopard-PKG of Macports from [http://www.macports.org/install.php here] (in my case "MacPorts-2.2.0-10.6-SnowLeopard.pkg") and install it.
| |
| | |
| 3. Open a terminal and run a selfupdate:
| |
| sudo port selfupdate
| |
| 4. Install clang 3.3:
| |
| sudo port install clang-3.3 -analyzer -python27
| |
| 5. Install libc++:
| |
| sudo port install libcxx
| |
| 6. Now we can build Inkscape's dependencies against our brand new c++11 library. Let's start with gettext:
| |
| sudo port install gettext configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++" configure.cxx="clang++ -stdlib=libc++"
| |
| 7. Now make sure that there are no dynamic libraries linked against the default libstdc++, or else linking Inkscape later will fail:
| |
| otool -l /opt/local/lib/*.dylib | less
| |
| Simply search the output for "libstdc++", this string shouldn't appear anywhere. Do this after the following commands as well so you don't have to rebuild all of the packages in case something goes wrong!
| |
| | |
| 8. Now install boost and libsigc++:
| |
| sudo port install boost configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++" configure.cxx_stdlib="libc++"
| |
| sudo port install libsigcxx2 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++" configure.cxx="clang++ -stdlib=libc++"
| |
| 9. CMake refuses to build with libc++, so build it against the system's c++ library. This doesn't matter as it is only necessary for compiling the following packages and it doesn't install dylibs:
| |
| sudo port install cmake configure.compiler=macports-clang-3.3
| |
| 10. Install the other dependencies:
| |
| sudo port install cairo +quartz -x11 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install cairomm +quartz -x11 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install pango +quartz -x11 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install pangomm +quartz -x11 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install gdk-pixbuf2 -x11 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install gtk2 +no_x11 +quartz -x11 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install atkmm configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install gtkmm +quartz -x11 configure.compiler=macports-clang-3.3 configure.cxxflags="-stdlib=libc++"
| |
| sudo port install boehmgc gsl bzr lcms
| |
| 11. Now we can get the Inkscape source:
| |
| mkdir Inkscape
| |
| cd Inkscape
| |
| bzr branch lp:inkscape trunk
| |
| 12. configure and compile it:
| |
| mkdir trunk_build
| |
| cd trunk_build
| |
| ../trunk/autogen.sh
| |
| ../trunk/configure --prefix=/Users/yourname/Inkscape/trunk_install --disable-static --enable-shared CC="clang" CXX="clang++" \
| |
| CXXFLAGS="-std=c++11 -stdlib=libc++ -I/opt/local/include" CPPFLAGS="-I/opt/local/include -U__STRICT_ANSI__"
| |
| make -j4
| |
| 13. If all went well, you can now install it to a local directory:
| |
| make install
| |
| 14. Run it!
| |
| src/inkscape
| |
| | |
| This should be it.
| |
| | |
| = Enabling python effects =
| |
| moved to [[GettingEffectsWorking]]. They should work out of the box in the new versions anyway.
| |
| | |
| = Links =
| |
| | |
| == User Examples ==
| |
| * Adam Strzeleki has outlined some improvements to this process on the Inkscape [http://www.nabble.com/Inkscape-native-Mac-OS-X-build---look-improvements-td14733036.html email list]. See his screenshot from January 10, 2008 [http://www.nabble.com/attachment/14733036/1/Inkscape%20OSX%20PL.gif here].
| |
| * JiHO has a video of his builds [http://jo.irisson.free.fr/?p=34 here] and [http://jo.irisson.free.fr/?p=62 here].
| |
| * Mac OS X native (aqua), PPC-only, Tiger-only build of 0.47, can be retrieved here: [http://verkehrsplanung.com/Inkscape_aqua_PPC_047.zip]. NOT FOR PRODUCTIVE USE - JUST TESTING! - (Nevertheless I'm doing quite a bit productive work on it… (-;)
| |
| | |
| == 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.
| |
|
| |
|
| | Follow the steps to install the toolset, package the app, and create a DMG. In case you use upstream mibap, you will get the app under <code>/Users/Shared/work/mibap-*/</code> and you will get a DMG file in the same place you ran <code>./build_inkscape.sh</code>. |
|
| |
|
| =See also= | | =See also= |
| | * [[Tracking Dependencies]] |
| | * [[Extension requirements]] |
| *[[Compiling Inkscape]] | | *[[Compiling Inkscape]] |
| *[[Notes on Packaging for OS X]] | | *[[Notes on Packaging for OS X]] |
| | * https://github.com/valerioa/Inkscape-MacOS-Curated-Build |
| | * [https://github.com/ipatch/homebrew-us-05/blob/master/inkscape/inkscape-building-for-macOS.md ipatch's collection of notes] about building Inkscape using Homebrew |
|
| |
|
| [[Category:Developer Documentation]] | | [[Category:Developer Documentation]] |