|
|
Line 1: |
Line 1: |
− | == Prepare Mac OS X for build VLC == | + | == Pre-requisites == |
| + | * MacOSX 10.5 |
| + | * '''Developer Tools from Apple''' from http://developer.apple.com/technology/xcode.html |
| + | Make sure that the LLVM GCC 4.2 compiler is installed. |
| + | * '''Git''' from http://git-scm.com/ |
| + | * You can use [http://mxcl.github.com/homebrew/ homebrew] as: |
| + | $ brew install git |
| | | |
− | Compiling {{VLC}} on Mac OS X is just a bit more complex than other projects (but not much) because we do not use Xcode to configure, but a simple <code>./configure</code> and then <code>make</code> isn't enough either. You need both.
| + | '''Pay careful attention to remove any reference to 3rd party package managersfrom your environment.''' |
| + | This is important to avoid conflicts between your package manager (homebrew, fink, macports...) and the contrib package manager we use to build our contrib. |
| | | |
− | The instructions below are always for the currently unstable, non-released code.
| + | '''git must still be accessible though!''' |
| + | $ unset PKG_CONFIG_PATH |
| + | $ unset PKG_CONFIG_LIBDIR |
| + | $ export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin |
| | | |
− | === Install === | + | == [[GetTheSource|Get the source code]] == |
− | You need to install:
| |
− | * '''Developer Tools from Apple''' do this now: http://developer.apple.com/technology/xcode.html
| |
− | * '''Git''' from http://git-scm.com/ and '''pkg-config'''
| |
− | * You can use [http://mxcl.github.com/homebrew/ homebrew] to do this:
| |
− | brew install git pkg-config
| |
− | | |
− | === Nota Bene ===
| |
− | * Be sure to read the paragraph on Mac OS X "Leopard and Lion" before starting the compilation, if you are on those OSes.
| |
− | * If you wish to develop or test please join the [http://www.videolan.org/developers/lists.html vlc-devel mailinglist ].
| |
− | | |
− | == Quick Steps on Mac OS X 10.5 == | |
− | Configure the environment:
| |
− | | |
− | $ export CC=/Developer/usr/bin/llvm-gcc-4.2
| |
− | $ export CXX=/Developer/usr/bin/llvm-g++-4.2
| |
− | $ export OBJC=/Developer/usr/bin/llvm-gcc-4.2
| |
− | | |
− | Download the sources from repository:
| |
| | | |
| $ git clone git://git.videolan.org/vlc.git | | $ git clone git://git.videolan.org/vlc.git |
| | | |
− | Build needed additional libs: | + | == Build needed additional development tools == |
| | | |
− | $ cd vlc/extras/contrib | + | $ cd vlc/extras/tools |
| $ ./bootstrap | | $ ./bootstrap |
− | $ make | + | $ make -j4 |
− |
| + | You can tune the -j4 option depending of the number of CPUs you have. |
− | Build VLC:
| |
| | | |
− | $ cd ../..
| + | == 32 bits versus 64 bits and SDK selection == |
− | $ ./bootstrap
| |
− | $ ./configure --enable-debug --disable-nls
| |
− | $ make
| |
| | | |
− | If you want a distributable build of VLC: | + | If you want to use the 10.6 SDK (your VLC will only run on 10.6 and more recent computers): |
| + | $ export OSX_VERSION=10.6 |
| | | |
− | $ make VLC-release.app
| + | The instructions below will build a 64 bits binary using 10.6 (Leopard) SDK. |
| + | This is reflected by using host and build variables '''x86_64-apple-darwin10'''. |
| | | |
− | == Quick Steps on Mac OS X 10.6 ==
| + | This "triplet" is ARCHITECTURE-apple-SYSTEM. |
− | Configure the environment:
| |
| | | |
− | $ export CC=/Developer/usr/bin/llvm-gcc-4.2
| + | * <code>x86_64</code> represents Intel 64bits. |
− | $ export CXX=/Developer/usr/bin/llvm-g++-4.2
| + | * <code>i686</code> represents Intel 32bits. |
− | $ export OBJC=/Developer/usr/bin/llvm-gcc-4.2
| + | * <code>powerpc</code> represents PowerPC 32bits. |
| | | |
− | Download the sources from repository:
| + | * <code>darwin9</code> represents MacOSX 10.5. |
| + | * <code>darwin10</code> represents MacOSX 10.6 and more recent. |
| | | |
− | $ git clone git://git.videolan.org/vlc.git
| + | * So to make a PowerPC build, you would use '''powerpc-apple-darwin9'''. |
| | | |
− | Build needed additional libs: | + | == Build needed [[Contrib_Status| 3rd party libraries]] == |
| + | $ cd ../../contrib |
| + | $ mkdir -p osx && cd osx |
| + | $ ../bootstrap --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10 |
| + | If you want to download a prebuilt package of all the needed libraries. |
| + | $ make prebuilt |
| + | If prebuilt package for your host does not exist, or if you want to build from source |
| + | $ make -j4 .gettext && make -j4 |
| + | If you had no errors, the 3rd party libraries (contrib) are built correctly and you can proceed to the next step. |
| | | |
− | $ cd vlc/extras/contrib
| + | == Create configure and Makefile.in == |
− | $ ./bootstrap x86_64-apple-darwin10
| |
− | $ make
| |
− |
| |
− | Build VLC:
| |
| | | |
| $ cd ../.. | | $ cd ../.. |
| $ ./bootstrap | | $ ./bootstrap |
− | $ ./configure --enable-debug --disable-nls --build=x86_64-apple-darwin10
| |
− | $ make
| |
| | | |
− | If you want a distributable build of VLC:
| + | == Configure the build == |
| | | |
− | $ make VLC-release.app
| + | $ mkdir -p build && cd build |
| + | $ ../extras/package/macosx/configure.sh --help |
| + | To list the different options |
| + | $ ../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10 |
| + | To build a 64 bits binary. |
| | | |
| + | == Build == |
| | | |
− | == Steps ==
| + | $ make -j4 |
| | | |
− | Please follow these steps for compiling:
| + | == Package == |
− | | + | If you want to share the application with another user or another computer: |
− | === Set the development environment === | |
− | | |
− | Install the Mac OS X Developer Tools or get them online.
| |
− | | |
− | You need at least Mac OS X 10.5 and Xcode 3.1.4 for compilation. Mac OS X 10.6 and its 3.2.x Xcode releases are also supported. Make sure that the LLVM GCC 4.2 compiler is installed.
| |
− | | |
− | Compiling with earlier releases of Mac OS X and/or Xcode will not work.
| |
− | | |
− | Additionally, you may need to install Subversion (SVN) and more importantly Git on your Mac.
| |
− | | |
− | === Get the source ===
| |
− | Download the {{VLC}} [[GetTheSource|source code]] (using [[Git]]) as described on the [[GetTheSource| "Get the source"]] page or get a recent source tarball. Note that the 3rd party libraries will probably break a few months after the release's publication.
| |
− | | |
− | === Build external libs ===
| |
− | | |
− | We now need to build the [[Contrib_Status| 3rd party libs]]. For that, you will need to:
| |
− | * cd to the source directory with your Terminal application.
| |
− | * If you have fink, then you will need to disable it. {{VLC}} has it's own form of Fink (in the extras/contrib subdir) and it can conflict with Fink. We use this system to generate a reliable, consistent and known amount of packages that {{VLC}} requires.
| |
− | | |
− | ''To disable Fink comment the line: ''<code>#source /sw/bin/init.csh</code>'' in your .cshrc file or ''<code> . /sw/bin/init.csh</code>'' in your .bashrc file or ''<code> test -r /sw/bin/init.sh && . /sw/bin/init.sh</code>'' in your .profile file in your home-directory.''
| |
− | | |
− | * First fetch the contribs. Those are external libraries needed by VLC.
| |
− | $ cd extras/contrib
| |
− | $ ./bootstrap
| |
− | $ make
| |
− | | |
− | The last command will download '''prebuilt''' binary contrib you can happily use to build VLC wth -- only if you're using git master branch or the bugfix branch for 0.9 / 1.0.
| |
− | You will only have to do this once. (You can do it again if required libraries are added or updated by the team.)
| |
− | | |
− | If you're trying to debug these libraries or want to create a new package, you need to execute <code>make src</code>
| |
− | | |
− | ''Note that the 10.5 SDK is used by default. If you encounter problems, make sure that the script correctly used Apple's GCC-4.2 compiler (no LLVM-GCC here!) and your Xcode installation is up-to-date.''
| |
− | | |
− | === Prepare the VLC build ===
| |
− | Now we return to VLC itself. Go back to the top level VLC source directory.
| |
− | $ cd ../..
| |
− | $ ./bootstrap
| |
− | | |
− | This will create configure and Makefiles for {{VLC}} (snapshots and releases already include this).
| |
− | | |
− | === Setup the correct compiler ===
| |
− | Current revisions of VLC need to be compiled using Apple's llvm-gcc-4.2 compiler in its latest version. In case of failures, make sure that the latest version of Xcode is installed.
| |
− | To use this compiler, you need to export the respective variables. In a Bourne Shell, type this (if Xcode is installed to its default location; bash is the default shell on OS X):
| |
− | | |
− | $ export CC=/Developer/usr/bin/llvm-gcc-4.2
| |
− | $ export CXX=/Developer/usr/bin/llvm-g++-4.2
| |
− | $ export OBJC=/Developer/usr/bin/llvm-gcc-4.2
| |
− | | |
− | If you are using a C-Shell, you need to use the ''setenv'' command of course.
| |
− | | |
− | === Configure the VLC build ===
| |
− | The next step is to configure, in the top level VLC source directory.
| |
− | | |
− | In current revisions, you can simply run
| |
− | $ ./configure --enable-debug
| |
− | to get VLC in its default configuration. If do not want to use VLC's default configuration for Mac, be sure to add <code>--disable-macosx-defaults</code> to your custom set. Using <code>--disable-nls</code> will save you a lot of time, if you don't care about localised interfaces.
| |
− | | |
− | When compiling earlier revisions or the 0.8.6 branch, you need to give a wide variety of configure flags to achieve a useful build. We used to use this set:
| |
− | <code> ./configure --enable-debug --disable-x11 --disable-xvideo --disable-glx --enable-sdl --enable-mad --enable-libdvbpsi --enable-a52 --disable-dvdplay --enable-dvdnav --enable-dvdread --enable-ffmpeg --enable-faad --enable-flac --enable-vorbis --enable-speex --enable-theora --enable-ogg --enable-shout --enable-cddb --disable-cddax --enable-vcdx --disable-skins --disable-skins2 --disable-wxwidgets --enable-freetype --enable-fribidi --enable-caca --enable-live555 --enable-dca --enable-goom --enable-modplug --enable-gnutls --enable-daap --enable-ncurses --enable-libtwolame --enable-x264 --enable-png --enable-realrtsp --enable-lua --disable-libtool</code>
| |
− | Have a look at configure.ac for our current default configuration.
| |
− | | |
− | You can add <code>--with-mozilla-sdk-path=./extras/contrib/gecko-sdk --enable-mozilla</code> to the configure-line to enable the compilation of VLC's Safari/Firefox plugin.
| |
− | | |
− | === Build VLC ===
| |
− | After configure is finished, we can finally build {{VLC}}. A simple <code>make</code> will do the trick. If you want to use the resulting application package on a different Mac or a different account on the same Mac, run
| |
− | $ make
| |
| $ make VLC-release.app | | $ make VLC-release.app |
− | afterwards. Use the resulting ''VLC-release.app'' for these purposes.
| |
| | | |
− | If you want a disk-image, type | + | If you want a disk-image: |
| $ make package-macosx | | $ make package-macosx |
− | (respectively <code>make package-macosx-plugin</code> for the Safari/Mozilla plugin).
| + | Respectively <code>make package-macosx-plugin</code> for the Safari/Mozilla plugin. |
| | | |
− | === What's wrong, if I don't succeed? ===
| + | == What's wrong, if I don't succeed? == |
| Starting with Leopard, Xcode may be installed to a custom location on the administrator's choice. While this is non-problematic for ordinary Xcode projects, VLC needs a little help. You have to place extra symbolic links in /Developer pointing to your custom location for these folders: | | Starting with Leopard, Xcode may be installed to a custom location on the administrator's choice. While this is non-problematic for ordinary Xcode projects, VLC needs a little help. You have to place extra symbolic links in /Developer pointing to your custom location for these folders: |
| | | |
Line 159: |
Line 89: |
| <code>ln -s /full/path/to/Developer/theFolder /Developer/theFolder</code> | | <code>ln -s /full/path/to/Developer/theFolder /Developer/theFolder</code> |
| | | |
− | '''Additionally, make always sure that you are using the latest version of Xcode. Otherwise, VLC's compilation or behaviour at runtime won't be the way you want it to be.''' | + | '''Additionally, make always sure that you are using the latest version of Xcode.''' |
− | | |
− | == What about 64-bit? ==
| |
− | The master branch can be compiled in 64-bit mode on OS X. This is also possible with the 1.0-branch, but neither recommended nor supported. 64bit execution is only tested for x86_64, but PPC64 should probably also work. Precompiled contribs are usually available for x86_64. To see how to compile VLC this way, check the documentation of your GCC vendor, as there are known differences within the supported versions of Mac OS X, but you may try:
| |
− | | |
− | === bootstrap in extras/contrib with with "x86_64-apple-darwin*" argument ===
| |
− | The asterix is either 9 or 10 depending on your Mac OS X version. Afterwards, just type make as usual.
| |
− | | |
− | === Running configure on Mac OS X 10.5 aka Darwin 9 ===
| |
− | Do the following <code>./configure CFLAGS="-m64" CXXFLAGS="-m64" LDFLAGS="-m64" OBJCFLAGS="-m64" --host=x86_64-apple-darwin9</code> instead of the regular line. Replacing x86_64 with PPC64 here should work, but is untested.
| |
− | | |
− | === Running configure on Mac OS X 10.6 aka Darwin 10 ===
| |
− | Just <code>./configure --build=x86_64-apple-darwin10</code>. Xcode 3.2.x creates 64bit builds by default.
| |
− | | |
− | == Snow Leopard and Lion ==
| |
− | A series of problem affect the build under Mac OS X 10.6 (Snow Leopard / darwin 10), these include:
| |
− | | |
− | === 32-bit builds ===
| |
− | The compiler now tries to build for the x86_64 arch by default, if you want to make a 32-bit build of VLC, you have to change the configure, similarly to what shown above: <code>./configure --host=i386-apple-darwin10 CFLAGS="-arch i386" CXXFLAGS="-arch i386" LDFLAGS="-arch i386" OBJCFLAGS="-arch i386"</code>
| |
− | | |
− | === Missing libiconv.la ===
| |
− | The <code>/usr/lib/libiconv.la</code> file has been removed, but the other .la files in contrib still reference it. By default, the Makefile in extras/contrib will fix this automatically, as it changes all references to this file lib/*.la to lib/libiconv.la, which is provided by VLC's contrib package.
| |
− | '''Please note that removing all libtool libraries (*.la) is not recommended, as this will lead to errors when configuring VLC.'''
| |
− | | |
− | === Xcode 4 ===
| |
− | This version of Xcode isn't supported by default yet. If you still like to use it, set the compiler environment variables as desired (note that Clang 2.0 can't fully compile VLC yet because of missing ASM features) and use the following configure line:
| |
− | <code>./configure --enable-debug --build=x86_64-apple-darwin10 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --enable-macosx</code>
| |
− | This line is needed because VLC will try to use the 10.5 SDK by default, which isn't available to Xcode 4 users. If you don't want the Mac OS X interface (for VLCKit or Lunettes users), remove the last option.
| |
− | | |
− | === Clang ===
| |
− | You can also use clang / clang++ to compile VLC if you set the respective $CC, ... variables. However, note that clang doesn't include full support for inline assembler as of yet, which is why you need to configure VLC with <code>--disable-sse --disable-mmx</code> or provide a patch to the LLVM project fixing their compiler.
| |
− | | |
− | == History ==
| |
− | Written by Jean-Alexis Montignies, [[User:Fkuehne|Felix Paul Kühne]] and [[User:The DJ|Derk-Jan Hartman]], for the VideoLAN Team.
| |
− | Adapted to the Wiki by [[User:j-b|Jean-Baptiste Kempf]].
| |
| | | |
| [[Category:Building]] | | [[Category:Building]] |
| [[Category:Coding]] | | [[Category:Coding]] |
Pre-requisites
Make sure that the LLVM GCC 4.2 compiler is installed.
$ brew install git
Pay careful attention to remove any reference to 3rd party package managersfrom your environment.
This is important to avoid conflicts between your package manager (homebrew, fink, macports...) and the contrib package manager we use to build our contrib.
git must still be accessible though!
$ unset PKG_CONFIG_PATH
$ unset PKG_CONFIG_LIBDIR
$ export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
$ git clone git://git.videolan.org/vlc.git
Build needed additional development tools
$ cd vlc/extras/tools
$ ./bootstrap
$ make -j4
You can tune the -j4 option depending of the number of CPUs you have.
32 bits versus 64 bits and SDK selection
If you want to use the 10.6 SDK (your VLC will only run on 10.6 and more recent computers):
$ export OSX_VERSION=10.6
The instructions below will build a 64 bits binary using 10.6 (Leopard) SDK.
This is reflected by using host and build variables x86_64-apple-darwin10.
This "triplet" is ARCHITECTURE-apple-SYSTEM.
x86_64
represents Intel 64bits.
i686
represents Intel 32bits.
powerpc
represents PowerPC 32bits.
darwin9
represents MacOSX 10.5.
darwin10
represents MacOSX 10.6 and more recent.
- So to make a PowerPC build, you would use powerpc-apple-darwin9.
$ cd ../../contrib
$ mkdir -p osx && cd osx
$ ../bootstrap --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
If you want to download a prebuilt package of all the needed libraries.
$ make prebuilt
If prebuilt package for your host does not exist, or if you want to build from source
$ make -j4 .gettext && make -j4
If you had no errors, the 3rd party libraries (contrib) are built correctly and you can proceed to the next step.
Create configure and Makefile.in
$ cd ../..
$ ./bootstrap
Configure the build
$ mkdir -p build && cd build
$ ../extras/package/macosx/configure.sh --help
To list the different options
$ ../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
To build a 64 bits binary.
Build
$ make -j4
Package
If you want to share the application with another user or another computer:
$ make VLC-release.app
If you want a disk-image:
$ make package-macosx
Respectively make package-macosx-plugin
for the Safari/Mozilla plugin.
What's wrong, if I don't succeed?
Starting with Leopard, Xcode may be installed to a custom location on the administrator's choice. While this is non-problematic for ordinary Xcode projects, VLC needs a little help. You have to place extra symbolic links in /Developer pointing to your custom location for these folders:
usr, Headers, Private, SDKs, Tools, Makefiles
You can easily create these links by executing the following command for each folder (whereas theFolder is one of these six):
ln -s /full/path/to/Developer/theFolder /Developer/theFolder
Additionally, make always sure that you are using the latest version of Xcode.