Apply maemo2 patch
[opencv] / make_frameworks.sh
1 #! /bin/bash
2
3 # 2007-05-23, Mark Asbach <asbach@ient.rwth-aachen.de>
4
5 # This shell script makes use of VPATH builds and the special 'framework' Makefile target of
6 # the top level Makefile to create a universal binary framework out of native frameworks.
7 # No manual './configure && make && make install' is necessary if the framework is sufficient
8 # for you. However, Python bindings are not generated this way because of issues with 
9 # different python versions and universal binaries.
10 #
11 # If you need python wrappers and standard unix install, you should do a manual VPATH
12 # build with all the settings you like.
13 #
14 # The resulting framework is created as a Private Framework that must be copied into your
15 # application bundle by a dedicated 'Copy Files' build step. See the demo XCode project
16 # included with OpenCV and/or have a look at
17 # http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#//apple_ref/doc/uid/20002258-106880-BAJJBIEF
18
19 # the current directory should not be configured
20 if test -x Makefile; then make distclean; fi
21
22 # (re-)create directories
23 rm -rf build_ppc build_i386 OpenCV.framework
24 mkdir build_ppc
25 mkdir build_i386
26
27 # find out how many parallel processes we want to use for make
28 # see http://freshmeat.net/projects/kernbench/, we use a slightly different 'optimum' guess
29 export parallel_jobs=$((2 * `sysctl -n hw.ncpu` + 1))
30
31 # this setting defines where the framework should be installed
32 export FRAMEWORK_INSTALL_PATH="@executable_path/../Frameworks"
33 #export FRAMEWORK_INSTALL_PATH="/Library/Frameworks"
34 #export FRAMEWORK_INSTALL_PATH="/Users/your_login_name_here/Library/Frameworks"
35
36 # build powerpc version
37 echo "Building ppc version of the OpenCV framework"
38 echo "============================================"
39 cd build_ppc && ../configure --build=`arch` --host="powerpc-apple-darwin8" CXXFLAGS="-arch ppc" --without-python --without-swig --disable-apps && make -j $parallel_jobs framework FRAMEWORK_ARCH=ppc
40
41 # build intel version
42 echo "Building i386 version of the OpenCV framework"
43 echo "============================================="
44 if test -d ../build_i386; then cd ../build_i386; fi
45 ../configure --build=`arch` --host="i686-apple-darwin8" CXXFLAGS="-arch i386"  --without-python --without-swig --disable-apps && make -j $parallel_jobs framework FRAMEWORK_ARCH=i386
46
47 # build universal version
48 echo "Creating universal Framework"
49 echo "============================================="
50 if test -d ../build_i386; then cd .. ; fi
51 cp -Rp build_ppc/OpenCV.framework ./
52 lipo -create build_ppc/OpenCV.framework/OpenCV build_i386/OpenCV.framework/OpenCV -output OpenCV.framework/Versions/A/OpenCV
53
54 # finalize
55 echo "Done!"
56 open .