1 |
schoenebeck |
1172 |
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 |
|
|
Universal Binaries are not automatically created by the XCode project. |
52 |
|
|
However, it is easy to create them by hands as follows: |
53 |
|
|
|
54 |
|
|
$ cd $LIBGIG # Move to the libgig directory |
55 |
|
|
$ mkdir -p ../temp_build/UB/bin ../temp_build/UB/lib |
56 |
|
|
$ cd ../temp_build/Deployment_ppc |
57 |
|
|
$ for i in bin/* lib/*.a; do |
58 |
|
|
lipo -create $i ../Deployment_i386/$i -output ../UB/$i |
59 |
|
|
done |
60 |
|
|
|
61 |
|
|
The libgig project is dependent on libsndfile, but you may not |
62 |
|
|
have a Universal Binary version of libsndfile. Don't worry, you |
63 |
|
|
can still create UB of libgig products. Follow these steps: |
64 |
|
|
|
65 |
|
|
- Get the sources of libsndfile and extract in $LIBGIG/.. |
66 |
|
|
- cd to $LIBGIG/../libsndfile-* |
67 |
|
|
- env BUILD_STYLE=Deployment_ppc \ |
68 |
|
|
WITH_INSTALL=1 \ |
69 |
|
|
CONFIG_OPTIONS="--disable-shared" \ |
70 |
|
|
BUILD_BASE_DIR="$PWD/../temp_build" \ |
71 |
|
|
SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" \ |
72 |
|
|
/bin/sh $LIBGIG/osx/autoconf_builder.sh |
73 |
|
|
- env BUILD_STYLE=Deployment_i386 \ |
74 |
|
|
WITH_INSTALL=1 \ |
75 |
|
|
CONFIG_OPTIONS="--disable-shared" \ |
76 |
|
|
BUILD_BASE_DIR="$PWD/../temp_build" \ |
77 |
|
|
SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" \ |
78 |
|
|
/bin/sh $LIBGIG/osx/autoconf_builder.sh |
79 |
|
|
|
80 |
|
|
After these steps, the i386 and ppc versions of libsndfile.a are |
81 |
|
|
created in $LIBGIG/../temp_build/Deployment_$ARCH/local/lib |
82 |
|
|
($ARCH is either i386 or ppc). Now you can double-click on |
83 |
|
|
libgig.xcodeproj and build libgig with Deployment_i386 and |
84 |
|
|
Deployment_ppc build styles. pkg-config will find the correct |
85 |
|
|
version of libsndfile.a in $LIBGIG/../temp_build/$BUILD_STYLES/ |
86 |
|
|
local/lib. |
87 |
|
|
|
88 |
|
|
Additional Information |
89 |
|
|
---------------------- |
90 |
|
|
|
91 |
|
|
The XCode project just invokes autoconf_builder.sh with after |
92 |
|
|
setting relevant environmental variables. If you are interested |
93 |
|
|
(or feel suspicious), please examine autoconf_builder.sh. |
94 |
|
|
|
95 |
|
|
|
96 |
|
|
6 May 2007 |
97 |
|
|
Written by Toshi Nagata |