]> git.sesse.net Git - vlc/blob - extras/package/macosx/ub.sh
Universal Binary creation skript: updated to the re-worked version from 1.1-bugfix
[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/build32/VLC-release.app
29 INTEL64ROOT=$SRCROOT/build64/VLC-release.app
30 # PPCROOT
31 UBROOT=$SRCROOT/build-fat/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 rm -Rf $SRCROOT/build-fat/VLC.app/$LIBS/*
43 rm -Rf $SRCROOT/build-fat/VLC.app/Contents/MacOS/VLC
44 rm -Rf $SRCROOT/build-fat/VLC.app/$PLUGINS/*
45
46 function do_lipo {
47     file="$1"
48     files=""
49     echo "..."$file
50     if [ "x$PPCROOT" != "x" ]; then
51         if [ -e "$PPCROOT/$file" ]; then
52             files="$PPCROOT/$file $files"
53         fi
54     fi
55     if [ "x$INTELROOT" != "x" ]; then
56         if [ -e "$INTELROOT/$file" ]; then
57             files="$INTELROOT/$file $files"
58         fi
59     fi
60     if [ "x$INTEL64ROOT" != "x" ]; then
61         if [ -e "$INTEL64ROOT/$file" ]; then
62             files="$INTEL64ROOT/$file $files"
63         fi
64     fi
65     if [ "x$files" != "x" ]; then
66         lipo $files -create -output $UBROOT/$file
67     fi;
68 }
69
70 echo "Installing libs"
71 for i in `ls $INTELROOT/$LIBS/ | grep .dylib`
72 do
73     do_lipo $LIBS/$i
74 done
75
76 echo "Installing modules"
77 for i in `ls $INTELROOT/$PLUGINS/ | grep .dylib`
78 do
79     do_lipo $PLUGINS/$i
80 done
81
82
83 echo "Installing VLC"
84 do_lipo Contents/MacOS/VLC
85
86 echo "Installing Extra modules"
87
88 # The following fixes modules, which aren't available on all platforms
89 do_lipo $LIBS/libSDL_image.0.dylib
90 do_lipo $LIBS/libtiff.3.dylib
91 do_lipo $LIBS/libtiff.3.dylib
92 do_lipo $PLUGINS/libsdl_image_plugin.dylib
93 do_lipo $PLUGINS/libquartztext_plugin.dylib
94 do_lipo $PLUGINS/libgoom_plugin.dylib
95 if [ "x$INTELROOT" != "x" ]; then
96     cp $INTELROOT/$PLUGINS/*mmx* $UBROOT/$PLUGINS/
97     cp $INTELROOT/$PLUGINS/*3dn* $UBROOT/$PLUGINS/
98 fi
99 if [ "x$INTEL64ROOT" != "x" ]; then
100     cp $INTEL64ROOT/$PLUGINS/*sse* $UBROOT/$PLUGINS/
101 fi
102 if [ "x$PPCROOT" != "x" ]; then
103     cp $PPCROOT/Contents/MacOS/modules/*altivec* $UBROOT/Contents/MacOS/modules/
104     cp $PPCROOT/Contents/MacOS/lib/libvlc.dylib $UBROOT/Contents/MacOS/lib/
105     cp $PPCROOT/Contents/MacOS/lib/libvlccore.dylib $UBROOT/Contents/MacOS/lib/
106 fi
107
108
109 echo "Copying plugins.dat"
110 set +x
111
112 if [ "x$PPCROOT" != "x" ]; then
113     cp $PPCROOT/$PLUGINS/plugins-*.dat $UBROOT/$PLUGINS/
114 fi
115 if [ "x$INTELROOT" != "x" ]; then
116     cp $INTELROOT/$PLUGINS/plugins-*.dat $UBROOT/$PLUGINS/
117 fi
118 if [ "x$INTEL64ROOT" != "x" ]; then
119     cp $INTEL64ROOT/$PLUGINS/plugins-*.dat $UBROOT/$PLUGINS/
120 fi
121
122
123 # Now, you need to copy the resulting UBROOT bundle into VLC's build directory
124 # and make sure it is named "VLC-release.app".
125 # Afterwards, run 'make package-macosx' and follow release_howto.txt in /doc