Mac10.7.5 XCode4.5.2 ios6编译VLC1.1.0

参考了这篇博文:http://blog.csdn.net/madongchunqiu/article/details/7625083,根据后面的问答修改了一些脚本内容,以及编译时遇到的问题说明


只针对真机编译,前几步跟上面博文一样:

1.到http://www.videolan.org/vlc/download-ios.html 下载3个压缩文件

2. 创建目录(比如/VLC),并将3个源代码包解压在目录内,并依次重命名为:MediaLibraryKit, MobileVLC, vlc

3.替换脚本文件内容:/VLC/vlc/extras/package/ios/build_for_iOS.sh,其中

-miphoneos-version-min我设置的是5.0,你也可以设置成5.1或6.0

#!/bin/sh
set -e

echo "Building libvlc for the iOS"

if [ "$1" = "Simulator" ]; then
    PLATFORM="Simulator"
    TARGET="i686-apple-darwin10"
    ARCH="i386"
else
    PLATFORM="OS"
    TARGET="arm-apple-darwin10"
    ARCH="armv7"
    OPTIM="-mno-thumb"
fi

THIS_SCRIPT_PATH=`pwd`/$0

pushd `dirname $0`/../../..
VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
popd
DEVROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhone${PLATFORM}.platform/Developer"
IOS_SDK_ROOT="${DEVROOT}/SDKs/iPhone${PLATFORM}6.0.sdk"

BUILDDIR=${VLCROOT}/build-ios-${PLATFORM}

PREFIX=${VLCROOT}/install-ios-${PLATFORM}

IOS_GAS_PREPROCESSOR="${VLCROOT}/extras/package/ios/resources/gas-preprocessor.pl"

export AR="${DEVROOT}/usr/bin/ar"
export RANLIB="${DEVROOT}/usr/bin/ranlib"
export CFLAGS="-isysroot ${IOS_SDK_ROOT} -arch ${ARCH} -miphoneos-version-min=5.0 ${OPTIM}"
export OBJCFLAGS="${CFLAGS}"
if [ "$PLATFORM" = "Simulator" ]; then
    # Use the new ABI on simulator, else we can't build
    export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
fi
export CPPFLAGS="${CFLAGS}"
export CXXFLAGS="${CFLAGS}"
export CPP="${DEVROOT}/usr/bin/llvm-cpp-4.2"
export CXXCPP="${DEVROOT}/usr/bin/llvm-cpp-4.2"

export CC="${DEVROOT}/usr/bin/llvm-gcc-4.2"
export OBJC="${DEVROOT}/usr/bin/llvm-gcc-4.2"
export CXX="${DEVROOT}/usr/bin/llvm-g++-4.2"
export LD="${DEVROOT}/usr/bin/ld"
export STRIP="${DEVROOT}/usr/bin/strip"

if [ "$PLATFORM" = "OS" ]; then
  export LDFLAGS="-L${IOS_SDK_ROOT}/usr/lib -L${IOS_SDK_ROOT}/usr/lib/system -arch ${ARCH}"
else
  export LDFLAGS="-syslibroot=${IOS_SDK_ROOT}/ -arch ${ARCH}"
fi

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:${VLCROOT}/extras/contrib/build/bin:${VLCROOT}/extras/package/ios/resources"

echo "Boostraping contribs"
pushd ${VLCROOT}/extras/contrib

# contains gas-processor.pl
export PATH=$PATH:${VLCROOT}/extras/package/ios/resources

# The contrib will read the following
export IOS_SDK_ROOT

echo "Building contrib for iOS"
./bootstrap ${TARGET} ios
make src

echo "Building contrib for current host"
./bootstrap
make

popd

if [ "$PLATFORM" = "OS" ]; then
  export AS="${IOS_GAS_PREPROCESSOR} ${CC}"
  export ASCPP="${IOS_GAS_PREPROCESSOR} ${CC}"
else
  export AS="${DEVROOT}/usr/bin/as"
  export ASCPP="${DEVROOT}/usr/bin/as"
fi


echo "Bootstraping vlc"
if ! [ -e ${VLCROOT}/configure ]; then
    ${VLCROOT}/bootstrap
fi

if [ ".$PLATFORM" != ".Simulator" ]; then
    # FIXME - Do we still need this?
    export AVCODEC_CFLAGS="-I${PREFIX}include"
    export AVCODEC_LIBS="-L${PREFIX}lib -lavcodec -lavutil -lz"
    export AVFORMAT_CFLAGS="-I${PREFIX}include"
    export AVFORMAT_LIBS="-L${PREFIX}lib -lavcodec -lz -lavutil -lavformat"
fi

mkdir -p ${BUILDDIR}
pushd ${BUILDDIR}

# Run configure only upon changes.
if [ "${VLCROOT}/configure" -nt config.log -o \
     "${THIS_SCRIPT_PATH}" -nt config.log ]; then
CONTRIB_DIR=${VLCROOT}/extras/contrib/hosts/${TARGET}/ios \
${VLCROOT}/configure \
    --prefix="$PREFIX" \
    --host="${TARGET}" \
    --enable-debug \
    --disable-shared \
    --enable-static \
    --disable-macosx \
    --disable-macosx-defaults \
    --disable-macosx-vout \
    --disable-macosx-dialog-provider \
    --disable-macosx-qtcapture \
    --disable-macosx-eyetv \
    --disable-macosx-vlc-app \
    --with-macosx-sdk=${IO_SDK_ROOT} \
    --enable-audioqueue \
    --enable-ios-vout \
    --enable-avcodec \
    --enable-avformat \
    --enable-swscale \
    --enable-faad \
    --disable-mad \
    --disable-a52 \
    --disable-fribidi \
    --disable-macosx-audio \
    --disable-qt4 --disable-skins2 \
    --disable-libgcrypt \
    --disable-remoteosd \
    --disable-vcd \
    --disable-postproc \
    --disable-vlc \
    --disable-vlm \
    --disable-httpd \
    --disable-nls \
    --disable-glx \
    --disable-visual \
    --disable-lua \
    --disable-sse \
    --disable-neon \
    --disable-mmx # MMX and SSE support requires llvm which is broken on Simulator
fi

CORE_COUNT=`sysctl -n machdep.cpu.core_count`
let MAKE_JOBS=$CORE_COUNT+1

echo "Running make -j$MAKE_JOBS"

make -j$MAKE_JOBS
make install
popd

4.上述博文第4步还修改了 /VLC/MobileVLC/buildMobileVLC.sh文件,该脚本内容其实就是总的编译脚本,我之前编译执行该脚本,其实会在编译ffmpeg时下载某个压缩包就会出错,该脚本仍然会继续执行,直到后面编译项目时遇到新的问题,导致我定位实际问题所在不准确。所以一步一步,自己去执行每一条命令,好排错。所以这里我也不需要替换该脚本了。

5. 修改Makefile文件,禁用汇编,该文件位于:/VLC/vlc/extras/contrib/src目录下

改动方式:搜寻关键字“FFMPEGCONF”,FFMPEGCONF =改为FFMPEGCONF = --disable-asm

这步其实相当纠结,虽然最终编译出可运行的app,但效率实在不敢恭维,我试过1G以上的rmvb和avi文件,均无法正常播放;郁闷。

后来根据这篇文章https://github.com/yuvi/gas-preprocessor/issues/16最后提到的下载这个https://github.com/xbmc/xbmc/tree/master/tools/darwin/depends/gas-preprocessor,并替换vlc/extras/package/ios/resources下的同名文件,尝试编译,仍然会有错;

再后来我又替换了vlc/extras/contrib/src-arm-apple-darwin10-ios/src/ffmpeg/libavutil/arm目录下的intmath.h和intreadwrite.h2个头文件(其实脚本执行最先会去svn地址checkout ffmpeg,我不知道这个ffmpeg的svn内容到底是何时版本的,因为我单独编译过ffmpeg,网上的教程是git clone git://source.ffmpeg.org/ffmpeg.git这个地址,于是我直接从git clone这来的同目录下的头文件去替换了vlc里的);这样就不需要修改Makefile文件了,但编译出来运行效果还是不理想,这一步还望高人求解,如何不disable-asm而编译成功?


6. 为了编译libdvbpsi库,稍稍修改iOS SDK的源文件。这是因为编译时会报错说找不到"i386/limits.h",所以需要把这个文件拷贝到他的搜寻目录中去。

 - a) 找到目录:/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include

 - b) 在其中新建目录:i386

 - c) 全局搜索某个i386目录下的limits.h和_limits.h文件,并将搜索到的这两个文件拷贝入刚才创建的目录中。


7.替换VLC/vlc/extras/contrib里的bootstrap内容如下,mac为10.8系统的请把其中10.7的文本都替换为10.8:

#!/bin/sh
# ***************************************************************************
# bootstrap : Set up config.mak
# ***************************************************************************
# Copyright (C) 2003-2009 the VideoLAN team
# $Id$
#
# Authors: Christophe Massiot <[email protected]>
#          Derk-Jan Hartman <hartman at videolan dot org>
#          Felix Paul Kühne <fkuehne at videolan dot org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
# ***************************************************************************

if test "$#" -gt "2" -o "$1" = "-h" -o "$1" = "--help" ; then
    echo "Usage: $0 [host [distro]]" >&2
    echo "  Prepare config.mak file." >&2
    exit 1
fi

LANG=C
export LANG
set -e
set +x

BUILD=`gcc -dumpmachine`
if test "$#" -ge "1"; then
    HOST="$1"
else
    HOST="$BUILD"
fi

DISTRO=
if test "$#" = "2"; then
    echo "Forcing distro.mak to use $2.mak"
    DISTRO="$2"
    HOST="$1"
fi

rm -f config.mak
{
    echo "# Automatically generated by bootstrap."
    echo "# Make changes if you know what you're doing."
} > config.mak

rm -f distro.mak
{
    echo "# Automatically generated by bootstrap"
    echo "# Make changes if you know what you're doing."
} > distro.mak

if test "$HOST" != "$BUILD"; then
    if test -z "$CC"; then
        CC="${HOST}-gcc"
    fi
    if test -z "$CXX"; then
        CXX="${HOST}-g++"
    fi
    if test -z "$LD"; then
        LD="${HOST}-ld"
    fi
    if test -z "$RANLIB"; then
        RANLIB="${HOST}-ranlib"
    fi
    if test -z "$AR"; then
        AR="${HOST}-ar"
    fi
    if test -z "$STRIP"; then
        STRIP="${HOST}-strip"
    fi
fi

case $HOST in
    *powerpc*|*ppc*)
         ARCH="ppc"
     ;;
    *86_64*)
          ARCH="x86_64"
     ;;
    *86*)
          ARCH="i386"
     ;;
    arm*eabi)
          ARCH="armel"
     ;;
    arm*)
          ARCH="arm"
     ;;
esac
echo "ARCH = $ARCH" >> config.mak

# Check the HAVE_{OS}
case $HOST in
    *darwin*)
        echo "HAVE_DARWIN_OS = 1" >> config.mak
        echo "HAVE_BSD = 1" >> config.mak
    ;;
    *linux*)
        echo "HAVE_LINUX = 1" >> config.mak
    ;;
    *bsd*)
        echo "HAVE_BSD = 1" >> config.mak
    ;;
    *wince*)
        echo "HAVE_WINCE = 1" >> config.mak
    ;;
esac

