OSDN Git Service

0631cc74678ebd71a7a2564b33527c7be3f1762b
[handbrake-jp/handbrake-jp-git.git] / BuildContribsDarwin.sh
1 #!/bin/sh
2 # This script build the contrib libs
3 # This used on MaxOs X to generate a universal version of the contrib libraries
4 # The new building process for MediaFork is to download a precompiled universal contrib folder
5 # and use them to build universal binaries of MediaFork
6 # pri: 01/28/07
7 # ########################################################################
8 # Parameters:
9 # Package Version  (Version must be incremented to ensure that each of trunk/branches use the correct version)
10 # IP of the other platform host
11 # Username to connect with (passwordless must be setup between the 2 machines)
12
13 # ie:  ./BuildContribsDarwin.sh 0001 192.168.0.150 toto
14 #
15 # #########################################################################
16 # The script will connect to the other computer, download and build all of the contrib libraries
17 # and in the same time download and compile the contrib libraries on the native system
18 # My setup to do that is Mac Pro Intel as native and a Mac mini G4 ppc as foreign
19 #
20 # Native is the master computer, it sends compile commands to the foreign, get the library, then do a lipo 
21 # to assemble both versions and put a universal binary version of the library in contrib/lib folder
22 #
23 # Once all of the contrib libraries are builded, a contribbin-darwin-${version}.tar.gz file is created, this file must
24 # be uploaded to the ftp server so Xcode will be able to build universal binaries of the MediaFork, MediaForkCLI and libmediafork
25 #
26 # ##########################################################################
27 # SSH passwordless setup instructions
28 # 1) log on native using terminal
29 # 2) ssh-keygen -t rsa
30 # 3) leave passphrase empty (hit return)
31 # 4) copy the $HOME/.ssh/id_rsa.pub to foreign machine $HOME/.ssh/authorized_keys
32 # ##########################################################################
33 export VERSION=$1
34 export IP=$2
35 export USERNAME=$3
36 export REPOS=svn://svn.m0k.org/HandBrake/branches/0.8.0_beta2_5.1
37 # ##########################################################################
38 # Launch the build on the foreign system
39 # ##########################################################################
40 ssh $USERNAME@$IP "rm -rf MFBUILDTMP ; mkdir MFBUILDTMP ; svn co $REPOS MFBUILDTMP ; cd MFBUILDTMP ; ./configure ; cd contrib ; cp ../config.jam . ; ../jam ; touch BUILDTERMINATED" &
41 ./configure
42 cd contrib
43 rm -rf lib include *tar.gz bin share man native foreign
44 cp ../config.jam .
45 # Use the new UB jam to be shure to use the correct version to build libraries (native on each system)
46 ../jam
47 mkdir native
48 mv lib native
49 mkdir lib
50 mkdir foreign
51 # wait until the foreign build is done :)
52 wait
53 echo the foreign build is done, transferring files to native computer:
54 cd foreign
55 mkdir lib
56 cd lib
57 scp $USERNAME@$IP:/Users/$USERNAME/MFBUILDTMP/contrib/lib/*a .
58 scp -rp $USERNAME@$IP:/Users/$USERNAME/MFBUILDTMP/contrib/lib/libquicktime .
59 for lib in `ls *.a`
60 do      
61         echo ... lipo contrib libraries: $lib
62         lipo -create $lib ../../native/lib/$lib -output ../../lib/$lib
63 done;
64 mkdir ../../lib/libquicktime
65 cd libquicktime
66 for lib in `ls *.so`
67 do
68         echo ... lipo libquicktime plugins: $lib
69         lipo -create $lib ../../../native/lib/libquicktime/$lib -output ../../../lib/libquicktime/$lib
70 done;
71  
72
73 cd ../../..
74 echo $VERSION > DarwinContribVersion.txt
75 echo Creating contribbin-darwin-$VERSION.tar.gz
76 tar zcvf contribbin-darwin-$VERSION.tar.gz lib include  DarwinContribVersion.txt
77 echo Done....
78 ls -l contribbin-darwin-$VERSION.tar.gz
79 cd ..
80 echo $VERSION > MacOsXContribBinariesVersion.txt