Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Set build environment variables for iOS development.
- #
- # This script should be sourced:
- #
- # . setenv.sh arch [sdk-version]
- #
- # Where 'arch' is one of armv6, armv7 or i386 (simulator)
- #
- # The environment variable $VALIDENV will be 0 is the environment is
- # invalid, or 1 if valid.
- export VALIDENV=0
- if [ $# -gt 0 ]; then
- SDKVER=5.0
- if [ $# -eq 1 ]; then
- ARCH=$1
- elif [ $# -eq 2 ]; then
- ARCH=$1
- SDKVER=$2
- fi
- case $ARCH in
- armv6)
- PLATFORM=iPhoneOS
- ;;
- armv7)
- PLATFORM=iPhoneOS
- ;;
- i386)
- PLATFORM=iPhoneSimulator
- ;;
- esac
- export ARCH PLATFORM SDKVER
- # Developer and SDK root directories
- export DEVROOT=/Developer/Platforms/${PLATFORM}.platform/Developer
- export SDKROOT=$DEVROOT/SDKs/${PLATFORM}${SDKVER}.sdk
- export TOOLROOT=$DEVROOT/usr/bin
- # Full path to tools
- export CC=$TOOLROOT/clang
- export CXX=$TOOLROOT/clang++
- export LD=$TOOLROOT/ld
- export AR=$TOOLROOT/ar
- export RANLIB=$TOOLROOT/ranlib
- export NM=$TOOLROOT/nm
- export STRIP=$TOOLROOT/strip
- # Some fundamental compiler/linker flags
- export CFLAGS="-arch $ARCH -isysroot $SDKROOT"
- export CXXFLAGS="$CFLAGS"
- export LDFLAGS="$CFLAGS -Wl,-syslibroot $SDKROOT"
- # Where local libraries are installed
- export LOCAL_IOS_LIBS=/opt/local/ioslibs
- # Check if the environment is valid
- [ -d $DEVROOT -a \
- -d $SDKROOT -a \
- -d $TOOLROOT -a \
- -d $LOCAL_IOS_LIBS -a \
- -x $CC -a \
- -x $CXX -a \
- -x $LD -a \
- -x $AR ] && VALIDENV=1
- fi
- if [ $VALIDENV = 0 ]; then
- echo Invalid environment!
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement