Merge pull request #1247 from zewt/win32-not-exiting
[vuplus_xbmc] / docs / README.osx
1 TOC
2 1. Introduction
3 2. Getting the source code
4 3. Install required libs
5   3.1. Install Xcode
6   3.2. Install XBMC build depends
7 4. How to compile and run
8         4.1 Using XCode
9         4.2 Using Command line
10 5. Packaging
11
12 -----------------------------------------------------------------------------
13 1. Introduction
14 -----------------------------------------------------------------------------
15
16 This is a platform port of XBMC for the Apple OSX operating system. Both 10.6
17 and 10.7 Intel development platforms are supported. Xcode 3.2.6 and 4.3 and newer
18 are the recommended versions.
19 There are 3 ways to build XBMC for Mac, from command-line with make, from command-line
20 using xcodebuild or from Xcode.
21
22 Generally, Xcode is the easiest as it presents the build system in a GUI environment.
23 The command-line build is still under development.
24
25 XBMC for Mac is composed of a main binary with numerous dynamic libraries and
26 codecs that support a multitude of music and video formats.
27
28 On Snow Leopard (OSX 10.6.x) we recommend using Xcode 3.2.6.
29 On Lion (OSX 10.7.x) we recommend using Xcode 4.3.x.
30
31 NOTE TO NEW OS X USERS: All lines that are prefixed with the '$' character are
32 commands that need to be typed into a Terminal window. Note that the '$'
33 character itself should NOT be typed as part of the command.
34
35
36 -----------------------------------------------------------------------------
37 2. Getting the source code
38 -----------------------------------------------------------------------------
39
40  $ cd $HOME
41  $ git clone git://github.com/xbmc/xbmc.git xbmc
42
43 -----------------------------------------------------------------------------
44 3.0 Install XCODE
45 -----------------------------------------------------------------------------
46 Install latest Xcode (4.3.2 or 3.2.6 as of the writing). You can download it from 
47
48 1. Apple's site after registration at http://developer.apple.com/tools/download (Xcode 3.2.6)
49 2. In the MacOSX AppStore (Xcode 4.3.x). 
50
51 If you are using XCode 4.3.x or later you also need to install the "Command Line Tools". To do so
52 after installing Xcode you have to go to "Xcode->Preferences->Downloads" and install the
53 package "Command Line Tools".
54
55 Xcode 3.2.6 only runs on 10.6.x (Snow Leopard). 
56 Xcode 4.3.x only runs on 10.7.x (Lion).
57 Xcode 4.4 only runs on 10.8.x (Mountain Lion).
58
59 -----------------------------------------------------------------------------
60 3.1 Install XBMC build depends
61 -----------------------------------------------------------------------------
62
63 3.1.1 Compiling as 32 Bit binary
64  $ cd $HOME/XBMC
65  $ cd tools/darwin/depends
66  $ ./bootstrap
67  $ ./configure --with-darwin=osx
68  $ make
69
70 3.1.2 Compiling as 64 Bit binary
71  $ cd $HOME/XBMC
72  $ cd tools/darwin/depends
73  $ ./bootstrap
74  $ ./configure --with-darwin=osx --with-arch=x86_64
75  $ make
76
77 IMPORTANT!! for Mountain Lion users. In Xcode 4.4 there is only SDK 10.7 and 10.8
78 available. The XBMC buildsystem defaults to 10.6. So for compiling with ML
79 you have to specify the 10.7 SDK explicitly on configure:
80
81  $ ./configure --with-darwin=osx --with-sdk=10.7
82
83
84 -----------------------------------------------------------------------------
85 4. How to compile
86 -----------------------------------------------------------------------------
87 Both Xcode and Terminal compilation require that build environment be setup
88 first. This is a simple step and involves the following:
89
90 4.a Compilation by using command-line building via xcodebuild or
91     by compiling via Xcode GUI
92
93  $ cd $HOME/XBMC
94  $ make -C tools/darwin/depends/xbmc
95  $ make clean
96  $ make xcode_depends
97  $ make -C lib/addons/script.module.pil
98
99 4.b Compilation by using command-line building via make (experimental)
100
101  $ cd $HOME/XBMC
102  $ make -C tools/darwin/depends/xbmc
103  $ make clean
104
105 The configure operation will setup the build environment for codecs and
106 internal libraries that are used by XBMC. This step is required for both Xcode
107 and command-line building. The "make clean" ensures that there are no stale
108 binaries from git that might cause problems.
109
110 -----------------------------------------------------------------------------
111 4.1 Using Xcode
112 -----------------------------------------------------------------------------
113 Start XCode and open the XBMC project (XBMC.xcodeproj) located in $HOME/XBMC.
114 For development, XBMC is run from the $HOME/XBMC directory and needs to have
115 the XBMC_HOME environment variable set to know where that directory is located.
116 To set XBMC_HOME environment variable:
117
118 Xcode 3.2.6
119  Menu -> Project -> Edit Active Executable "XBMC", click "Arguments" tab and
120  add "XBMC_HOME" as an enviroment variable. Set the value to the path to the
121  XBMC root folder. For example, "/Users/bigdog/Documents/XBMC"
122
123 Xcode 4.3.x and later
124  Menu -> Product -> Edit Sheme -> "Run XBMC"/"Debug" -> Add XBMC_HOME into 
125  the List of "Environment Variables".Set the value to the path to thev XBMC 
126  root folder. For example, "/Users/bigdog/Documents/XBMC"       
127
128 There are two build targets "XBMC" and "XBMC.app" (each in 32Bit and 64Bit flavour) 
129 with debug and release settings. The "XBMC" target is used for rapid build and 
130 debug cycles while the "XBMC.app" target is used to build a self contained 
131 OSX application.
132
133 Set the build target to "XBMC" or "XBMC.app" and be sure to select the same 
134 architecture as selected in step 3.1 (either i386 for 32Bit or x86_64 for 64Bit), 
135 then build. 
136
137 Mountain Lion users have to ensure to build against 10.7 SDK not 10.8 (which is
138 selected in Xcode 4.4 by default).
139
140 The build process will take a long time when building the first time. 
141 You can see the progress in "Build Results". There are a large number of static 
142 and dynamic libaries that will need to be built. Once these are built, 
143 subsequent builds will be faster.
144
145 After the build, you can ether run XBMC for Mac from Xcode or run it from
146 the command-line. If you run it from the command-line, make sure your set
147 the XBMC_HOME environment variable (export XBMC_HOME=$HOME/XBMC). Then, to
148 run the debug version:
149
150 $ ./build/Debug/XBMC
151
152 Or the release version:
153
154 $ ./build/Release/XBMC
155
156 You can also build via Xcode from the command-line using the following:
157
158 $ xcodebuild -configuration Release ONLY_ACTIVE_ARCH=YES ARCHS=i386 VALID_ARCHS=i386 \
159   -target "XBMC.app" -project XBMC.xcodeproj
160
161 You can specify "Release" instead of "Debug" as a configuration. Be sure to set *_ARCHS
162 variables to the same architecture as selected in step 3.1 (either i386 for 32Bit or x86_64 
163 for 64Bit).
164
165 -----------------------------------------------------------------------------
166 4.2 Using Terminal (command-line) (this is a work in progress and might fail)
167 -----------------------------------------------------------------------------
168 There are two methods, a) make/Xcode and b) make (which might fail as it's under
169 construction).
170
171 If you want to build a cross-compiled version that can run under 10.6/10.7, 
172 you could try xcodebuild from the command-line (normally unneeded - for advanced
173 developers).
174
175  a)
176  $ cd $HOME/XBMC
177  $ export XBMC_HOME=`pwd`
178  $ make xcode_depends
179  $ make -C lib/addons/script.module.pil
180  $ xcodebuild -sdk macosx10.7 -project XBMC.xcodeproj -target XBMC.app ONLY_ACTIVE_ARCH=YES \
181    ARCHS=x86_64 VALID_ARCHS=x86_64  -configuration Release build
182
183  b) building via make
184  $ cd $HOME/XBMC
185  $ export XBMC_HOME=`pwd`
186  $ make
187  $ ./xbmc.bin
188
189 -----------------------------------------------------------------------------
190 5. Packaging
191 -----------------------------------------------------------------------------
192 This section describes how to package XBMC in a disk image for
193 distribution.
194
195   1. build XBMC.app from XCode so that the application bundle is correctly updated.
196
197   2. make -C tools/darwin/packaging/xbmc-osx
198
199   3. If completed successfully, a disk image named XBMC_for_Mac.dmg will be
200   present in the users XBMC build directory:
201
202 Remember to unmount/eject XBMC.dmg before attempting to recreate it,
203 otherwise dmgmaker.pl will fail.
204