kodi
|
This guide has been tested using Xcode 11.3.1 running on MacOS 10.14.4 (Mojave). Please note this combination is the only version our CI system builds. The minimum OS requirement for this version of Xcode is MacOS 10.14.4. Other combinations may work but we provide no assurances that other combinations will build correctly and run identically to Team Kodi releases. It is meant to build Kodi for macOS using ../tools/depends/README.md "Kodi's unified depends build system". Please read it in full before you proceed to familiarize yourself with the build procedure.
This guide assumes you are using terminal
, also known as console
, command-line
or simply cli
. Commands need to be run at the terminal, one at a time and in the provided order.
This is a comment that provides context:
Example: Clone Kodi's current master branch:
Commands that contain strings enclosed in angle brackets denote something you need to change to suit your needs.
Example: Clone Kodi's current Krypton branch:
Several different strategies are used to draw your attention to certain pieces of information. In order of how critical the information is, these items are marked as a note, tip, or warning. For example:
[!NOTE] Linux is user friendly... It's just very particular about who its friends are.
[!TIP] Algorithm is what developers call code they do not want to explain.
[!WARNING] Developers don't change light bulbs. It's a hardware problem.
back to top | back to section top
Building for OSX/macOS should work with the following constellations of Xcode and OSX/macOS versions:
Team Kodi CI infrastructure is limited, and therefore we only have the single combination tested. Newer xcode/macos combinations generally should work, however the team does not actively test/use pre-release versions, so use with caution. Earlier versions may work, however we dont actively support them, so use with caution.
[!WARNING] Start Xcode after installation finishes. You need to accept the licenses and install missing components.
Change to your home
directory:
Clone Kodi's current master branch:
Kodi can be built as either a 32bit or 64bit program. The dependencies are built in $HOME/kodi/tools/depends
and installed into /Users/Shared/xbmc-depends
.
[!TIP] Look for comments starting with
Or ...
and only execute the command(s) you need.
[!NOTE]
--with-platform
is mandatory for all Apple platforms
Configure build (x86 intel):
Configure build (apple silicon):
Build tools and dependencies:
[!TIP] By adding
-j<number>
to the make command, you can choose how many concurrent jobs will be used and expedite the build process. It is recommended to use-j$(getconf _NPROCESSORS_ONLN)
to compile on all available processor cores. The build machine can also be configured to do this automatically by addingexport MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
to your shell config (e.g.~/.bashrc
).
[!WARNING] Look for the
Dependencies built successfully.
success message. If in doubt run a single threadedmake
command until the message appears. If the single make fails, clean the specific library by issuingmake -C target/<name_of_failed_lib> distclean
and runmake
again.
[!NOTE] Advanced developers may want to specify an SDK version (if multiple versions are installed) in the configure line(s) shown above. The example below would use SDK 10.14:
All platforms:
specify path to toolchain. Auto set for android. Defaults to xcode root for darwin, /usr for linux
enable debugging information (default is yes)
disable ccache
path where tarballs will be saved [prefix/xbmc-tarballs]
optional. specify target cpu. guessed if not specified
specify linker to use. (default is ld)
target platform
enable gplv3 components. (default is yes)
C compiler flags (target)
C++ compiler flags (target)
linker flags. Use e.g. for -l<lib> (target)
FFmpeg configure options, e.g. –enable-vaapi (target)
Apple Specific:
specify sdk platform version.
back to top | back to section top
You can find a complete list of available binary add-ons here.
Change to Kodi's source code directory:
There are multiple possibilities to choose which addons are built. The following 3 examples will give an idea.
(1) Build all add-ons:
OR
(2) Build specific add-ons:
OR
(3) Build a specific group of add-ons:
For additional information on regular expression usage for ADDONS_TO_BUILD, view ADDONS_TO_BUILD section located at ../cmake/addons/README.md "Kodi add-ons CMake based buildsystem"
Before you can use Xcode to build Kodi, the Xcode project has to be generated with CMake. CMake is built as part of the dependencies and doesn't have to be installed separately. A toolchain file is also generated and is used to configure CMake.
Create an out-of-source build directory:
Generate Xcode project as per configure command in Configure and build tools and dependencies:
[!TIP] BUILD_DIR can be omitted, and project will be created in $HOME/kodi/build
Change all relevant paths onwards if omitted.
Additional cmake arguments can be supplied via the CMAKE_EXTRA_ARGUMENTS command line variable
Alternatively
Change to build directory:
Generate Xcode project (x86_64 intel):
[!WARNING] The toolchain file location differs depending on SDK version. You have to replace
x86_64-darwin17.5.0-native
andmacosx10.14_x86_64-target-debug
in the paths above with the correct ones on your system.
You can check Users/Shared/xbmc-depends
directory content with:
Start Xcode, open the Kodi project file (kodi.xcodeproj
) located in $HOME/kodi-build
and hit Build
.
[!WARNING] If you have selected a specific SDK version in step 4 then you might need to adapt the active target to use the same SDK version, otherwise build will fail. Be sure to select a device configuration. Building for simulator is not supported.
Alternatively, you can also build via Xcode from the command-line with xcodebuild
, triggered by CMake:
Build Kodi:
[!TIP] You can specify Release instead of Debug as -config parameter.
Alternatively
Build Kodi:
[!TIP] You can specify
Release
instead ofDebug
as--config
parameter.
CMake is also able to generate makefiles that can be used to build with make.
Change to Kodi's source code directory:
Generate makefiles:
[!TIP] BUILD_DIR can be provided as an argument to cmakebuildsys. This allows you to provide an alternate build location. Change all paths onwards as required if BUILD_DIR option used.
Build Kodi:
back to top | back to section top
After build finishes, you can run Kodi from Xcode or from terminal.
Run Debug
config from terminal:
Run Release
config from terminal:
After build finishes, you can run Kodi from terminal:
CMake generates a target called dmg
which will package Kodi ready for distribution. After Kodi has been built, the target can be triggered by selecting it in Xcode active scheme or manually running
``` cd $HOME/kodi-build xcodebuild -target dmg ```` OR
Generated dmg
file will be inside $HOME/kodi-build/tools/darwin/packaging/osx/
.
Alternatively, if you built using make:
Generated dmg
file will be inside $HOME/kodi-build/tools/darwin/packaging/osx/
.
Kodi can be installed like any other app.