]> git.sesse.net Git - vlc/blob - extras/package/macosx/ub.sh
macosx: fix size, position and style of dark detached window close/min/max buttons...
[vlc] / extras / package / macosx / ub.sh
1 #!/bin/bash
2 set -e
3
4 # This script allows you to create a Universal Binary of VLC.app. It requires
5 # pre-compiled binaries for Intel-, Intel64- and PowerPC-based Macs; no sources.
6 # PPC64 is not supported right now, but could be added with little effort.
7 # Using different OS X SDKs for both platforms is absolutely fine of course.
8 # All you need to do is CHANGE THE ROOTS and READ THE COMMENTS.
9 # Happy releasing!
10
11 # INTELROOT == path to VLC.app compiled on an Intel-based Mac (e.g. jones).
12 # INTEL64ROOT == path to VLC.app compiled in 64bit mode (e.g. on jones with -m64).
13 # PPCROOT   == path to VLC.app compiled on a PowerPC-based Mac (e.g. veda).
14 # PPCROOT=/Volumes/vlc-1.0.2/VLC.app
15 # Note that these roots only require read-access and won't be changed at all.
16
17 # UBROOT    == path to a VLC.app bundle which will contain the Universal Binary.
18
19 SRCROOT=`dirname $0`/../../..
20 WD=`pwd`
21 cd $SRCROOT
22 SRCROOT=`pwd`
23 cd $WD
24
25 #############################################
26 # Config
27
28 INTELROOT=$SRCROOT/32bit/VLC.app
29 INTEL64ROOT=$SRCROOT/64bit/VLC.app
30 # PPCROOT
31 UBROOT=$SRCROOT/VLC.app
32
33 #
34 #############################################
35
36 echo "Creating VLC in $UBROOT"
37 rm -Rf $UBROOT
38 cp -Rf $INTEL64ROOT $UBROOT
39
40 LIBS=Contents/MacOS/lib
41 PLUGINS=Contents/MacOS/plugins
42 FRAMEWORKS=Contents/Frameworks
43 rm -Rf $SRCROOT/VLC.app/$LIBS/*
44 rm -Rf $SRCROOT/VLC.app/Contents/MacOS/VLC
45 rm -Rf $SRCROOT/VLC.app/$PLUGINS/*
46 rm -Rf $SRCROOT/VLC.app/$FRAMEWORKS/Growl.framework/Versions/A/Growl
47 rm -Rf $SRCROOT/VLC.app/$FRAMEWORKS/BGHUDAppKit.framework/BGHUDAppKit
48 rm -Rf $SRCROOT/VLC.app/$FRAMEWORKS/BGHUDAppKit.framework/Versions/A/BGHUDAppKit
49 rm -Rf $SRCROOT/VLC.app/$FRAMEWORKS/Sparkle.framework/Versions/A/Sparkle
50 rm -Rf $SRCROOT/VLC.app/$FRAMEWORKS/Sparkle.framework/Resources/relaunch
51
52 function do_lipo {
53     file="$1"
54     files=""
55     echo "..."$file
56     if [ "x$PPCROOT" != "x" ]; then
57         if [ -e "$PPCROOT/$file" ]; then
58             files="$PPCROOT/$file $files"
59         fi
60     fi
61     if [ "x$INTELROOT" != "x" ]; then
62         if [ -e "$INTELROOT/$file" ]; then
63             files="$INTELROOT/$file $files"
64         fi
65     fi
66     if [ "x$INTEL64ROOT" != "x" ]; then
67         if [ -e "$INTEL64ROOT/$file" ]; then
68             files="$INTEL64ROOT/$file $files"
69         fi
70     fi
71     if [ "x$files" != "x" ]; then
72         lipo $files -create -output $UBROOT/$file
73     fi;
74 }
75
76 echo "Installing libs"
77 for i in `ls $INTELROOT/$LIBS/ | grep .dylib`
78 do
79     do_lipo $LIBS/$i
80 done
81
82 echo "Installing modules"
83 for i in `ls $INTELROOT/$PLUGINS/ | grep .dylib`
84 do
85     do_lipo $PLUGINS/$i
86 done
87
88 echo "Installing frameworks"
89 do_lipo $FRAMEWORKS/Growl.framework/Versions/A/Growl
90 do_lipo $FRAMEWORKS/BGHUDAppKit.framework/BGHUDAppKit
91 do_lipo $FRAMEWORKS/BGHUDAppKit.framework/Versions/A/BGHUDAppKit
92 do_lipo $FRAMEWORKS/Sparkle.framework/Versions/A/Sparkle
93 do_lipo $FRAMEWORKS/Sparkle.framework/Resources/relaunch
94
95 echo "Installing VLC"
96 do_lipo Contents/MacOS/VLC
97
98 echo "Installing Extra modules"
99
100 # The following fixes modules, which aren't available on all platforms
101 do_lipo $LIBS/libSDL_image.0.dylib
102 do_lipo $LIBS/libtiff.3.dylib
103 do_lipo $LIBS/libtiff.3.dylib
104 do_lipo $PLUGINS/libsdl_image_plugin.dylib
105 do_lipo $PLUGINS/libquartztext_plugin.dylib
106 do_lipo $PLUGINS/libgoom_plugin.dylib
107 if [ "x$INTELROOT" != "x" ]; then
108     cp $INTELROOT/$PLUGINS/*mmx* $UBROOT/$PLUGINS/
109     cp $INTELROOT/$PLUGINS/*3dn* $UBROOT/$PLUGINS/
110 fi
111 if [ "x$INTEL64ROOT" != "x" ]; then
112     cp $INTEL64ROOT/$PLUGINS/*sse* $UBROOT/$PLUGINS/
113 fi
114 if [ "x$PPCROOT" != "x" ]; then
115     cp $PPCROOT/Contents/MacOS/modules/*altivec* $UBROOT/Contents/MacOS/modules/
116     cp $PPCROOT/Contents/MacOS/lib/libvlc.dylib $UBROOT/Contents/MacOS/lib/
117     cp $PPCROOT/Contents/MacOS/lib/libvlccore.dylib $UBROOT/Contents/MacOS/lib/
118 fi
119
120
121 echo "Copying plugins.dat"
122 set +x
123
124 if [ "x$PPCROOT" != "x" ]; then
125     cp $PPCROOT/$PLUGINS/plugins-*.dat $UBROOT/$PLUGINS/
126 fi
127 if [ "x$INTELROOT" != "x" ]; then
128     cp $INTELROOT/$PLUGINS/plugins-*.dat $UBROOT/$PLUGINS/
129 fi
130 if [ "x$INTEL64ROOT" != "x" ]; then
131     cp $INTEL64ROOT/$PLUGINS/plugins-*.dat $UBROOT/$PLUGINS/
132 fi
133
134
135 # Now, you need to copy the resulting UBROOT bundle into VLC's build directory
136 # and make sure it is named "VLC.app".
137 # Afterwards, run 'make package-macosx' and follow release_howto.txt in /doc