Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # 2009-02-20, Igor Stepura <igor.stepura@gmail.com>
- # Script to build universal ARM/i386 OpenCV private framework using iPhone SDK
- # Based on make_frameworks.sh by Mark Asbach <asbach@ient.rwth-aachen.de>
- # and script from here http://lambdajive.wordpress.com/2008/12/20/cross-compiling-for-iphone/
- # Tested to build with OpenCV 1.1pre1
- # (http://sourceforge.net/project/showfiles.php?group_id=22870&package_id=16948&release_id=634504)
- #You will need modified Makefile.in (http://pastebin.com/f35b8b20e) for this script to work properly
- #see http://zaaghad.blogspot.com/2009/02/universal-i386arm-opencv-framework-for.html for details
- if test -x Makefile; then make distclean; fi
- # (re-)create directories
- rm -rf build_ppc build_i386 build_iphoneos OpenCV.framework
- mkdir build_ppc
- mkdir build_i386
- mkdir build_iphoneos
- export parallel_jobs=$((2 * `sysctl -n hw.ncpu` + 1))
- export FRAMEWORK_INSTALL_PATH="@executable_path/Frameworks"
- export FRAMEWORK_NAME=OpenCV
- export FRAMEWORK_VERSION=A
- export FRAMEWORK_CURRENT_VERSION=1.1
- export FRAMEWORK_COMPAT_VERSION=1.1
- export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
- export SDK_VER=2.2
- export SDK=$DEVROOT/SDKs/iPhoneOS$SDK_VER.sdk
- # build powerpc version
- #Uncomment these lines if you need ppc version of framework
- ##echo "Building ppc version of the OpenCV framework"
- ##echo "============================================"
- ##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
- ##cd build_ppc
- # build intel version
- echo "Building i386 version of the OpenCV framework"
- echo "============================================="
- if test -d build_i386; then cd build_i386; fi
- ../configure --build=`arch` --host="i686-apple-darwin8" CXXFLAGS="-arch i386"\
- --enable-static \
- --disable-shared \
- --without-gtk \
- --without-imageio --without-quicktime --without-carbon --without-python --without-swig --disable-apps\
- && make -j $parallel_jobs\
- framework FRAMEWORK_ARCH=i386 FRAMEWORK_LIBTOOL=libtool
- # build arm version
- echo "Building iPhoneOS arm version of the OpenCV framework"
- echo "============================================="
- if test -d ../build_iphoneos; then cd ../build_iphoneos; fi
- ../configure \
- --disable-shared \
- --enable-static \
- --host=arm-apple-darwin9 --target=arm-apple-darwin9 \
- --without-imageio --without-carbon --without-quicktime --without-python --without-gtk --without-swig --disable-apps \
- CC=$DEVROOT/usr/bin/gcc-4.0 \
- LD=$DEVROOT/usr/bin/ld \
- CPP=$DEVROOT/usr/bin/cpp \
- CXXCPP=$DEVROOT/usr/bin/cpp \
- CXX=$DEVROOT/usr/bin/arm-apple-darwin9-g++-4.0.1\
- AR=$DEVROOT/usr/bin/ar \
- RANLIB=$DEVROOT/usr/bin/ranlib \
- NM=$DEVROOT/usr/bin/nm \
- CFLAGS="-arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I/Library/iPhone/include -isysroot $SDK" \
- LDFLAGS="-arch armv6 -pipe -std=c99 -gdwarf-2 -mthumb -isysroot $SDK -L$SDK/usr/lib" \
- CXXFLAGS="-arch armv6 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I/Library/iPhone/include -isysroot $SDK" \
- && make -j $parallel_jobs framework FRAMEWORK_ARCH=armv6 FRAMEWORK_LIBTOOL=$DEVROOT/usr/bin/libtool
- # build universal version
- echo "Creating universal Framework"
- echo "============================================="
- if test -d ../build_i386; then cd .. ; fi
- cp -Rp build_i386/OpenCV.framework ./
- $DEVROOT/usr/bin/lipo -create -arch armv6 build_iphoneos/OpenCV.framework/OpenCV\
- -arch i386 build_i386/OpenCV.framework/OpenCV\
- -output OpenCV.framework/Versions/A/OpenCV
- # finalize
- echo "Done!"
- open .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement