1 ![Kodi Logo](resources/banner_slim.png)
4 This guide has been tested with FreeBSD 14.1 x86_64. Please read it in full before you proceed to familiarize yourself with the build procedure.
6 Several other distributions have **[specific build guides](README.md)** and a general **[Linux build guide](README.Linux.md)** is also available.
9 1. **[Document conventions](#1-document-conventions)**
10 2. **[Get the source code](#2-get-the-source-code)**
11 3. **[Install the required packages](#3-install-the-required-packages)**
12 3.1. **[Build missing dependencies](#31-build-missing-dependencies)**
13 4. **[Build Kodi](#4-build-kodi)**
14 4.1. **[Configure build](#41-configure-build)**
15 4.2. **[Build](#42-build)**
16 5. **[Build binary add-ons](#5-build-binary-add-ons)**
17 6. **[Run Kodi](#6-run-kodi)**
18 7. **[Uninstall Kodi](#7-uninstall-kodi)**
19 8. **[Test suite](#8-test-suite)**
21 ## 1. Document conventions
22 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.
24 This is a comment that provides context:
27 this is another command
31 **Example:** Clone Kodi's current master branch:
33 git clone https://github.com/xbmc/xbmc kodi
36 Commands that contain strings enclosed in angle brackets denote something you need to change to suit your needs.
38 git clone -b <branch-name> https://github.com/xbmc/xbmc kodi
41 **Example:** Clone Kodi's current Omega branch:
43 git clone -b Omega https://github.com/xbmc/xbmc kodi
46 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 > Linux is user friendly... It's just very particular about who its friends are.
52 > Algorithm is what developers call code they do not want to explain.
55 > Developers don't change light bulbs. It's a hardware problem.
57 **[back to top](#table-of-contents)** | **[back to section top](#1-document-conventions)**
59 ## 2. Get the source code
60 Make sure `git` is installed:
65 Change to your `home` directory:
70 Clone Kodi's current master branch:
72 git clone https://github.com/xbmc/xbmc kodi
75 **[back to top](#table-of-contents)**
77 ## 3. Install the required packages
78 If you get a `package not found` type of message with the below command, remove the offending package(s) from the install list and reissue the command. Take a note of the missing dependencies and, after a successful step completion, **[build the missing dependencies manually](#31-build-missing-dependencies)**.
81 > Kodi requires a compiler with C++17 support, i.e. gcc >= 7 or clang >= 5
83 Install build dependencies:
85 sudo pkg install autoconf automake avahi-app binutils cmake curl dbus doxygen e2fsprogs-libuuid enca encodings evdev-proto exiv2 ffmpeg flac flatbuffers font-util fontconfig freetype2 fribidi fstrcmp gawk gettext-tools giflib git glew gmake gmp gnutls googletest gperf gstreamer1-vaapi jpeg-turbo libaacs libass libbdplus libbluray libcapn libcdio libcec libdisplay-info libedit libfmt libgcrypt libgpg-error libidn libinotify libinput libmicrohttpd libnfs libogg libplist librtmp libtool libudev-devd libva libvdpau libvorbis libxkbcommon libxslt lirc lzo2 m4 mariadb-connector-c-3.3.8_1 mesa-libs nasm openjdk21 p8-platform pcre2 pkgconf python3 rapidjson shairplay sndio spdlog sqlite3 swig taglib tiff tinyxml tinyxml2 wayland-protocols waylandpp xf86-input-keyboard xf86-input-mouse xorg-server xrandr zip
89 > Make sure you copy paste the entire line or you might receive an error or miss a few dependencies.
92 > For developers and anyone else who builds frequently it is recommended to install `ccache` to expedite subsequent builds of Kodi.
94 You can install it with:
96 sudo pkg install ccache
100 > If you have multiple computers at home, `distcc` will distribute build workloads of C and C++ code across several machines on a network. Team Kodi may not be willing to give support if problems arise using such a build configuration.
102 You can install it with:
104 sudo pkg install distcc
107 ### 3.1. Build missing dependencies
108 See the general **[Linux build guide](README.Linux.md)** for reference.
110 **[back to top](#table-of-contents)** | **[back to section top](#3-install-the-required-packages)**
113 ### 4.1. Configure build
114 If you get a `Could NOT find...` error message during CMake configuration step, take a note of the missing dependencies and either install them from repositories (if available) or **[build the missing dependencies manually](#31-build-missing-dependencies)**.
116 Create an out-of-source build directory:
118 mkdir $HOME/kodi-build
121 Change to build directory:
128 cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DAPP_RENDER_SYSTEM="gl"
131 > You can use `gles` instead of `gl` if you want to build with `GLES`.
135 cmake --build . -- VERBOSE=1 -j$(sysctl hw.ncpu | awk '{print $2}')
138 > 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$(sysctl hw.ncpu | awk '{print $2}')` to compile on all available processor cores.
140 After the build process completes successfully you can test your shiny new Kodi build while in the build directory:
145 If everything was OK during your test you can now install the binaries to their place, in this example */usr/local*.
151 > `gmake` stands for *GNU Make*. BSD's own make does not work here.
153 This will install Kodi in the prefix provided in **[section 4.1](#41-configure-build)**.
156 > To override Kodi's install location, use `DESTDIR=<path>`. For example:
159 sudo gmake install DESTDIR=$HOME/kodi
162 **[back to top](#table-of-contents)** | **[back to section top](#4-build-kodi)**
164 ## 5. Build binary add-ons
165 You can find a complete list of available binary add-ons **[here](https://github.com/xbmc/repo-binary-addons)**.
167 Change to Kodi's source code directory:
174 sudo gmake -j$(sysctl hw.ncpu | awk '{print $2}') -C tools/depends/target/binary-addons PREFIX=/usr/local
177 Build specific add-ons:
179 sudo gmake -j$(sysctl hw.ncpu | awk '{print $2}') -C tools/depends/target/binary-addons PREFIX=/usr/local ADDONS="audioencoder.flac pvr.vdr.vnsi audiodecoder.snesapu"
182 Build a specific group of add-ons:
184 sudo gmake -j$(sysctl hw.ncpu | awk '{print $2}') -C tools/depends/target/binary-addons PREFIX=/usr/local ADDONS="pvr.*"
187 Clean-up binary add-ons:
189 sudo gmake -C tools/depends/target/binary-addons clean
192 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)
195 > `PREFIX=/usr/local` should match Kodi's `-DCMAKE_INSTALL_PREFIX=` prefix used in **[section 4.1](#41-configure-build)**.
197 **[back to top](#table-of-contents)**
200 If you chose to install Kodi using `/usr` or `/usr/local` as the `-DCMAKE_INSTALL_PREFIX=`, you can just issue *kodi* in a terminal session.
202 If you changed `-DCMAKE_INSTALL_PREFIX=` to install Kodi into some non-standard location, you will have to run Kodi directly:
204 <CMAKE_INSTALL_PREFIX>/bin/kodi
207 To run Kodi in *portable* mode (useful for testing):
209 <CMAKE_INSTALL_PREFIX>/bin/kodi -p
212 **[back to top](#table-of-contents)**
219 > If you reran CMakes' configure step with a different `-DCMAKE_INSTALL_PREFIX=`, you will need to rerun configure with the correct path for this step to work correctly.
221 If you would like to also remove any settings and third-party addons (skins, scripts, etc.) and Kodi configuration files, you should also run:
226 **[back to top](#table-of-contents)**
229 Kodi has a test suite which uses the Google C++ Testing Framework. This framework is provided directly in Kodi's source tree.
231 Build and run Kodi's test suite:
236 Build Kodi's test suite without running it:
241 Run Kodi's test suite manually:
246 Show Kodi's test suite *help* notes:
248 ./kodi-test --gtest_help
254 List the names of all tests instead of running them.
255 The name of TEST(Foo, Bar) is "Foo.Bar".
257 --gtest_filter=POSITIVE_PATTERNS[-NEGATIVE_PATTERNS]
258 Run only the tests whose name matches one of the positive patterns but
259 none of the negative patterns. '?' matches any single character; '*'
260 matches any substring; ':' separates two patterns.
263 **[back to top](#table-of-contents)**