3 # script for pulling together a MacOSX app bundle.
5 GTKQUARTZ_ROOT=/opt/gtk
13 while [ $# -gt 0 ] ; do
16 --sae) SAE=1 ; shift ;;
17 --nojack) WITH_JACK= ; shift ;;
18 --noladspa) WITH_LADSPA= ; shift ;;
19 --nostrip) STRIP= ; shift ;;
20 --sysdeps) PRINT_SYSDEPS=1; shift ;;
24 version=`grep -m 1 '^ardour_version' ../../SConstruct | cut -d' ' -f 3 | sed "s/'//g"`
25 echo "Version is $version"
26 info_string="$version built on `hostname` by `whoami` on `date`"
27 echo "Info string is $info_string"
29 # setup directory structure
31 APPROOT=Ardour2.app/Contents
32 Frameworks=$APPROOT/Frameworks
33 Resources=$APPROOT/Resources
34 Plugins=$APPROOT/Plugins
35 Shared=$Resources/share
38 if [ x$PRINT_SYSDEPS != x ] ; then
40 # print system dependencies
43 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
44 if ! file $file | grep -qs Mach-O ; then
47 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
52 echo "Removing old Ardour2.app tree ..."
56 echo "Building new app directory structure ..."
58 # only bother to make the longest paths
60 mkdir -p $APPROOT/MacOS
61 mkdir -p $APPROOT/Resources
62 mkdir -p $APPROOT/Plugins
63 mkdir -p $Frameworks/modules
64 mkdir -p $Shared/templates
69 if test x$SAE != x ; then
70 env="$env<key>ARDOUR_SAE</key><string>true</string>"
72 # current default for SAE version is German keyboard layout
74 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de</string>"
78 # if we're not going to bundle JACK, make sure we can find
79 # jack in the places where it might be
82 if test x$WITH_JACK != x ; then
83 env="$env<key>ARDOUR_WITH_JACK</key><string>true</string>"
85 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin</string>"
86 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
89 env="<key>LSEnvironment</key><dict><key>ARDOUR_BUNDLED</key><string>true</string>$env</dict>"
92 sed -e "s?@ENV@?$env?g" \
93 -e "s?@VERSION@?$version?g" \
94 -e "s?@INFOSTRING@?$info_string?g" < Info.plist.in > Info.plist
98 cp Info.plist $APPROOT
99 cp -R Resources $APPROOT
101 echo "Copying ardour executable ...."
102 cp ../../gtk2_ardour/ardour-$version $APPROOT/MacOS/Ardour2
103 if test x$STRIP != x ; then
104 strip $APPROOT/MacOS/Ardour2
106 if test x$WITH_JACK != x ; then
107 cp /usr/local/lib/jack/jack_coreaudio.so $Frameworks
108 cp /usr/local/bin/jackd $APPROOT/MacOS
111 cp -R $GTKQUARTZ_ROOT/etc/* $Etc
112 echo "Copying all Pango modules ..."
113 cp -R $GTKQUARTZ_ROOT/lib/pango/1.6.0/modules/*.so $Frameworks/modules
114 echo "Copying all GDK Pixbuf loaders ..."
115 cp -R $GTKQUARTZ_ROOT/lib/gtk-2.0/2.10.0/loaders/*.so $Frameworks/modules
117 cp -R $GTKQUARTZ_ROOT/lib/charset.alias $Resources
121 if test x$WITH_LADSPA != x ; then
122 echo "Copying `ls ladspa | wc -l` plugins ..."
123 cp -r ladspa/* $Plugins
126 # generate new Pango module file
129 ModulesPath=$GTKQUARTZ_ROOT/lib/pango/1.6.0/modules
131 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
134 # generate a new GDK pixbufs loaders file
135 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
137 # this one is special - we will set GTK_PATH to $Frameworks/clearlooks
138 cp ../../libs/clearlooks/libclearlooks.dylib $Frameworks
139 mkdir -p $Frameworks/clearlooks/engines
140 (cd $Frameworks/clearlooks/engines && ln -s ../../libclearlooks.dylib libclearlooks.dylib && ln -s ../../libclearlooks.dylib libclearlooks.so)
142 # XXX STILL NEED TO DO PANNERS FOR TRUNK
144 cp ../../libs/surfaces/*/libardour_*.dylib $Frameworks
148 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
149 if ! file $file | grep -qs Mach-O ; then
152 if test x$WITH_JACK != x ; then
153 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/local/|libs/)"`
155 # do not include libjack
156 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | grep -v 'libjack\.'`
159 for dep in $deps ; do
161 if ! test -f $Frameworks/$base; then
162 if echo $dep | grep -sq '^libs' ; then
163 cp ../../$dep $Frameworks
171 if test x$missing = xfalse ; then
172 # everything has been found
178 echo "Copying other stuff to Ardour2.app ..."
180 cp ../../gtk2_ardour/ardour.bindings $Resources
181 cp ../../gtk2_ardour/ardour-sae-ansi.bindings $Resources
182 cp ../../gtk2_ardour/ardour-sae-de.bindings $Resources
183 cp ../../gtk2_ardour/ardour.menus $Resources
184 cp ../../gtk2_ardour/ardour-sae.menus $Resources
185 cp ../../ardour_system.rc $Resources
186 cp ../../gtk2_ardour/ardour2_ui_default.conf $Resources
187 cp ../../gtk2_ardour/ardour2_ui_light.rc $Resources
188 cp ../../gtk2_ardour/ardour2_ui_dark.rc $Resources
190 cp -r ../../gtk2_ardour/icons $Resources
191 cp -r ../../gtk2_ardour/pixmaps $Resources
195 cp -R ../../gtk2_ardour/splash.png $Shared
196 cp ../../templates/*.template $Shared/templates/
198 # go through and recursively remove any .svn dirs in the bundle
199 for svndir in `find Ardour2.app -name .svn -type dir`; do
203 # now fix up the executables
204 echo "Fixing up executable dependency names ..."
205 executables="Ardour2"
206 if test x$WITH_JACK != x ; then
207 executables="$executables jackd"
210 for exe in $executables; do
211 EXE=$APPROOT/MacOS/$exe
213 if test x$WITH_JACK != x ; then
214 for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do
216 changes="$changes -change $lib @executable_path/../Frameworks/$base"
219 for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
221 changes="$changes -change $lib @executable_path/../Frameworks/$base"
224 if test "x$changes" != "x" ; then
225 install_name_tool $changes $EXE
229 echo "Fixing up library names ..."
230 # now do the same for all the libraries we include
231 for dylib in $Frameworks/*.dylib $Frameworks/modules/*.so ; do
233 if test ! -L $dylib ; then
235 # change all the dependencies
238 if test x$WITH_JACK != x ; then
239 for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do
241 changes="$changes -change $lib @executable_path/../Frameworks/$base"
244 for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
246 changes="$changes -change $lib @executable_path/../Frameworks/$base"
250 if test "x$changes" != x ; then
251 if install_name_tool $changes $dylib ; then
258 # now the change what the library thinks its own name is
260 base=`basename $dylib`
261 install_name_tool -id @executable_path/../Frameworks/$base $dylib