case $DISTRO$HOST in
    ppc-darwin)
        # Mac OS X < 10.4
        echo "Your version of Mac OS X is too old!" >&2
        echo "Compiling VLC requires 10.5.x or later" >&2
        exit 1
    ;;
    *-apple-darwin8)
        echo "Your version of Mac OS X is too old!" >&2
        echo "Compiling and running VLC requires 10.5.x or later" >&2
        exit 1
    ;;
    powerpc-apple-darwin9)
        SDK_TARGET=10.7
        echo "SDK_TARGET = ${SDK_TARGET}" >> config.mak
        echo "ENVP = MACOSX_DEPLOYMENT_TARGET=${SDK_TARGET}" >> config.mak
        echo "MACOSX_SDK = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" >> config.mak
        echo "HAVE_DARWIN_9 = 1" >> config.mak
        HAVE_DARWIN_9=1
        HAVE_DARWIN_32=1
        CFLAGS_TUNING=" -arch ppc -mtune=G4"
        EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
        EXTRA_LDFLAGS=" -arch ppc -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET} -Wl,-syslibroot,\${MACOSX_SDK}"
        CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc-4.2"
        CXX="/Applications/Xcode.app/Contents/Developer/usr/bin/g++-4.2"
        LD="ld -arch ppc -syslibroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
        echo "PATH = /bin:/usr/bin:/usr/local/bin:" >> config.mak
        DISTRO=darwin
        if test -e /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs; then
            echo "SDKs found. Everything is fine." >&2
        else
            echo "ERROR:\nYour Developer Tools' SDKs were not found.\nYou need to add extra symbolic links to /Developer to achieve correctly\nbuilt contribs.\nHave a look at the OSX-Compile-HOWTO for details." >&2
            exit 1
        fi
    ;;
    i686-apple-darwin*)
        echo "Building for $DISTRO"
        SDK_TARGET=10.7
        MIN_LD_VERSION_WITH_TEXT_RELOCATION=81
        echo "SDK_TARGET = ${SDK_TARGET}" >> config.mak
        echo "HAVE_DARWIN_OS_ON_INTEL = 1" >> config.mak
        echo "HAVE_DARWIN_9 = 1" >> config.mak
        HAVE_DARWIN_9=1
        if test `ld -v 2> /dev/stdout | sed -E 's/.*ld64-([0-9]+).*/\1/'` -lt ${MIN_LD_VERSION_WITH_TEXT_RELOCATION}; then
            echo "ERROR: Your ld version is unable to compile VLC.\nUpdate to Xcode 3.1 or higher." >&2
            exit 1
        fi
        echo "ENVP = MACOSX_DEPLOYMENT_TARGET=${SDK_TARGET}" >> config.mak
        echo "MACOSX_SDK = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" >> config.mak
        HAVE_DARWIN_32=1
        CFLAGS_TUNING=" -march=prescott -mtune=generic -arch i386 -m32"
        EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
        EXTRA_LDFLAGS=" -arch i386 -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
        CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc-4.2"
        CXX="/Applications/Xcode.app/Contents/Developer/usr/bin/g++-4.2"
        echo "PATH = /bin:/usr/bin:/usr/local/bin" >> config.mak
        DISTRO=darwin
        if test -e /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs; then
            echo "SDKs found. Everything is fine." >&2
        else
            echo "ERROR:\nYour Developer Tools' SDKs were not found.\nYou need to add extra symbolic links to /Developer to achieve correctly\nbuilt contribs.\nHave a look at the OSX-Compile-HOWTO for details." >&2
            exit 1
        fi
        if test $HOST = "i686-apple-darwin10"; then
            echo "HAVE_DARWIN_10 = 1" >> config.mak
        fi
    ;;
    x86_64-apple-darwin*)
        SDK_TARGET=10.7
        echo "SDK_TARGET = ${SDK_TARGET}" >> config.mak
        echo "HAVE_DARWIN_OS_ON_INTEL = 1" >> config.mak
        echo "HAVE_DARWIN_9 = 1" >> config.mak
        echo "ENVP = MACOSX_DEPLOYMENT_TARGET=${SDK_TARGET}" >> config.mak
        echo "MACOSX_SDK = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SDK_TARGET}.sdk" >> config.mak
        HAVE_DARWIN_64=1
        CFLAGS_TUNING=" -march=core2 -mtune=core2 -m64 -arch x86_64"
        echo "HAVE_DARWIN_64 = 1" >> config.mak
        EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
        EXTRA_LDFLAGS=" -arch x86_64 -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
        echo "PATH = /bin:/usr/bin:/usr/local/bin" >> config.mak
        CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc-4.2"
        CXX="/Applications/Xcode.app/Contents/Developer/usr/bin/g++-4.2"
        LD="ld"
        RANLIB="ranlib"
        AR="ar"
        STRIP="strip"
        DISTRO=darwin64
        if test -e /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs; then
            echo "SDKs found. Everything is fine." >&2
        else
            echo "ERROR:\nYour Developer Tools' SDKs were not found.\nYou need to add extra symbolic links to /Developer to achieve correctly\nbuilt contribs.\nHave a look at the OSX-Compile-HOWTO for details." >&2
            exit 1
        fi
        if test $HOST = "x86_64-apple-darwin10"; then
            echo "HAVE_DARWIN_10 = 1" >> config.mak
        fi
    ;;
    *mingw32ce)
        echo "HAVE_WINCE = 1" >> config.mak
        echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
        EXTRA_CPPFLAGS=" -D_WIN32_WCE=0x0500"
        DISTRO=wince
    ;;
    *64-*mingw*)
        echo "HAVE_WIN64 = 1" >> config.mak
        echo "HAVE_WIN32 = 1" >> config.mak
        echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
           EXTRA_CFLAGS="-O3"
        DISTRO=win64
    ;;
    *mingw32*)
        echo "HAVE_WIN32 = 1" >> config.mak
        echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
        EXTRA_CFLAGS=" -O3 -march=i686 -mtune=generic"
        DISTRO=win32
    ;;
    i686-pc-cygwin)
        echo "HAVE_WIN32 = 1" >> config.mak
        echo "HAVE_CYGWIN = 1" >> config.mak
        CC="gcc -mno-cygwin -isystem /usr/include/mingw"
        CXX="g++ -mno-cygwin -isystem /usr/include/mingw"
        HOST=`$CC -dumpmachine`
        EXTRA_CFLAGS=" -mno-cygwin -isystem /usr/include/mingw"
        EXTRA_CPPFLAGS=" -mno-cygwin -isystem /usr/include/mingw"
        EXTRA_LDFLAGS=" -mno-cygwin"
        echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
        DISTRO=win32
    ;;
    arm-wince-pe)
        echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
        EXTRA_CPPFLAGS=" -D_WIN32_WCE"
        DISTRO=wince
    ;;
    armeb-linux-uclibc)
        echo "HAVE_UCLIBC = 1" >> config.mak
        echo "HAVE_BIGENDIAN = 1" >> config.mak
        EXTRA_CFLAGS="-Os -march=armv5 -msoft-float"
    ;;
    arm-none-linux-gnueabi)
        if test -f /etc/maemo_version; then
            DISTRO=maemo
            echo 'HAVE_MAEMO = 1' >> config.mak
            EXTRA_CFLAGS=" -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a"
            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpu=neon -mfloat-abi=softfp"
            EXTRA_CFLAGS="$EXTRA_CFLAGS -O3 -fno-tree-vectorize"
        else
            EXTRA_CFLAGS="-msoft-float"
        fi
    ;;
    *86_64*linux*)
        EXTRA_CFLAGS=" -fPIC"
        EXTRA_CPPFLAGS=" -fPIC"
        EXTRA_LDFLAGS=" -L/usr/lib64"
        echo "LIBRARY_PATH = /usr/lib64" >> config.mak
        echo "PKG_CONFIG_PATH = /usr/lib64/pkgconfig" >> config.mak
        echo "PKG_CONFIG_LIBDIR = /usr/lib64/pkgconfig" >> config.mak
    ;;
    *arm-apple-darwin*)
        EXTRA_CFLAGS=" -arch armv7"
        EXTRA_LDFLAGS=" -arch armv7"
        DISTRO="ios"
    ;;
