XCode5下编译lua;curl;openssl;xvid;x264;ffmpeg;isofs;libuv FOR iOS7

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/sh
# The MIT License (MIT)
# 
# Copyright (c) 2013 Pi
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


###########################################################################
# HELPER FUNCTIONS
###########################################################################
iOS_SDK_MIN=4.3
cib_check_build_enviroment()
{
    if [ ! \( -e "`whereis make`" \) ] ; then
       echo "The 'Command Line Tools' of Xcode could not be found. Install this component in Xcode first."
       exit 1
    fi

    NCPU=`sysctl -n hw.ncpu`
    if test x$NJOB = x; then
        NJOB=$NCPU
    fi

    XCODE_PATH=`xcode-select --print-path`

    if [ -z "$XCODE_PATH" ]; then
        echo "Could not find XCode location (use xcode-select -switch to set the correct path)"
        exit 1
    fi

    iOS_SDK=`xcodebuild -showsdks | grep iphoneos | sed "s|.*iphoneos||"`

}

#cib_download_and_extract tar_url tar_name
cib_download_and_extract()
{
    URL=$1
    TAR=$2

    mkdir -p "${BUILD_TARBALLS_PATH}"
    
    set -e
    if [ ! -e ${BUILD_TARBALLS_PATH}/${TAR} ]; then
        echo "Downloading '${TAR}'"
        if /bin/sh -c "wget -V > /dev/null 2>&1"; then
            wget --no-check-certificate ${URL} -O "${BUILD_TARBALLS_PATH}/${TAR}"
        else
            if /bin/sh -c "curl -V > /dev/null 2>&1"; then
                curl -L ${URL} -o "${BUILD_TARBALLS_PATH}/${TAR}"
            else
                echo "NOT found command 'curl' or 'wget' for download tarball, exit"
                exit 1
            fi
        fi
    else
        echo "Using ${TAR}"
    fi

    mkdir -p "${BUILD_SRC_PATH}"
    tar xf "${BUILD_TARBALLS_PATH}/${TAR}" -C "${BUILD_SRC_PATH}"
}

#check and load require file FILE_PATH 
cib_load_required_file()
{
    FILE_PATH=$1
    if [ -f $FILE_PATH ]
    then
        echo "require '$FILE_PATH' successful. "
        . $FILE_PATH
    else
        echo "require '$FILE_PATH' not exist."
        return 1;
    fi
    return 0;
}

#usage_print
cib_usage_print()
{
    echo "usage: $0 lua|curl|openssl|uv"
}

# cib_module_lib_create "name1 name2"
cib_module_lib_create()
{
    libs=$1
    mkdir -p ${CURRENTPATH}/lib
    for lib_name in ${libs}; do
        lipo -create \
            `find ${BUILD_ROOT_PATH} -name lib${lib_name}.a` \
            -output ${CURRENTPATH}/lib/lib${lib_name}.a
    done
}

# cib_module_inc_copy "name1 name2"
cib_module_inc_copy()
{
    includes=$1
    mkdir -p ${CURRENTPATH}/include
    for inc in ${includes}; do
        cp -R ${BUILD_ROOT_PATH}/iPhoneSimulator-i386.sdk/include/${inc} ${CURRENTPATH}/include
    done
}

###########################################################################
#Build stage
###########################################################################

cib_check_build_enviroment

CURRENTPATH=`pwd`
BUILD_TARBALLS_PATH=${CURRENTPATH}/build/tarballs
BUILD_SRC_PATH=${CURRENTPATH}/build/src
BUILD_ROOT_PATH=${CURRENTPATH}/build/bin
MODULE=$1


if ! cib_load_required_file ./packages/$MODULE; then 
    cib_usage_print;
    exit 1;
fi

#begin download and build 
module_building