Difference between revisions of "MacOSCompile"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== Pre-requisites ==
 
== Pre-requisites ==
* MacOSX 10.5
+
=== Apple ===
 +
* You need at least MacOSX 10.5
 
* '''Developer Tools from Apple''' from http://developer.apple.com/technology/xcode.html
 
* '''Developer Tools from Apple''' from http://developer.apple.com/technology/xcode.html
 
Make sure that the LLVM GCC 4.2 compiler is installed.
 
Make sure that the LLVM GCC 4.2 compiler is installed.
 +
 +
Xcode 3 and Xcode4 should be fine.
 +
 +
=== Git ===
 +
You need to get git to clone VLC.
 +
 
* '''Git''' from http://git-scm.com/
 
* '''Git''' from http://git-scm.com/
 
* You can use [http://mxcl.github.com/homebrew/ homebrew] as:
 
* You can use [http://mxcl.github.com/homebrew/ homebrew] as:
 
$  brew install git
 
$  brew install git
  
 +
=== PATH ===
 
'''Pay careful attention to remove any reference to 3rd party package managersfrom your environment.'''
 
'''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.
 
This is important to avoid conflicts between your package manager (homebrew, fink, macports...) and the contrib package manager we use to build our contrib.

Revision as of 12:06, 27 November 2011

Pre-requisites

Apple

Make sure that the LLVM GCC 4.2 compiler is installed.

Xcode 3 and Xcode4 should be fine.

Git

You need to get git to clone VLC.

$ brew install git

PATH

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

Get the source code

 $ 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.

Build needed 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.

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.