Kyng Chaos
“The beast is actively interested only in now, and, as it is always now and always shall be, there is an eternity of time for the accomplishment of objects.”
- the wisdom of Tarzan

Cairo Build

Cairo has 2 parts – a low-level image library, pixman, and cairo itself. Pixman is compiled first. Cairo also needs Fontconfig – I'm putting the instructions for that here, since it's just a one-shot for Cairo. (Sure, there is fontconfig in X11, but that's tied to the X11 freetype, and I don't like to depend on Apple's X11.)

Cairo and fontconfig need pkg-config to configure, though it can be overridden with a small hack (I do not want pkg-config on my Mac). And strangely, the cairo and fontconfig configures allow manual configuration of the libraries they're locating, yet still want the pkg-config executable to exist…

Fake Pkg-config

Just thought of this as I wrote this up. This will work only for cairo and fontconfig, but may work for other packages that have manual configure override. If it tries to use the fake pkg-config as a normal pkg-config, it will fail.

You can do this right in the source, or one level up if you don't want to redo it for every version. For the fontconfig and cairo instructions below, I'll do this one level up from the source, so they can both use the same fake. This assumes that the cairo and fontconfig source are in the same parent folder. So, cd to that parent folder, then in a Terminal:

echo "if [ \"\$1\" = \"--atleast-pkgconfig-version\" ] ; then
echo 1
fi" > pkgconfigfake
chmod +x pkgconfigfake

Fontconfig

version: 2.8.0
source: http://fontconfig.org/wiki/

parallel: OK

Note: I adjusted font, cache and config file locations to be more appropriate to the OSX system structure.

Snow Leopard

export MACOSX_DEPLOYMENT_TARGET=10.6
./configure --with-cache-dir=/var/tmp/fontconfig --with-confdir=/etc/fontconfig \
--disable-static --disable-dependency-tracking --with-default-fonts=/Library/Fonts \
--with-add-fonts=/Network/Library/Fonts,/System/Library/Fonts,/Library/Fonts,/usr/X11/lib/X11/fonts,/usr/share/fonts,~/Library/Fonts \
--with-freetype-config=/usr/local/bin/freetype-config \
--enable-libxml2 \
CFLAGS="-Os -arch i386 -arch x86_64" \
LIBXML2_CFLAGS="-I/usr/include/libxml2" \
LIBXML2_LIBS="-lxml2 -lz -lpthread -licucore -lm" \
PKG_CONFIG=../pkgconfigfake
make
sudo make install

Leopard

export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --with-cache-dir=/var/tmp/fontconfig --with-confdir=/etc/fontconfig \
--disable-static --disable-dependency-tracking --with-default-fonts=/Library/Fonts \
--with-add-fonts=/Network/Library/Fonts,/System/Library/Fonts,/Library/Fonts,/usr/X11/lib/X11/fonts,/usr/share/fonts,~/Library/Fonts \
--with-freetype-config=/usr/local/bin/freetype-config \
--enable-libxml2 \
CFLAGS="-Os -arch ppc -arch i386 -arch ppc64 -arch x86_64" \
LIBXML2_CFLAGS="-I/usr/include/libxml2" \
LIBXML2_LIBS="-lxml2 -lz -lpthread -licucore -lm" \
PKG_CONFIG=../pkgconfigfake
make
sudo make install

Tiger

export MACOSX_DEPLOYMENT_TARGET=10.4
./configure --with-cache-dir=/var/tmp/fontconfig --with-confdir=/etc/fontconfig \
--disable-static --disable-dependency-tracking --with-default-fonts=/Library/Fonts \
--with-add-fonts=/Network/Library/Fonts,/System/Library/Fonts,/Library/Fonts,/usr/X11/lib/X11/fonts,/usr/share/fonts,~/Library/Fonts \
--with-freetype-config=/usr/local/bin/freetype-config \
--enable-libxml2 \
CFLAGS="-Os -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
LIBXML2_CFLAGS="-I/usr/include/libxml2" \
LIBXML2_LIBS="-lxml2 -lz -lpthread -licucore -lm" \
PKG_CONFIG=../pkgconfigfake
make
sudo make install

Pixman

version: 0.18.2
source: http://www.cairographics.org/ (make sure to get both cairo and pixman sources)

parallel: OK

Pixman is tricky to compile universal. It uses Altivec code on PPC and SSE2 code on Intel. So you must compile 2 separate libraries, then use lipo to merge them.

Snow Leopard

Well, Snow is all intel, so no split build!

export MACOSX_DEPLOYMENT_TARGET=10.6
./configure --disable-dependency-tracking --disable-static \
CFLAGS="-Os -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64"
make
sudo make install

Leopard

export MACOSX_DEPLOYMENT_TARGET=10.5
mkdir ../temp-leo-intel
export DESTDIR=`cd ../temp-leo-intel; pwd`
./configure --disable-dependency-tracking --disable-static \
CFLAGS="-Os -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64"
make
make install
make distclean
mkdir ../temp-leo-ppc
export DESTDIR=`cd ../temp-leo-ppc; pwd`
./configure --disable-dependency-tracking --disable-static \
CFLAGS="-Os -arch ppc -arch ppc64" LDFLAGS="-arch ppc -arch ppc64"
make
make install
sudo lipo -create ../temp-leo-intel/usr/local/lib/libpixman-1.dylib \
../temp-leo-ppc/usr/local/lib/libpixman-1.dylib \
-output /usr/local/lib/libpixman-1.dylib
sudo cp -Rf ../temp-leo-intel/usr/local/include/pixman-1 /usr/local/include

Tiger

export MACOSX_DEPLOYMENT_TARGET=10.4
mkdir ../temp-tig-intel
export DESTDIR=`cd ../temp-tig-intel; pwd`
./configure --disable-dependency-tracking --disable-static \
CFLAGS="-Os -arch i386" LDFLAGS="-arch i386"
make
make install
make distclean
mkdir ../temp-leo-ppc
export DESTDIR=`cd ../temp-leo-ppc; pwd`
./configure --disable-dependency-tracking --disable-static \
CFLAGS="-Os -arch ppc" LDFLAGS="-arch ppc"
make
make install
sudo lipo -create ../temp-tig-intel/usr/local/lib/libpixman-1.dylib \
../temp-tig-ppc/usr/local/lib/libpixman-1.dylib \
-output /usr/local/lib/libpixman-1.dylib
sudo cp -Rf ../temp-tig-intel/usr/local/include/pixman-1 /usr/local/include

Cairo

version: 1.8.8
source: http://www.cairographics.org/ (make sure to get both cairo and pixman sources)

parallel: OK

Note: there are Quartz surface and font backends, but they appear to be broken for 64bit. But they would have limited use in the GIS packages that I focus on, since they require software to know about OSX APIs.

Snow Leopard

export MACOSX_DEPLOYMENT_TARGET=10.6
./configure --disable-dependency-tracking --disable-static --disable-xlib --without-x \
--disable-quartz-font --disable-quartz \
pixman_CFLAGS=-I/usr/local/include/pixman-1 pixman_LIBS="-L/usr/local/lib -lpixman-1" \
png_REQUIRES=libpng png_LIBS="-L/usr/local/lib -lpng" png_CFLAGS=-I/usr/local/include \
FONTCONFIG_CFLAGS=-I/usr/local/include FONTCONFIG_LIBS="-L/usr/local/lib -lfontconfig -liconv -lxml2" \
FREETYPE_CFLAGS=-I/usr/local/include FREETYPE_LIBS="-L/usr/local/lib -lfreetype" \
CFLAGS="-Os -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64" \
PKG_CONFIG=../pkgconfigfake

Then, edit config.h and add the line

#define AC_APPLE_UNIVERSAL_BUILD 1

near the top (there is an #undef there for the same macro). Then finish:

make
sudo make install

Leopard

export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --disable-dependency-tracking --disable-static --disable-xlib --without-x \
--disable-quartz-font --disable-quartz \
pixman_CFLAGS=-I/usr/local/include/pixman-1 pixman_LIBS="-L/usr/local/lib -lpixman-1" \
png_REQUIRES=libpng png_LIBS="-L/usr/local/lib -lpng" png_CFLAGS=-I/usr/local/include \
FONTCONFIG_CFLAGS=-I/usr/local/include FONTCONFIG_LIBS="-L/usr/local/lib -lfontconfig -liconv -lxml2" \
FREETYPE_CFLAGS=-I/usr/local/include FREETYPE_LIBS="-L/usr/local/lib -lfreetype" \
CFLAGS="-Os -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
LDFLAGS="-arch i386 -arch x86_64 -arch ppc -arch ppc64" \
PKG_CONFIG=../pkgconfigfake

Then, edit config.h and add the line

#define AC_APPLE_UNIVERSAL_BUILD 1

near the top (there is an #undef there for the same macro). Then finish:

make
sudo make install

Tiger

export MACOSX_DEPLOYMENT_TARGET=10.4
./configure --disable-dependency-tracking --disable-static --disable-xlib --without-x \
--disable-quartz-font --disable-quartz \
pixman_CFLAGS=-I/usr/local/include/pixman-1 pixman_LIBS="-L/usr/local/lib -lpixman-1" \
png_REQUIRES=libpng png_LIBS="-L/usr/local/lib -lpng" png_CFLAGS=-I/usr/local/include \
FONTCONFIG_CFLAGS=-I/usr/local/include FONTCONFIG_LIBS="-L/usr/local/lib -lfontconfig -liconv -lxml2" \
FREETYPE_CFLAGS=-I/usr/local/include FREETYPE_LIBS="-L/usr/local/lib -lfreetype" \
CFLAGS="-Os -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
LDFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
PKG_CONFIG=../pkgconfigfake

Then, edit config.h and add the line

#define AC_APPLE_UNIVERSAL_BUILD 1

near the top (there is an #undef there for the same macro). Then finish:

make
sudo make install
macosx/build/cairo.txt · Last modified: 2010/07/27 20:43 by kyngchaos
Copyright © 2004-2010 William Kyngesburye Driven by DokuWiki Recent changes RSS feed