在网上找了一下,几乎没有可用的,算了,看别人转帖的blog还不如自己琢磨了,然后就参考官方文档,自己仔细研究一下,通过了。
在最开始编译的时候遇到了问题,编译不过去,参考了官方文档后发现也会报错,后来尝试了一下,凑巧通过了,记录一下
系统基本信息:
[StevenLiu@liudeMacBook-Pro vlc]$ xcodebuild -version Xcode 4.6.3 Build version 4H1503 [StevenLiu@liudeMacBook-Pro vlc]$ [StevenLiu@liudeMacBook-Pro vlc]$ [StevenLiu@liudeMacBook-Pro vlc]$ uname Darwin [StevenLiu@liudeMacBook-Pro vlc]$ uname -a Darwin liudeMacBook-Pro.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64 [StevenLiu@liudeMacBook-Pro vlc]$
首先步骤如下:
设置一些环境变量;
git clone git://git.videolan.org/vlc.git cd vlc;mkdir build;cd build export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc export CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ export OBJC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc ../extras/package/macosx/build.sh
这里执行完成以后,会提示如下错误:m4/with_pkg.m4:102: PKG_ENABLE_MODULES_VLC is expanded from...
.....一大坨打印信息 configure.ac:4085: the top level configure.ac:1: error: possibly undefined macro: dnl If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:38: error: possibly undefined macro: AS_IF configure.ac:57: error: possibly undefined macro: AC_DEFINE configure.ac:181: error: possibly undefined macro: AC_MSG_ERROR configure.ac:301: error: possibly undefined macro: AC_PREPROC_IFELSE configure.ac:301: error: possibly undefined macro: AC_LANG_PROGRAM configure.ac:446: error: possibly undefined macro: AC_CHECK_LIB configure.ac:456: error: possibly undefined macro: AC_CACHE_CHECK configure.ac:727: error: possibly undefined macro: AC_CHECK_HEADERS configure.ac:821: error: possibly undefined macro: AC_MSG_WARN configure.ac:847: error: possibly undefined macro: AC_LANG_PUSH configure.ac:849: error: possibly undefined macro: AC_LANG_POP configure.ac:1550: error: possibly undefined macro: AC_PATH_PROGS configure.ac:1985: error: possibly undefined macro: AC_CHECK_HEADER configure.ac:2327: error: possibly undefined macro: AC_MSG_NOTICE configure.ac:3354: error: possibly undefined macro: AC_PATH_PROG configure:26251: error: possibly undefined macro: m4_n autoreconf: /opt/local/bin/autoconf failed with exit status: 1
这是因为我之前自己编译安装过autotools,还有一些其他的乱七八糟的工具,都是自己弄的,后来将环境稍微清理了一下
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin export PATH=/Users/StevenLiu/Work/multimedia/vlc/extras/tools/build/bin:$PATH
当然,我自己定制的所有的工具,我都会与系统原生的区分开,我的PATH原来多了一个/opt/local/myself,去掉以后就等于系统原生的了。
接下来build.sh会自动download编译vlc所需要的工具然后安装,一切都很顺利,但是后来又遇到了一个问题,哦 shit!
[StevenLiu@liudeMacBook-Pro build]$ ../extras/package/macosx/build.sh + ARCH=x86_64 + MINIMAL_OSX_VERSION=10.6 + OSX_VERSION=10.8 ++ xcode-select -print-path + SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk + getopts hvk:a: OPTION + shift 0 + '[' x '!=' x ']' + out=/dev/stdout + '[' '' = yes ']' + info 'Building VLC for the Mac OS X' + local 'green=\033[1;32m' + local 'normal=\033[0m' + echo '[\033[1;32mbuild\033[0m] Building VLC for the Mac OS X' [build] Building VLC for the Mac OS X ++ dirname ../extras/package/macosx/build.sh + spushd ../extras/package/macosx/../../.. + pushd ../extras/package/macosx/../../.. ++ pwd + vlcroot=/Users/StevenLiu/Work/multimedia/vlc + spopd + popd ++ pwd + builddir=/Users/StevenLiu/Work/multimedia/vlc/build + info 'Building in "/Users/StevenLiu/Work/multimedia/vlc/build"' + local 'green=\033[1;32m' + local 'normal=\033[0m' + echo '[\033[1;32mbuild\033[0m] Building in "/Users/StevenLiu/Work/multimedia/vlc/build"' [build] Building in "/Users/StevenLiu/Work/multimedia/vlc/build" + export 'CC=xcrun clang' + CC='xcrun clang' + export 'CXX=xcrun clang++' + CXX='xcrun clang++' + export 'OBJC=xcrun clang' + OBJC='xcrun clang' + export OSX_VERSION + export SDKROOT + export PATH=/Users/StevenLiu/Work/multimedia/vlc/extras/tools/build/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin + PATH=/Users/StevenLiu/Work/multimedia/vlc/extras/tools/build/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin + TRIPLET=x86_64-apple-darwin10 + info 'Building building tools' + local 'green=\033[1;32m' + local 'normal=\033[0m' + echo '[\033[1;32mbuild\033[0m] Building building tools' [build] Building building tools + spushd /Users/StevenLiu/Work/multimedia/vlc/extras/tools + pushd /Users/StevenLiu/Work/multimedia/vlc/extras/tools + ./bootstrap + make You are ready to build VLC and its contribs + spopd + popd + info 'Building contribs' + local 'green=\033[1;32m' + local 'normal=\033[0m' + echo '[\033[1;32mbuild\033[0m] Building contribs' [build] Building contribs + spushd /Users/StevenLiu/Work/multimedia/vlc/contrib + pushd /Users/StevenLiu/Work/multimedia/vlc/contrib + mkdir -p build + cd build + ../bootstrap --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 Creating configuration file... config.mak Bootstrap completed. Run "make" to start compilation. Other targets: * make install same as "make" * make prebuilt fetch and install prebuilt binaries * make list list packages * make fetch fetch required source tarballs * make fetch-all fetch all source tarballs * make distclean clean everything and undo bootstrap * make mostlyclean clean everything except source tarballs * make clean clean everything * make package prepare prebuilt packages + '[' '!' -e ../x86_64-apple-darwin10 ']' + spopd + popd + info 'Bootstrap-ing configure' + local 'green=\033[1;32m' + local 'normal=\033[0m' + echo '[\033[1;32mbuild\033[0m] Bootstrap-ing configure' [build] Bootstrap-ing configure + spushd /Users/StevenLiu/Work/multimedia/vlc + pushd /Users/StevenLiu/Work/multimedia/vlc + '[' -e /Users/StevenLiu/Work/multimedia/vlc/configure ']' + spopd + popd + '[' /Users/StevenLiu/Work/multimedia/vlc/configure -nt Makefile ']' + /Users/StevenLiu/Work/multimedia/vlc/extras/package/macosx/configure.sh --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --with-macosx-version-min=10.6 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk configure: error: cannot find install-sh, install.sh, or shtool in autotools "/Users/StevenLiu/Work/multimedia/vlc/extras/package/macosx/../../.."/autotools
最后一行,咋还有错误呢,然后走狗屎运了,我想自己手动执行一下:
cd .. ./bootstrap
然后竟然不提示错误了,这时候生成了configure文件了,然后进入到build里面继续
../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
执行完这一句以后,就可以make了
make -j8
然后就生成了VLC.app文件。搞定,很好用
参考文档:
https://wiki.videolan.org/OSXCompile