1 |
Compiling libgig for Mac OS X with XCode |
2 |
======================================== |
3 |
|
4 |
Requirements |
5 |
------------ |
6 |
|
7 |
The XCode project uses autotools build files. On Mac OS 10.4, you need |
8 |
to install pkg-config (available at http://pkgconfig.freedesktop.org/wiki/). |
9 |
|
10 |
If you are to build the CVS snapshot, then you need to do the following |
11 |
steps to make autotools work correctly: |
12 |
|
13 |
$ sudo ln -sf /usr/bin/glibtoolize /usr/local/bin/libtoolize |
14 |
$ sudo cat >/usr/local/bin/aclocal <<'EOF' |
15 |
#!/bin/sh |
16 |
/usr/bin/aclocal -I /usr/local/share/aclocal $@ |
17 |
EOF |
18 |
$ sudo chmod +x /usr/local/bin/aclocal |
19 |
|
20 |
Layout of the Directories |
21 |
------------------------- |
22 |
|
23 |
The XCode project for libgig creates a temporary build directory as |
24 |
"$LIBGIG/../temp_build/$BUILD_STYLE" (where $LIBGIG is the libgig |
25 |
directory, and $BUILD_STYLE is the build style defined in the XCode |
26 |
project). In this directory, the following subdirectories are created |
27 |
and used: |
28 |
$BASEGIG.build: |
29 |
Intermediate build directory. Symbolic links to the original |
30 |
source files are placed and "configure && make" is performed in |
31 |
this directory. ($BASEGIG is the basename of the libgig directory.) |
32 |
local: |
33 |
The products are "installed" in this directory. libgig.a is in |
34 |
local/lib, and gigdump, gigextract, dlsdump, rifftree are in |
35 |
local/bin. |
36 |
Such a layout allows you to build binaries of different architectures |
37 |
(and build options) independently. On the other hand, you will need to |
38 |
link libgig.a statically because you cannot expect other users to place |
39 |
libgig.a at the same path. The XCode project takes care of this by |
40 |
giving "--disable-shared" to configure. |
41 |
|
42 |
Also note that this temporary directory is outside the libgig directory |
43 |
and will be shared with the Xcode projects for other linuxsampler |
44 |
subproducts. So it is best to create a common directory for all |
45 |
linuxsampler subproducts and place the libgig directory (and the |
46 |
directories of other linuxsampler subproducts) in it. |
47 |
|
48 |
Universal Binaries |
49 |
------------------ |
50 |
|
51 |
You can create the Universal Binaries by selecting "Deployment_UB" build |
52 |
style and build. The binaries for i386 and ppc architectures are built |
53 |
separately and then automatically combined. The products are found in |
54 |
$LIBGIG/../temp_build/Deployment_UB/local/{bin,lib}. |
55 |
|
56 |
You can also create the binaries for i386 and ppc architectures |
57 |
separately by selecting "Deployment_i386" and "Deployment_ppc" built |
58 |
styles respectively. This may be more convenient when you make your |
59 |
binary exclusively for your own use, and/or the required libraries |
60 |
(e.g. libsndfile, see below) are available only for a single |
61 |
architecture. |
62 |
|
63 |
Note that the current XCode project does _not_ take care of libgig.la |
64 |
and pkgconfig/gig.pc when creating the Universal Binary. |
65 |
|
66 |
The libgig project is dependent on libsndfile, but you may not |
67 |
have a Universal Binary version of libsndfile. Don't worry, you |
68 |
can still create UB of libgig products. Follow these steps: |
69 |
|
70 |
- Get the sources of libsndfile and extract in $LIBGIG/.. |
71 |
- cd to $LIBGIG/../libsndfile-* |
72 |
- env BUILD_STYLE=Deployment_ppc \ |
73 |
WITH_INSTALL=1 \ |
74 |
CONFIG_OPTIONS="--disable-shared" \ |
75 |
BUILD_BASE_DIR="$PWD/../temp_build" \ |
76 |
SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" \ |
77 |
/bin/sh $LIBGIG/osx/autoconf_builder.sh |
78 |
- env BUILD_STYLE=Deployment_i386 \ |
79 |
WITH_INSTALL=1 \ |
80 |
CONFIG_OPTIONS="--disable-shared" \ |
81 |
BUILD_BASE_DIR="$PWD/../temp_build" \ |
82 |
SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" \ |
83 |
/bin/sh $LIBGIG/osx/autoconf_builder.sh |
84 |
|
85 |
After these steps, the i386 and ppc versions of libsndfile.a are |
86 |
created in $LIBGIG/../temp_build/Deployment_$ARCH/local/lib |
87 |
($ARCH is either i386 or ppc). Now you can double-click on |
88 |
libgig.xcodeproj and build libgig with Deployment_UB build style. |
89 |
When XCode is building libgig for each architecture, pkg-config |
90 |
will find the correct version of libsndfile.a in $LIBGIG/../ |
91 |
temp_build/Deployment_{ppc,i386}/local/lib. |
92 |
|
93 |
(You can also easily create a Universal Binary of libsndfile.a, |
94 |
but then you need to take care manually of the contents of |
95 |
libsndfile.la and pkgconfig/sndfile.pc.) |
96 |
|
97 |
Additional Information |
98 |
---------------------- |
99 |
|
100 |
The XCode project just invokes autoconf_builder.sh after |
101 |
setting relevant environmental variables. If you are interested |
102 |
(or feel suspicious), please examine autoconf_builder.sh. |
103 |
|
104 |
|
105 |
6 May 2007: First written by Toshi Nagata |
106 |
9 May 2007: Updated to account for the Deployment_UB target |
107 |
|