User:Bitmap/Building Picard on OS X: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
(New page: This guide details the process I've used to build Tiger-compatible Picard app bundles on OS X (I used Snow Leopard). There are many ways to achieve this, but I've found these steps to be t...)
 
No edit summary
Line 21: Line 21:
export MACOSX_DEPLOYMENT_TARGET="10.4"
export MACOSX_DEPLOYMENT_TARGET="10.4"


Make sure you're using gcc 4.0.2. I believe I had to change the symlinks (I don't know of a better way on Snow Leopard) because setting CC= didn't work for some dependencies.
Make sure you're using gcc 4.0.2. I believe I had to change the symlinks (I don't know of a better way on Snow Leopard) because setting CC= didn't work for some dependencies. ([http://stackoverflow.com/questions/1165361/setting-gcc-4-2-as-the-default-compiler-on-mac-os-x-leopard I did this], but for 4.0 instead of 4.2.)


==Dependencies==
==Dependencies==

Revision as of 17:44, 11 May 2011

This guide details the process I've used to build Tiger-compatible Picard app bundles on OS X (I used Snow Leopard). There are many ways to achieve this, but I've found these steps to be the simplest and most compatible after much trial and error.

Last updated on 2011-05-11 for Picard 0.13.

Avoid MacPorts

There are a lot of architecture issues in MacPorts that took days to debug. After working around those, Qt4 had broken functionality, such as drag and drop from Finder not working. Qt4 takes an entire day to build on my machine, whereas the precompiled Qt package from Nokia works just fine. The rest of the dependencies will be installed manually to /usr/local.

Prerequisites

  • XCode 3.2.6, with the 10.4 SDK installed at /Developer/SDKs/MacOSX10.4u.sdk (it's a selectable option in the installer).
  • Python 2.7.1. Since we want compatibility with Tiger/i386, make sure to install this one: python-2.7.1-macosx10.3.dmg. Use the provided Update Shell Profile.command to make this your default Python.
  • Qt 4.7.3. Install this one: qt-mac-carbon-opensource-4.7.3.dmg.

Set up your environment

Make sure /usr/local/bin is in your PATH, and have the following set in your .profile (or do it manually):

export CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -I/usr/local/include"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-arch i386 -Xlinker -headerpad_max_install_names -L/usr/local/lib"
export MACOSX_DEPLOYMENT_TARGET="10.4"

Make sure you're using gcc 4.0.2. I believe I had to change the symlinks (I don't know of a better way on Snow Leopard) because setting CC= didn't work for some dependencies. (I did this, but for 4.0 instead of 4.2.)

Dependencies

Now you have to install a bunch of dependencies by hand. Or, that's what you would have to do if I hadn't wrote this super-convenient (hack) script for you: build-deps.sh (run from an empty directory).

I have no doubt the script will break somewhere for someone—help me fix it. :)

Finally, you'll need two Python modules: py2app and mutagen. Install them manually or just use easy_install. Be sure to install them for the correct Python version!

Building Picard

Have the Picard source extracted somewhere and apply this patch: fix-build.patch.

We also need to create the file build.cfg in the source directory. Mine looks like this:

[directshow] 
libs = 
cflags = 

[libofa]
libs = -L/usr/local/lib -lofa
cflags = -I/usr/local/include

[avcodec]
libs = -L/usr/local/lib -lavcodec -lavformat -lavutil -lvorbis -lvorbisenc -logg -lmp3lame -lfaac
cflags = -I/usr/local/include

[build]
with-directshow = False
with-avcodec = True
with-libofa = True

Now we should be able to build Picard. It requires some more hacks, but I wrote a build script that implements them, to make things fast and convenient: build.sh.

Run this, and if all goes well, you'll end up with an app bundle in the dist directory. We're done! Yay!