esac
case "$DISTRO" in
  ios)
   echo 'HAVE_IOS = 1' >> config.mak
   if test -z "$IOS_SDK_ROOT"; then
     echo "ERROR:\nThe bootstrap script requires the IOS_SDK_ROOT environment variable to be set when building for iOS !"
     exit 1
   fi 
   EXTRA_CFLAGS+=" $CFLAGS"
   EXTRA_LDFLAGS+=" $LDFLAGS"
   EXTRA_CPPFLAGS+=" $CPPFLAGS"
   EXTRA_CXXFLAGS+=" $CXXFLAGS"
   echo "IOS_SDK_ROOT = ${IOS_SDK_ROOT}" >> config.mak
  ;;
esac

if test -z "${DISTRO}" -a "$HOST" = "$BUILD"; then
    if test -d "/usr/lib/pkgconfig"; then
        if test -z "$PKG_CONFIG_PATH"; then
            echo "PKG_CONFIG_PATH = /usr/lib/pkgconfig" >> config.mak
        fi
        if test -z "$PKG_CONFIG_LIBDIR"; then
            echo "PKG_CONFIG_LIBDIR = /usr/lib/pkgconfig" >> config.mak
        fi
    fi
    # Try to match distribution
    if test -f /etc/fedora-release; then
        DISTRO=fedora
    elif test -f /etc/maemo_version; then
        DISTRO=maemo
        echo 'HAVE_MAEMO = 1' >> config.mak
    elif test -f /etc/debian_version; then
        # NOTE: check for Debian *after* its derivatives
        DISTRO=debian
    fi
