1 ![Kodi Logo](resources/banner_slim.png)
4 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 cross-compile Kodi for iOS using **[Kodi's unified depends build system](../tools/depends/README.md)**. Please read it in full before you proceed to familiarize yourself with the build procedure.
7 1. **[Document conventions](#1-document-conventions)**
8 2. **[Prerequisites](#2-prerequisites)**
9 3. **[Get the source code](#3-get-the-source-code)**
10 4. **[Configure and build tools and dependencies](#4-configure-and-build-tools-and-dependencies)**
11 4.1. **[Advanced Configure Options](#41-advanced-configure-options)**
12 5. **[Build binary add-ons](#5-build-binary-add-ons)**
13 5.1. **[Independent Add-on building](#51-independent-add-on-building)**
14 5.2. **[Xcode project building](#52-xcode-project-building)**
15 6. **[Build Kodi](#6-build-kodi)**
16 6.1. **[Generate Project Files](#61-generate-project-files)**
17 6.2. **[Build with Xcode](#62-build)**
18 7. **[Package](#7-package)**
19 8. **[Install](#8-install)**
20 9. **[Gesture Handling](#9-gesture-handling)**
22 ## 1. Document conventions
23 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.
25 This is a comment that provides context:
28 this is another command
32 **Example:** Clone Kodi's current master branch:
34 git clone https://github.com/xbmc/xbmc kodi
37 Commands that contain strings enclosed in angle brackets denote something you need to change to suit your needs.
39 git clone -b <branch-name> https://github.com/xbmc/xbmc kodi
42 **Example:** Clone Kodi's current Krypton branch:
44 git clone -b Krypton https://github.com/xbmc/xbmc kodi
47 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:
49 **NOTE:** Linux is user friendly... It's just very particular about who its friends are.
50 **TIP:** Algorithm is what developers call code they do not want to explain.
51 **WARNING:** Developers don't change light bulbs. It's a hardware problem.
53 **[back to top](#table-of-contents)** | **[back to section top](#1-document-conventions)**
56 * **[Java Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)**
57 * **[Xcode](https://developer.apple.com/xcode/)**. Install it from the AppStore or from the **[Apple Developer Homepage](https://developer.apple.com/)**.
58 * Device with **iOS 11.0 or newer** to install Kodi after build.
60 Building for iOS should work with the following constellations of Xcode and macOS versions:
61 * Xcode 12.4 against iOS SDK 14.4 on 10.15.7 (Catalina)(recommended)(CI)
62 * Xcode 13.x against iOS SDK 15.5 on 12.x (Monterey)(recommended)
64 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.
65 **WARNING:** Start Xcode after installation finishes. You need to accept the licenses and install missing components.
67 **[back to top](#table-of-contents)**
69 ## 3. Get the source code
70 Change to your `home` directory:
75 Clone Kodi's current master branch:
77 git clone https://github.com/xbmc/xbmc kodi
80 **[back to top](#table-of-contents)**
82 ## 4. Configure and build tools and dependencies
83 Kodi can be built as a 64bit program for iOS. The dependencies are built in `$HOME/kodi/tools/depends` and installed into `/Users/Shared/xbmc-depends`.
85 **TIP:** Look for comments starting with `Or ...` and only execute the command(s) you need.
86 **NOTE:** `--with-platform` is mandatory for all Apple platforms
90 cd $HOME/kodi/tools/depends
92 ./configure --host=aarch64-apple-darwin --with-platform=ios
95 Build tools and dependencies:
97 make -j$(getconf _NPROCESSORS_ONLN)
100 **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 adding `export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"` to your shell config (e.g. `~/.bashrc`).
102 **WARNING:** Look for the `Dependencies built successfully.` success message. If in doubt run a single threaded `make` command until the message appears. If the single make fails, clean the specific library by issuing `make -C target/<name_of_failed_lib> distclean` and run `make`again.
104 **NOTE:** **Advanced developers** may want to specify an iOS SDK version (if multiple versions are installed) in the configure line(s) shown above. The example below would use the iOS SDK 11.0:
106 ./configure --host=aarch64-apple-darwin --with-platform=ios --with-sdk=11.0
109 ### 4.1. Advanced Configure Options
115 --with-toolchain=<path>
117 specify path to toolchain. Auto set for android. Defaults to xcode root for darwin, /usr for linux
120 --enable-debug=<yes:no>
122 enable debugging information (default is yes)
130 --with-tarballs=<path>
132 path where tarballs will be saved [prefix/xbmc-tarballs]
137 optional. specify target cpu. guessed if not specified
140 --with-linker=<linker>
142 specify linker to use. (default is ld)
145 --with-platform=<platform>
150 --enable-gplv3=<yes:no>
152 enable gplv3 components. (default is yes)
155 --with-target-cflags=<cflags>
157 C compiler flags (target)
160 --with-target-cxxflags=<cxxflags>
162 C++ compiler flags (target)
165 --with-target-ldflags=<ldflags>
167 linker flags. Use e.g. for -l<lib> (target)
170 --with-ffmpeg-options
172 FFmpeg configure options, e.g. --enable-vaapi (target)
178 --with-sdk=<sdknumber>
180 specify sdk platform version.
183 **[back to top](#table-of-contents)** | **[back to section top](#4-configure-and-build-tools-and-dependencies)**
185 ## 5. Build binary add-ons
187 You can find a complete list of available binary add-ons **[here](https://github.com/xbmc/repo-binary-addons)**.
189 ## 5.1. Independent Add-on building
191 Change to Kodi's source code directory:
198 make -C tools/depends/target/binary-addons
201 Build specific add-ons:
203 make -C tools/depends/target/binary-addons ADDONS="audioencoder.flac pvr.vdr.vnsi audiodecoder.snesapu"
206 Build a specific group of add-ons:
208 make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons ADDONS="pvr.*"
210 For additional information on regular expression usage for ADDONS_TO_BUILD, view ADDONS_TO_BUILD section located here [Kodi add-ons CMake based buildsystem](../cmake/addons/README.md)
212 ## 5.2. Xcode project building
214 Binary addons will be built as a dependency in the Xcode project. You can choose the addons
215 you wish to build during the Xcode project generation step
217 Generate Xcode project to build specific add-ons:
219 make -C tools/depends/target/cmakebuildsys CMAKE_EXTRA_ARGUMENTS="-DENABLE_XCODE_ADDONBUILD=ON -DADDONS_TO_BUILD='audioencoder.flac pvr.vdr.vnsi audiodecoder.snesapu'"
222 Generate Xcode project to build a specific group of add-ons:
224 make -C tools/depends/target/cmakebuildsys CMAKE_EXTRA_ARGUMENTS="-DENABLE_XCODE_ADDONBUILD=ON -DADDONS_TO_BUILD='pvr.*'"
227 For additional information on regular expression usage for ADDONS_TO_BUILD, view ADDONS_TO_BUILD section located at [Kodi add-ons CMake based buildsystem](../cmake/addons/README.md)
229 Generate Xcode project to build all add-ons automatically:
231 make -C tools/depends/target/cmakebuildsys CMAKE_EXTRA_ARGUMENTS="-DENABLE_XCODE_ADDONBUILD=ON"
234 **TIP:** If you wish to not automatically build addons added to your xcode project, omit
235 `-DENABLE_XCODE_ADDONBUILD=ON`. The target will be added to the project, but the dependency
236 will not be set to automatically build
237 **TIP:** Binary add-ons added to the generated Xcode project can be built independently of
238 the Kodi app by selecting the scheme/target `binary-addons` in the Xcode project.
239 You can also build the binary-addons target via xcodebuild. This will not build the Kodi
240 App, but will build any/all binary addons added for the project Generation.
242 xcodebuild -config "Debug" -target binary-addons
245 **[back to top](#table-of-contents)**
249 ## 6.1. Generate Project Files
251 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.
253 Create an out-of-source build directory:
255 mkdir $HOME/kodi-build
257 Generate Xcode project as per configure command in **[Configure and build tools and dependencies](#4-configure-and-build-tools-and-dependencies)**:
259 make -C tools/depends/target/cmakebuildsys BUILD_DIR=$HOME/kodi-build
262 **TIP:** BUILD_DIR can be omitted, and project will be created in $HOME/kodi/build
263 Change all relevant paths onwards if omitted.
265 Additional cmake arguments can be supplied via the CMAKE_EXTRA_ARGUMENTS command line variable
269 Generate Xcode project for ARM 64bit (**recommended**):
272 /Users/Shared/xbmc-depends/x86_64-darwin17.5.0-native/bin/cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=/Users/Shared/xbmc-depends/iphoneos11.3_arm64-target-debug/share/Toolchain.cmake $HOME/kodi
275 **WARNING:** The toolchain file location differs depending on your iOS and SDK version. You have to replace `x86_64-darwin15.6.0-native` and `iphoneos11.3_arm64-target-debug` in the paths above with the correct ones on your system.
277 You can check `Users/Shared/xbmc-depends` directory content with:
279 ls -l /Users/Shared/xbmc-depends
283 **Start Xcode, open the Kodi project file** (`kodi.xcodeproj`) located in `$HOME/kodi-build` and hit `Build`.
285 **WARNING:** If you have selected a specific iOS SDK Version in step 4 then you might need to adapt the active target to use the same iOS SDK version, otherwise build will fail. Be sure to select a device configuration. Building for simulator is not supported.
287 **Alternatively**, you can also build via Xcode from the command-line with `xcodebuild`:
292 xcodebuild -config "Debug" -jobs $(getconf _NPROCESSORS_ONLN)
295 **TIP:** You can specify Release instead of Debug as -config parameter.
297 **[back to top](#table-of-contents)** | **[back to section top](#6-build-kodi)**
300 CMake generates a target called `deb` 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
304 xcodebuild -target deb
311 /Users/Shared/xbmc-depends/x86_64-darwin17.5.0-native/bin/cmake --build . --target "deb" --config "Debug"
314 **[back to top](#table-of-contents)**
317 On jailbroken devices the resulting deb file can be copied to the iOS device via *ssh/scp* and installed manually. You need to SSH into the iOS device and issue:
319 dpkg -i <name of the deb file>
322 If you are a developer with an official Apple code signing identity you can deploy Kodi via Xcode to work on it on non-jailbroken devices. For this to work you need to alter the Xcode project by setting your codesign identity. Just select the *iPhone Developer* shortcut.
323 It's also important that you select the signing on all 4 spots in the project settings. After the last buildstep, our support script will do a full sign of all binaries and bundle them with the given identity, including all the `*.viz`, `*.pvr`, `*.so`, etc. files Xcode doesn't know anything about. This should allow you to deploy Kodi to all non-jailbroken devices the same way you deploy normal apps to.
324 In that case Kodi will be sandboxed like any other app. All Kodi files are then located in the sandboxed *Documents* folder and can be easily accessed via iTunes file sharing.
326 From Xcode7 on this approach is also available for non paying app developers (Apple allows self signing from now on).
328 **[back to top](#table-of-contents)**
330 ## 9. Gesture Handling
333 | ---------------------------------------- | -------------------------- |
334 | Double finger swipe left | Back |
335 | Double finger tap/single finger long tap | Right mouse |
336 | Single finger tap | Left mouse |
337 | Panning, and flicking | For navigating in lists |
338 | Dragging | For scrollbars and sliders |
339 | Zoom gesture | In the picture viewer |
341 Gestures can be adapted in **[system/keymaps/touchscreen.xml](https://github.com/xbmc/xbmc/blob/master/system/keymaps/touchscreen.xml)**.
343 **[back to top](#table-of-contents)**