3 # script for pulling together a MacOSX app bundle.
5 GTKQUARTZ_ROOT=/opt/gtk
13 while [ $# -gt 0 ] ; do
18 # top level build targets
21 --sae) SAE=1 ; WITH_JACK=1; WITH_LADSPA=1; STRIP= ; shift ;;
22 --public) SAE= ; WITH_JACK=; WITH_LADSPA=1; STRIP= ; shift ;;
23 --allinone) SAE= ; WITH_JACK=1; WITH_LADSPA=1; STRIP= ; shift ;;
24 --test) SAE= ; WITH_JACK=; WITH_LADSPA=; STRIP= ; shift ;;
27 # specific build flags
30 --nojack) WITH_JACK= ; shift ;;
31 --noladspa) WITH_LADSPA= ; shift ;;
32 --nostrip) STRIP= ; shift ;;
33 --sysdeps) PRINT_SYSDEPS=1; shift ;;
37 version=`grep -m 1 '^ardour_version' ../../SConstruct | cut -d' ' -f 3 | sed "s/'//g"`
38 echo "Version is $version"
39 info_string="$version built on `hostname` by `whoami` on `date`"
40 echo "Info string is $info_string"
42 # setup directory structure
44 APPROOT=Ardour2.app/Contents
45 Frameworks=$APPROOT/Frameworks
46 Resources=$APPROOT/Resources
47 Plugins=$APPROOT/Plugins
48 Surfaces=$APPROOT/Surfaces
49 Shared=$Resources/share
52 if [ x$PRINT_SYSDEPS != x ] ; then
54 # print system dependencies
57 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
58 if ! file $file | grep -qs Mach-O ; then
61 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
66 echo "Removing old Ardour2.app tree ..."
70 echo "Building new app directory structure ..."
72 # only bother to make the longest paths
74 mkdir -p $APPROOT/MacOS
75 mkdir -p $APPROOT/Resources
76 mkdir -p $APPROOT/Plugins
77 mkdir -p $APPROOT/Surfaces
78 mkdir -p $Frameworks/modules
79 mkdir -p $Shared/templates
84 if test x$SAE != x ; then
85 env="$env<key>ARDOUR_SAE</key><string>true</string>"
87 # current default for SAE version is German keyboard layout
89 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de</string>"
90 env="$env<key>ARDOUR_UI_CONF</key><string>ardour2_ui_sae.conf</string>"
94 # if we're not going to bundle JACK, make sure we can find
95 # jack in the places where it might be
98 if test x$WITH_JACK != x ; then
99 env="$env<key>ARDOUR_WITH_JACK</key><string>true</string>"
101 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin</string>"
102 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
105 env="<key>LSEnvironment</key><dict><key>ARDOUR_BUNDLED</key><string>true</string>$env</dict>"
108 sed -e "s?@ENV@?$env?g" \
109 -e "s?@VERSION@?$version?g" \
110 -e "s?@INFOSTRING@?$info_string?g" < Info.plist.in > Info.plist
114 cp Info.plist $APPROOT
115 cp -R Resources $APPROOT
117 echo "Copying ardour executable ...."
118 cp ../../gtk2_ardour/ardour-$version $APPROOT/MacOS/Ardour2
119 if test x$SAE != x ; then
120 cp ../../gtk2_ardour/evtest $APPROOT/MacOS/gtkevents
122 if test x$STRIP != x ; then
123 strip $APPROOT/MacOS/Ardour2
125 if test x$WITH_JACK != x ; then
126 cp /usr/local/lib/jack/jack_coreaudio.so $Frameworks
127 cp /usr/local/bin/jackd $APPROOT/MacOS
130 cp -R $GTKQUARTZ_ROOT/etc/* $Etc
131 echo "Copying all Pango modules ..."
132 cp -R $GTKQUARTZ_ROOT/lib/pango/1.6.0/modules/*.so $Frameworks/modules
133 echo "Copying all GDK Pixbuf loaders ..."
134 cp -R $GTKQUARTZ_ROOT/lib/gtk-2.0/2.10.0/loaders/*.so $Frameworks/modules
136 cp -R $GTKQUARTZ_ROOT/lib/charset.alias $Resources
140 if test x$WITH_LADSPA != x ; then
141 echo "Copying `ls ladspa | wc -l` plugins ..."
142 cp -r ladspa/* $Plugins
145 # generate new Pango module file
148 ModulesPath=$GTKQUARTZ_ROOT/lib/pango/1.6.0/modules
150 env PANGO_RC_FILE=pangorc $GTKQUARTZ_ROOT/bin/pango-querymodules | sed "s?$GTKQUARTZ_ROOT/lib/pango/1.6.0/modules/?@executable_path/../Frameworks/modules/?" > $Resources/pango.modules
153 # generate a new GDK pixbufs loaders file
154 sed "s?$GTKQUARTZ_ROOT/lib/gtk-2.0/2.10.0/loaders/?@executable_path/../Frameworks/modules/?" < $GTKQUARTZ_ROOT/etc/gtk-2.0/gdk-pixbuf.loaders > $Resources/gdk-pixbuf.loaders
156 # this one is special - we will set GTK_PATH to $Frameworks/clearlooks
157 cp ../../libs/clearlooks/libclearlooks.dylib $Frameworks
158 mkdir -p $Frameworks/clearlooks/engines
159 (cd $Frameworks/clearlooks/engines && ln -s ../../libclearlooks.dylib libclearlooks.dylib && ln -s ../../libclearlooks.dylib libclearlooks.so)
161 # XXX STILL NEED TO DO PANNERS FOR TRUNK
162 cp ../../libs/surfaces/*/libardour_*.dylib $Surfaces
163 # hack ... move libardour_cp back into Frameworks
164 mv $Surfaces/libardour_cp.dylib $Frameworks
166 # VAMP plugins that we use
167 cp ../../libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
171 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
172 if ! file $file | grep -qs Mach-O ; then
175 if test x$WITH_JACK != x ; then
176 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/local/|libs/)"`
178 # do not include libjack
179 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | grep -v 'libjack\.'`
182 for dep in $deps ; do
184 if ! test -f $Frameworks/$base; then
185 if echo $dep | grep -sq '^libs' ; then
186 cp ../../$dep $Frameworks
194 if test x$missing = xfalse ; then
195 # everything has been found
201 echo "Copying other stuff to Ardour2.app ..."
203 cp ../../gtk2_ardour/ergonomic-us.bindings $Resources
204 cp ../../gtk2_ardour/mnemonic-us.bindings $Resources
205 cp ../../gtk2_ardour/SAE-de.bindings $Resources
206 cp ../../gtk2_ardour/ardour.menus $Resources
207 cp ../../gtk2_ardour/ardour-sae.menus $Resources
208 if test x$SAE != x ; then
209 cp ../../ardour_system_sae.rc $Resources/ardour_system.rc
210 echo cp ../../ardour_system_sae.rc $Resources/ardour_system.rc
212 cp ../../ardour_system.rc $Resources/ardour_system.rc
213 echo FOO cp ../../ardour_system.rc $Resources/ardour_system.rc
215 cp ../../gtk2_ardour/ardour2_ui_sae.conf $Resources
216 cp ../../gtk2_ardour/ardour2_ui_default.conf $Resources
217 cp ../../gtk2_ardour/ardour2_ui_light.rc $Resources
218 cp ../../gtk2_ardour/ardour2_ui_dark.rc $Resources
220 cp -r ../../gtk2_ardour/icons $Resources
221 cp -r ../../gtk2_ardour/pixmaps $Resources
225 cp -R ../../gtk2_ardour/splash.png $Shared
226 cp ../../templates/*.template $Shared/templates/
228 # go through and recursively remove any .svn dirs in the bundle
229 for svndir in `find Ardour2.app -name .svn -type dir`; do
233 # now fix up the executables
234 echo "Fixing up executable dependency names ..."
235 executables="Ardour2"
236 if test x$WITH_JACK != x ; then
237 executables="$executables jackd"
239 if test x$SAE != x ; then
240 executables="$executables gtkevents"
243 for exe in $executables; do
244 EXE=$APPROOT/MacOS/$exe
246 if test x$WITH_JACK != x ; then
247 for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do
249 changes="$changes -change $lib @executable_path/../Frameworks/$base"
252 for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
254 changes="$changes -change $lib @executable_path/../Frameworks/$base"
257 if test "x$changes" != "x" ; then
258 install_name_tool $changes $EXE
262 echo "Fixing up library names ..."
263 # now do the same for all the libraries we include
264 for dylib in $Frameworks/*.dylib $Frameworks/modules/*.so $Surfaces/*.dylib ; do
266 if test ! -L $dylib ; then
268 # change all the dependencies
271 if test x$WITH_JACK != x ; then
272 for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do
274 changes="$changes -change $lib @executable_path/../Frameworks/$base"
277 for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
279 changes="$changes -change $lib @executable_path/../Frameworks/$base"
283 if test "x$changes" != x ; then
284 if install_name_tool $changes $dylib ; then
291 # now the change what the library thinks its own name is
293 base=`basename $dylib`
294 install_name_tool -id @executable_path/../Frameworks/$base $dylib