fi

# Default Unix-like systems
test -z "${DISTRO}" && DISTRO=unix

echo "BUILD = $BUILD" >> config.mak
echo "HOST = $HOST" >> config.mak

echo "PREFIX = `pwd`/hosts/$HOST/$DISTRO" >> config.mak

mkdir -p hosts/$HOST
ln -sfn $DISTRO hosts/$HOST/default_distro

if [ "$HOST" = "$BUILD" ]; then
   ln -sfn hosts/$HOST/$DISTRO build 
fi

echo "CC = ${CC}" >> config.mak
echo "CXX = ${CXX}" >> config.mak
echo "LD = ${LD}" >> config.mak
echo "RANLIB = ${RANLIB}" >> config.mak
echo "AR = ${AR}" >> config.mak
echo "STRIP = ${STRIP}" >> config.mak
echo "EXTRA_CFLAGS = ${CFLAGS_TUNING} ${EXTRA_CFLAGS}" >> config.mak
echo "EXTRA_CPPFLAGS = ${EXTRA_CPPFLAGS} -isystem \$(PREFIX)/include" >> config.mak
echo "EXTRA_LDFLAGS = ${EXTRA_LDFLAGS}" >> config.mak
echo "EXTRA_PATH = ${EXTRA_PATH}" >> config.mak
echo "DISTRO = ${DISTRO}" >> config.mak

#CMAKE
if test "$HOST" != "$BUILD"; then
if test ${DISTRO} = "win32"; then
echo "SET(CMAKE_SYSTEM_NAME Windows)" >> toolchain.cmake
fi
echo "SET(CMAKE_C_COMPILER ${CC})" >> toolchain.cmake
echo "SET(CMAKE_CXX_COMPILER ${CXX})" >> toolchain.cmake
echo "SET(CMAKE_FIND_ROOT_PATH  `pwd` )" >> toolchain.cmake
echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake
echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> toolchain.cmake
echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake
fi

if wget --version >/dev/null 2>&1; then
    echo "WGET = \"`which wget`\" -c --passive" >> config.mak
elif test -z `curl --version >/dev/null 2>&1`; then
    echo "WGET = \"`which curl`\" -L -O" >> config.mak
else
    echo "You need at least wget or curl to fetch the packages." >&2
    exit 1
fi

if svn --version >/dev/null 2>&1; then
    echo "SVN = \"`which svn`\"" >> config.mak
else
    echo "You do not have a subversion client in your PATH." >&2
fi

if git --version>/dev/null 2>&1; then
    echo "GIT = \"`which git`\"" >> config.mak
else
    echo "You do not have a Git client in your PATH." >&2
fi

if test -z "$CONTRIBS_RELEASE"; then
    echo "EXTRA_CFLAGS += -DNDEBUG" >> config.mak
    set +x
    echo
    echo "*****************************************************************"
    echo "* If you need contribs with all debug information, run this     *"
    echo "* line and compile the libraries on your own.                   *"
    echo "* CONTRIBS_RELEASE=no ./bootstrap                               *"
    echo "*****************************************************************"
