aboutsummaryrefslogtreecommitdiff
path: root/README.osx
blob: 148b26718fea51105a67aca2b568ed65d65c74fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
TOC
1. Introduction
2. Getting the source code
3. Install required libs
  3.1. Install Xcode
  3.2. Install MacPorts 1.7
4. How to compile and run
	4.1 Using XCode
	4.2 Using Command line
5. Packaging

-----------------------------------------------------------------------------
1. Introduction
-----------------------------------------------------------------------------

This is a platform port of XBMC for the Apple OSX operating system. Both 10.5
and 10.4 Intel development platforms are supported. The current build system
is Xcode 2.5 or Xcode 3.1.2 There are two ways to build XBMC for Mac.
1) command-line or
2) Xcode.

Generally, Xcode is the easiest as it presents the build system in a GUI environment.
The command-line build is still under development.

XBMC for Mac is composed of a main binary with numerous dynamic libraries and
codecs that support a multitude of music and video formats.

NOTE TO NEW OS X USERS: All lines that are prefixed with the '$' character are
commands that need to be typed into a Terminal window. Note that the '$'
character itself should NOT be typed as part of the command.


-----------------------------------------------------------------------------
2. Getting the source code
-----------------------------------------------------------------------------

 $ cd $HOME
 $ svn checkout https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk

-----------------------------------------------------------------------------
3.0 Install XCODE
-----------------------------------------------------------------------------
Install latest Xcode. You can download it from Apple's site after registration at
(http://developer.apple.com/tools/download). You also need to install the 10.4
sdk. If using Xcode 3.x, you MUST use Xcode 3.1.2 so update your existing version
if you are running a previous Xcode 3.x version. Xcode 3.x only runs on 10.5.


-----------------------------------------------------------------------------
3.1 Install MacPorts 1.7
-----------------------------------------------------------------------------

These build instructions depend on MacPorts 1.7.1 from xbmc-port-depends. 
If you have another version of MacPorts installed, it's best to remove it and
install this 1.7.1 version. To remove a previous install of MacPorts, enter the
following from a terminal windows:

 $ sudo rm -rf \
    /opt/local \
    /etc/manpaths.d/macports \
    /etc/paths.d/macports \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0

Install MacPorts 1.7.1 (see http://code.google.com/p/xbmc-port-depends/). No NOT
install the versions from http://www.macports.org, they were hopelessly broke
for XBMC usage when their devs released MacPorts 1.8. Change MacPorts's behavior
to always build universal against 10.4sdk using the following instructions.

 1)
   $ sudo nano /opt/local/etc/macports/macports.conf
   a) change "universal_target	10.5" to "universal_target	10.4"

   b) change "universal_sysroot	/Developer/SDKs/MacOSX10.5.sdk" to
     "universal_sysroot	/Developer/SDKs/MacOSX10.4u.sdk"

   c) change "universal_archs         ppc i386"
     to reflect the arch you are building by removing the unused arch.

 2) These are needed to build openssl (used by samba3 and mysql5) against 10.4sdk
   $ sudo ln -s /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/dylib1.o /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/dylib1.10.5.o
   $ sudo ln -s /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.10.5.o


Then install the following port packages (order is very important):

 $ sudo port install pcre +universal
 $ sudo port install expat +universal
 $ sudo port install libiconv +universal
 $ sudo port install gettext +universal
 $ sudo port install libtool yasm cmake gmake pkgconfig

 $ sudo port install lzo +universal
 $ sudo port install lzo2 +universal
 $ sudo port install bzip2 +universal
 $ sudo port install fontconfig +universal
 $ sudo port install boost +universal

 $ sudo port install jpeg +universal
 $ sudo port install tiff +universal
 $ sudo port install libpng +universal
 $ sudo port install libogg +universal
 $ sudo port install libvorbis +universal
 $ sudo port install libmad macosx_deployment_target=10.4
 $ sudo port install fribidi +universal
 $ sudo port install libmms +universal

 $ sudo port install glew +universal
 $ sudo port install libcdio +universal
 $ sudo port install openssl +universal
 $ sudo port install samba3 macosx_deployment_target=10.4
 $ sudo port install mysql5 +universal
 $ sudo port install sqlite3 +universal
 $ sudo port install libsamplerate +universal

 $ sudo port install libsdl +no_x11 +universal
 $ sudo port install smpeg +universal
 $ sudo port install libsdl_mixer +universal
 $ sudo port install libsdl_image +universal

If you understand the following two lines, you can run it to automate
the installation of the ports in the above order:

  sudo bash
  cat README.osx | perl -ne 'print `port install $1` if /^ \$ sudo port install (.*)$/;'

