== DOWNLOADING SOURCE TREES ==

To download the source trees to most dependencies, just run

$ ./common.sh -d

The download script requires Python 2.5.1 or later, which comes with
Mac OS X 10.5 "Leopard" . You can confirm which version of Python you are using
by running `python --version`; if it is an older version, you can upgrade at
http://python.org/download/mac/.

Alternatively, you can substitute curl and xargs:

$ mkdir source; cd source; (cat ../urls.txt | xargs -I %url% curl -LO %url%) \
&& (ls -1 *.tar.gz | xargs -I %file% tar xzf %file%) && (ls -1 *.tar.bz2 | \
xargs -I %file% tar xjf %file%); rm -f *.tar.*; cd ..


=== DOWNLOADING PIDGIN SOURCE TREE ===

The Pidgin source is not installed by the download script. Adium currently uses
libpurple 2.4.3mtn from branch im.pidgin.pidgin. Patches applied during the
build process expect this version.

The official documentation for getting Pidgin source is maintained at
http://developer.pidgin.im/wiki/UsingPidginMonotone, simplified here. The
Pidgin repository is run by monotone. You can find a Mac OS X monotone
installer at http://www.monotone.ca/.


==== INITIAL CHECKOUT ====

We will download a snapshot of the monotone database to bootstrap the checkout
process. Please note that this file is nearly 200 MB.

$ cd source; mkdir im.pidgin.pidgin; cd im.pidgin.pidgin; curl -LO \
http://developer.pidgin.im/static/pidgin.mtn.bz2 && bzip2 -d pidgin.mtn.bz2 \
&& mtn db -d pidgin.mtn migrate && mtn -d pidgin.mtn pull --set-default \
pidgin.im "im.pidgin.*" && mtn -d pidgin.mtn co -b im.pidgin.pidgin .; cd ../..


==== UPDATING ====

To update the Pidgin source tree, just run

$ cd source/im.pidgin.pidgin; mtn pull; cd ../..


==== MOVING ====

If you move the Pidgin source tree, you must update the absolute path of the
pidgin.mtn database file in source/im.pidgin.pidgin/_MTN/options. Otherwise,
you will be unable to pull changesets from the monotone repository.


=== DOWNLOADING MSN-PECAN SOURCE TREE ===

 * Skip these steps if you are building without msn-pecan.

The msn-pecan source is not installed by the download script. Adium currently
uses the adium-test branch. You must have Pidgin installed as above to use
msn-pecan.

The msn-pecan repository is run by git. You can find a Mac OS X git installer
at http://code.google.com/p/git-osx-installer/downloads/list?can=3.


==== INITIAL CHECKOUT ====

To check out the msn-pecan master source tree, run

$ cd source/im.pidgin.pidgin/libpurple/protocols; git clone \
git://github.com/felipec/msn-pecan.git msn_pecan && ln \
msn_pecan/adium/Makefile.am msn_pecan && cd ../../../..


==== UPDATING ====

To update the msn-pecan source, run

$ cd source/im.pidgin.pidgin/libpurple/protocols/msn_pecan; git pull; \
cd ../../../../..


== CONFIGURATION ==

The configuration settings are found in common.sh. This script is executed
during the build process to set up the build environment. You will need to edit
this file to change build behavior such as which SDK to use.


=== SETTING PIDGIN PATH ===

Before building libpurple, we must tell the build scripts where to find the
Pidgin source. In the common.sh file, under the "# Directories" heading, add

export PIDGIN_SOURCE="$SOURCEDIR/im.pidgin.pidgin"

If you did not check out the Pidgin source as above, substitute the absolute
path of your local Pidgin source tree.


=== SETTING GCC VERSION ===

On some versions of Mac OS X, the default gcc compiler is 4.2.1, which may
cause problems. You can verify which version of gcc is used by running
`gcc --version`.

To use gcc 4.0.1, edit the common.sh file. Under the "# Compiler options"
heading, add the line

export CC=/usr/bin/gcc-4.0


== BUILDING ==

A number of scripts are included to simplify the process of building libpurple
and other dependencies.

You must have automake 1.10 or later installed to build the dependencies. The
easiest way to install this is via MacPorts (http://www.macports.org/):

$ port install automake


=== GENERAL DEPENDENCIES ===

$ ./general_dependencies_make.sh

This phase builds pkg-config, gettext, and glib. The output of the build
process is written to ./build/dep_make.log. Some configuration output may be
found in the build subdirectores; look for config.log files.

You will not need to run this part of the build process again unless the
dependencies above are updated.


=== LIBPURPLE DEPENDENCIES ===

$ ./purple_dependencies_make.sh

This phase builds Meanwhile, Gadu-Gadu, and intltool. The output of the build
process is written to ./build/purple_dep_log. Some configuration output may be
found in the build subdirectories; look for config.log files.

You will not need to run this part of the build process again unless the
dependencies above (including general dependencies) are updated.


=== LIBPURPLE ===

$ ./purple_make.sh [--ppc | --i386 ] [--regenerate] [--msn-pecan | --msn]

This phase builds libpurple. The output of the build process is written to
STDOUT.

The script to build libpurple accepts some options:

 * You may limit the build to one architecture by using either --ppc or --i386,
   but note that you cannot build a Universal Binary when using either option.
   This is mainly useful for checking that code compiles.

 * If you would like to force the script to rerun autoconf and automake, use
   the --regenerate option. Otherwise, it will detect whether or not to run
   them based on the presence or absence of needed files.

 * If you are building with msn-pecan, use the --msn-pecan option. This is the
   default. Note that current releases of Adium use msn-pecan.

 * If you are building with libpurple's msnp14/15 implementation, use the --msn
   option.

You must have set the PIDGIN_SOURCE variable for this script to run; see
SETTING PIDGIN PATH above.

You must run this part of the build process each time you update libpurple.


=== UNIVERSALIZE ===

$ ./universalize.sh

This phase creates Universal Binaries from the PowerPC- and Intel-native
binaries. The output of the build process is written to STDOUT.

The build products are located in ./build/Frameworks.

You must run this part of the build process each time you update any of the
dependencies, including libpurple.


=== MAKE PO FILES ===

$ ./make_po_files.sh

This phase generates localization files. The output of the build process is
written to STDOUT.

You must run this part of the build process after a clean build, or whenever
libpurple has received localization updates.


== INSTALLING ==

You can copy the built frameworks to Adium with

$ ./copy_frameworks.sh

You should then build Adium to link against the new frameworks.