fi

if test $HAVE_DARWIN_9; then
    set +x
    echo
    echo "*****************************************************************"
    echo "* We are using GCC-4.2 on OS X, so compilation WILL FAIL if it  *"
    echo "* is NOT installed. *"
    echo "*****************************************************************"
fi

if test $HAVE_DARWIN_32; then
    set +x
    echo
    echo "*****************************************************************"
    echo "* VLC will be compiled in 32bit mode.                           *" 
    echo "*                                                               *"
    echo "* Re-run with the x86_64-apple-darwin* argument to turn on      *" 
    echo "* 64bit compilation for Intel-based Macs, whereas * is either   *"
    echo "* 9 or 10 depending on your Darwin version.                     *"
    echo "* There is NO PPC64 support right now.                          *"
    echo "*****************************************************************"
fi

if test $HAVE_DARWIN_64; then
    set +x
    echo
    echo "*****************************************************************"
    echo "* VLC will be compiled in 64bit mode using the 10.5 SDK.        *" 
    echo "*****************************************************************"
    set -x
fi

case `uname` in
    Linux)
        CPUS=`grep -c ^processor /proc/cpuinfo`
     ;;
    *)
        CPUS=1  # default
     ;;
esac
echo "MAKEJOBS = -j$CPUS" >> config.mak

echo
echo "Using $CPUS processors"

8.终端执行命令:

cd /VLC/vlc/extras/package/ios (这里要自己改成绝对路径)
./build_for_iOS.sh


该脚本执行会遇到2处错误:

1."/usr/bin/curl" -L -O http://live555.com/liveMedia/public/live555-latest.tar.gz1.

make[1]: *** [live] Error 1

make: *** [using-src] Error 2

这个错误不管,重新执行./build_for_iOS.sh又会继续编译。


2."/usr/bin/curl" -L -O http://downloads.videolan.org/pub/videolan/testing/contrib/contrib-macosx-i386-34.tar.bz2

(cd tmp && tar jxvf ../contrib-macosx-i386-34.tar.bz2)

tar: Unrecognized archive format

tar: Error exit delayed from previous errors.

对于这个错误,先进入/vlc/extras/contrib目录,删除 temp和/host/i686-apple-darwin11/ 下darwin这两个目录,然后手动去下载http://downloads.videolan.org/pub/videolan/contrib/contrib-macosx-i386-34.tar.bz2多谢下面评论的兄弟的提醒,替换该目录下的同名压缩包;该包正常大小为24.4M,而错误下载包只有168k;然后重新执行./build_for_iOS.sh,这下应该一切编译OK


9.继续执行命令:

cd/VLC/vlc/projects/macosx/framework


xcodebuild -project MobileVLCKit.xcodeproj -target "Aggregate static plugins" -configuration "Release" -sdk iphoneos6.0 SDKROOT=iphoneos6.0 VALID_ARCHS=armv7 ARCHS=armv7
编译OK显示build success

xcodebuild -project MobileVLCKit.xcodeproj -target "MobileVLCKit" -configuration "Release"  -sdk iphoneos6.0 SDKROOT=iphoneos6.0 VALID_ARCHS=armv7 ARCHS=armv7

编译OK显示build success



cd /VLC/MediaLibraryKit


ln -s ../../vlc/projects/macosx/framework/build/Release-iphoneos External/MobileVLCKit


xcodebuild -project MobileMediaLibraryKit.xcodeproj -configuration "Release" -sdk iphoneos6.0 SDKROOT=iphoneos6.0 VALID_ARCHS=armv7 ARCHS=armv7

编译OK显示build success


10.进入VLC/MobileVLC目录,打开项目文件,Bundle identifier改成自己的,连接真机编译运行OK,拷贝几个媒体文件到Documents里,启动后就有文件列表了。


参考网址:

https://github.com/yuvi/gas-preprocessor/issues/16

http://stackoverflow.com/questions/8323672/ffmpeg-for-ios5

你可能感兴趣的:(Mac10.7.5 XCode4.5.2 ios6编译VLC1.1.0)