[cairo-commit] [cairo-www] src/end_to_end_build_for_mac_os_x.mdwn
Carl Worth
cworth at freedesktop.org
Mon Oct 19 19:27:12 PDT 2009
src/end_to_end_build_for_mac_os_x.mdwn | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
New commits:
commit 2390c1fda901d1a2fd4773010de7b0a38a99baca
Author: travisgriggs <travisgriggs at web>
Date: Mon Oct 19 19:27:12 2009 -0700
diff --git a/src/end_to_end_build_for_mac_os_x.mdwn b/src/end_to_end_build_for_mac_os_x.mdwn
index f6846ec..7df7448 100644
--- a/src/end_to_end_build_for_mac_os_x.mdwn
+++ b/src/end_to_end_build_for_mac_os_x.mdwn
@@ -1,22 +1,23 @@
-Goal: Build CairoGraphics Framwork directory, using only X-Code. Produce fat binaries capable of running on 10.4, 10.5, 10.6, on PPC, and on Intel.
+Goal: Build CairoGraphics Frameworks directory, using only X-Code. Produce fat binaries capable of running on 10.4, 10.5, 10.6, on PPC, and on Intel.
Original Author: Travis Griggs (travisgriggs at gmail.com)
Original Version: 1.8.8
+
Other Tested Versions:
Tools Needed:
Terminal (or command line tool of choosing)
X Code installed
-***Initial Setup
+### Initial Setup
Designate a directory to work in. Clean it out and then we'll do all work in there with fresh copies.
export BuildDir=${HOME}/BuildCairo
rm -rf ${BuildDir}
mkdir ${BuildDir)
cd ${BuildDir}
-***Download and untar tarballs
+### Download and untar tarballs
Use curl to download FOUR tarballs: pkg-config, libpng, pixman, cairo. Adjust specific version paths as desired
@@ -42,7 +43,7 @@ Use curl to download FOUR tarballs: pkg-config, libpng, pixman, cairo. Adjust sp
Why the last 4 mv commans? The default directory names are things like pixman-0.1.16 (version numbers included in the name). Some of the packages have compile paths dependent on the simpler names. So we do all 4 of them to keep them simple and consistent.
-***Build Pkg-config
+### Build Pkg-config
Now we compile the pkg-config utility, and set up some environment variables to manage it. Make sure that if you open a new shell, you set the two PKG_CONFIG related variables again.
Why pkg-config? Pkg-config is a package configuration management tool. OSX comes with one, but it's very old and the Cairo build system wants a newer one. You may have a new one via something like macports, but we don't want some of the other macports derived pkg-config dependencies. Building our own keeps the build nice and isolated.
@@ -60,7 +61,7 @@ Why pkg-config? Pkg-config is a package configuration management tool. OSX comes
The --prefix argument affects the make install command, such that it places any binaries built in our own directory, requiring no root permissions of us. Makes it easy to clean everything up later too.
-***Setup environment variables for fat binary compilation
+### Setup environment variables for fat binary compilation
We set the following 3 environment variables to influence the compile/link operations buried in subsequent commands, so that we build fat binaries, that can be run as far back as 10.4. If you open a new shell, you'll need to set these variables again.
@@ -71,10 +72,10 @@ We set the following 3 environment variables to influence the compile/link opera
What if you want 64 bit builds too? Then you have a choice to make. If you want 64 bit, you have to set 10.5 as your low limit. And you end up with the following variant of the above. You should do only one of the 2 sets, the above 3 commands, or the 3 below.
export MACOSX_DEPLOYMENT_TARGET=10.5
- export LDFLAGS=-arch ppc -arch i386 -arch ppc64 -arch -isysroot /Developer/SDKs/MacOSX10.5.sdk
- export CFLAGS=-Os -arch ppc -arch i386 -arch ppc64 -arch -isysroot /Developer/SDKs/MacOSX10.5.sdk
+ export LDFLAGS=-arch ppc -arch i386 -arch ppc64 -arch x85_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+ export CFLAGS=-Os -arch ppc -arch i386 -arch ppc64 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-***Build and install libpng
+### Build and install libpng
Build the libpng library, and install it in our local build directory.
@@ -89,7 +90,7 @@ What's the --disable-dependency-tracking? We need that since we enabled all of t
Why are we doing this? CoreGraphics supports png functions, but the APIs are not the same as the wide spread libpng APIs, which Cairo is written for. We could try and use the one from macports, or some other source, but you'll need to track down and deal with those dependencies in that case.
-***Build and install pixman
+### Build and install pixman
Build the pixman library, and install it locally. Pixman is used by the Cairo library for (among other things) all of its fallback operations and Image surface type operations.
@@ -98,7 +99,7 @@ Build the pixman library, and install it locally. Pixman is used by the Cairo li
make
make install
-****Build and install cairo
+### Build and install cairo
This builds the final library. It's not ready for widespread distribution yet, keep going after this step.
@@ -109,7 +110,7 @@ This builds the final library. It's not ready for widespread distribution yet, k
-***Package dylibs as a relocatable Frameworks staging directory
+### Package dylibs as a relocatable Frameworks staging directory
Private Frameworks for a relocatable .app bundle in OSX, are by convention stored in a Framworks directory which is placed next to the MacOS. So we'll build that directory here. First, we'll make that directory and copy the relevant dylibs there.
@@ -120,7 +121,7 @@ Private Frameworks for a relocatable .app bundle in OSX, are by convention store
cp ${BuildDir}/lib/libcairo.2.dylib .
-Our freshly copied dylib's still have one problem. They have absolute filenames embedded in them, which look like our ${BuildDir} path. We use the install_name_tool to adjust the 'id' and 'dependency' fields found in the headers of the dylib files. The @ character is not a bug.
+Your freshly copied dylib's still have one problem. They have absolute filenames embedded in them, which look like our ${BuildDir} path. We use the install_name_tool to adjust the 'id' and 'dependency' fields found in the headers of the dylib files. The @ character is not a bug.
install_name_tool -id @executable_path/../Frameworks/libpng12.0.dylib libpng12.0.dylib
@@ -129,7 +130,7 @@ Our freshly copied dylib's still have one problem. They have absolute filenames
install_name_tool -change ${BuildDir}/lib/libpixman-1.0.dylib @executable_path/../Frameworks/libpixman-1.0.dylib libcairo.2.dylib
install_name_tool -change ${BuildDir}/lib/libpng12.0.dylib @executable_path/../Frameworks/libpng12.0.dylib libcairo.2.dylib
-***Congratulations!
+### Congratulations!
You've got a Frameworks directory you can move around now with relocatable path entries in it. Place it in your .app bundle in the Contents directory, next to the MacOS directory. In your executable, you can load and bind Cairo by passing "@executable_path/../Frameworks/libcairo.2.dylib" to dlopen().
More information about the cairo-commit
mailing list