Finally, fix the mysql package default install location with this symlink:

 $ sudo ln -s /opt/local/include/mysql5/mysql/ /opt/local/include/mysql

-----------------------------------------------------------------------------
4. How to compile
-----------------------------------------------------------------------------
Both Xcode and Terminal compilation require that build environment be setup
first. This is a simple step and involves the following:

 $ cd $HOME/XBMC
 $ ./bootstrap
 $ ./configure
 $ make clean
 $ make xcode_depends

The configure operation will setup the build environment for codecs and
internal libraries that are used by XBMC. This step is required for both Xcode
and command-line building. The "make clean" ensures that there areno stale
binaries from svn that might cause problems The last step will pre-build
the majority of the codecs and libs:


The configure operation will default to building "debug". To build "release"
codecs and libraries for Xcode, do the configure step with "--disable-debug"
but remember that Xcode will need to be also built "Release":

 $ ./configure --disable-debug

-----------------------------------------------------------------------------
4.1 Using Xcode
-----------------------------------------------------------------------------
Start XCode and open the XBMC project (XBMC.xcodeproj) located in $HOME/XBMC.
For development, XBMC is run from the $HOME/XBMC directory and needs to have
the XBMC_HOME environment variable set to know where that directory is located.
To set XBMC_HOME environment variable:

Menu -> Project -> Edit Active Executable "XBMC", click "Arguments" tab and
add "XBMC_HOME" as an enviroment variable. Set the value to the path to the
XBMC root folder. For example, "/Users/bigdog/Documents/XBMC"

There are two build targets "XBMC" and "XBMC.app" with debug and release
settings. The "XBMC" target is used for rapid build and debug cycles while
the "XBMC.app" target is used to build a self contained OSX application.

Set the build target to "XBMC" or "XBMC.app", then build. The build process
will take a long time when builting the first time. You can see the progress
in "Build Results". There are a large number of static and dynamic libaries
that will need to be built. Once these are built, subsequent builds will be
faster.

After the build, you can ether run XBMC for Mac from Xcode or run it from
the command-line. If you run it from the command-line, make sure your set
the XBMC_HOME environment variable (export XBMC_HOME=$HOME/XBMC). Then, to
run the debug version:

$ ./build/Debug/XBMC

Or the release version:

$ ./build/Release/XBMC

You can also build via Xcode from the command-line using the following:

$ xcodebuild -configuration Release -target "XBMC.app" -project XBMC.xcodeproj

You can specify "Release" instead of "Debug" as a configuration.

-----------------------------------------------------------------------------
4.2 Using Terminal (command-line) (this is a work in progress and might fail)
-----------------------------------------------------------------------------
There are two methods, a) make/Xcode and b) make (which might fail as it's under
construction).

If you want to build a cross-compiled version that can run under 10.5/10.4/AppleTV, 
then you'll need to follow the additional steps listed in $HOME/XBMC/tools/XBMCTex/README.osx
before running xcodebuild from the command-line.

 a)
 $ cd $HOME/XBMC
 $ export XBMC_HOME=`pwd`
 $ make xcode_depends
 $ xcodebuild -sdk macosx10.4 -project XBMC.xcodeproj -target XBMC.app -configuration Release build

 b)
 $ cd $HOME/XBMC
 $ export XBMC_HOME=`pwd`
 $ make xbmc
 $ ./xbmc.bin

-----------------------------------------------------------------------------
5. Packaging
-----------------------------------------------------------------------------
This section describes how to package XBMC in a disk image for
distribution.

  1. Create 2 directories "extras/user" and "extras/system" in the root of
  the source tree.

    1.1. "extras/user" - anything found in this directory will be
    copied to the user's XBMC directory (~/Library/Application
    Support/XBMC) on first run. Examples:

        extras/user/scripts/XBMC Lyrics
        extras/user/plugins/music/iTunes

    1.2. "extras/system" - anything found in this directory will be
    copied to the XBMC application bundle at build time
    (XBMC.app/Contents/Resources/XBMC/). Examples:

        extras/system/skin/MediaStream
        extras/system/skin/My Skin


  2. After performing step 1, build XBMC.app from XCode so that the
  application bundle is correctly updated.

  3. Go to tools/PackageMaker and run dmgmaker.pl as follows:

      $ cd tools/PackageMaker
      $ ./dmgmaker.pl ../../build/Release/XBMC.app

  4. If dmgmaker.pl completed successfully, a disk image will be
  present in the "dist" subdirectory:

      $ ls dist
      XBMC.dmg

Remember to unmount/eject XBMC.dmg before attempting to recreate it,
otherwise dmgmaker.pl will fail.