Build kodi: Difference between revisions
Line 107: | Line 107: | ||
override CFLAGS += -fPIC | override CFLAGS += -fPIC | ||
<br> | <br> | ||
Fix libffi | |||
--- Makefile 2018-12-28 18:03:35.002973500 +1300 | |||
+++ /media/iwiseman/Segate/Android/kodi/tools/depends/target/libffi/Makefile 2018-12-27 15:24:37.029710200 +1300 | |||
@@ -1,5 +1,5 @@ | |||
include ../../Makefile.include | |||
-DEPS= ../../Makefile.include Makefile | |||
+DEPS= ../../Makefile.include Makefile armAssembler.patch | |||
# lib name, version | |||
LIBNAME=libffi | |||
@@ -8,12 +8,7 @@ | |||
ARCHIVE=$(SOURCE).tar.gz | |||
# configuration settings | |||
-CONFIGURE= ./configure --prefix=$(PREFIX) --disable-shared --disable-builddir | |||
-ifeq ($(OS), ios) | |||
-ifneq ($(CPU), arm64) | |||
-CONFIGURE+=CCASFLAGS=-no-integrated-as | |||
-endif | |||
-endif | |||
+CONFIGURE= ./configure --prefix=$(PREFIX) --disable-shared --disable-builddir | |||
LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a | |||
@@ -26,6 +21,7 @@ | |||
$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) | |||
rm -rf $(PLATFORM); mkdir -p $(PLATFORM) | |||
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) | |||
+ cd $(PLATFORM); patch -p1 -i ../armAssembler.patch | |||
cd $(PLATFORM); $(CONFIGURE) | |||
$(LIBDYLIB): $(PLATFORM) | |||
Build tools and dependencies<br> | Build tools and dependencies<br> | ||
make -j$(getconf _NPROCESSORS_ONLN) | make -j$(getconf _NPROCESSORS_ONLN) |
Revision as of 06:28, 28 December 2018
Building Kodi on Linux
Set root directory
export KODI_ROOT=$HOME/dev
Make sure git is installed
sudo apt install git
Change to your home directory
cd $KODI_ROOT
Clone Kodi's current master branch
git clone https://github.com/xbmc/xbmc kodi
Add Kodi's nightly PPA to grab dependencies
sudo add-apt-repository -s ppa:team-xbmc/xbmc-nightly
Super-duper magic command to get the build dependencies
sudo apt build-dep kodi
You can install ccache (optional)
sudo apt install ccache
Create an out-of-source build directory
mkdir $KODI_ROOT/kodi-build
Change to build directory
cd $KODI_ROOT/kodi-build
Configure build for X11
cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local
Build Kodi
cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN)
Build all add-ons
cd $/KODI_ROOTkodi sudo make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons PREFIX=/usr/local
Building Kodi on Android
Get SDK and NDK
[NDK]
[SDK]
Set root directory
export KODI_ROOT=$HOME/dev
Unzip software
mkdir -p $KODI_ROOT/android-tools/android-sdk-linux unzip $KODI_ROOT/Downloads/sdk-tools-linux-4333796.zip -d $KODI_ROOT/android-tools/android-sdk-linux unzip $KODI_ROOT/Downloads/android-ndk-r18b-linux-x86_64.zip -d $KODI_ROOT/android-tools
Accept Licenses
cd $KODI_ROOT/android-tools/android-sdk-linux/tools/bin ./sdkmanager --licenses ./sdkmanager platform-tools ./sdkmanager "platforms;android-26" ./sdkmanager "build-tools;25.0.3"
Change to Android NDK tools directory
cd $KODI_ROOT/android-tools/android-ndk-r18b/build/tools
Set up toolchain
./make-standalone-toolchain.sh --install-dir=$KODI_ROOT/android-tools/arm-linux-androideabi-vanilla/android-21 --platform=android-21 --toolchain=arm-linux-androideabi
Create a key to sign
keytool -genkey -keystore ~/.android/debug.keystore -v -alias androiddebugkey -dname "CN=Android Debug,O=Android,C=US" -keypass android -storepass android -keyalg RSA -keysize 2048 -validity 10000
Clone Kodi's current master branch
cd $KODI_ROOT git clone https://github.com/xbmc/xbmc kodi
Prepare to configure build
cd $KODI_ROOT/kodi/tools/depends ./bootstrap
Configure build for arm Kodi 17
./configure --with-tarballs=$KODI_ROOT/android-tools/xbmc-tarballs --with-ndk-api=24 --host=arm-linux-androideabi --with-sdk=android-26 --with-sdk-path=$KODI_ROOT/android-tools/android-sdk-linux --with-ndk=$KODI_ROOT/android-tools/android-ndk-r18b --with-toolchain=$KODI_ROOT/android-tools/arm-linux-androideabi-vanilla/android-24 --prefix=$KODI_ROOT/android-tools/xbmc-depends
Configure build for arm Kodi 18
./configure --with-tarballs=$KODI_ROOT/android-tools/xbmc-tarballs --with-ndk-api=24 --host=arm-linux-androideabi --with-sdk-path=$KODI_ROOT/android-tools/android-sdk-linux --with-ndk-path=$KODI_ROOT/android-tools/android-ndk-r18b --with-toolchain=$KODI_ROOT/android-tools/arm-linux-androideabi-vanilla/android-24 --prefix=$KODI_ROOT/android-tools/xbmc-depends
Patch for Kodi 17 only
$KODI_ROOT/kodi/tools/depends/native/automake-native/x86_64-linux-native$ vi bin/automake.in
--- automake.in 2015-01-06 03:25:55.000000000 +0800 +++ automake.in.patched 2017-07-26 13:58:07.086205701 +0800 @@ -3878,7 +3878,7 @@ sub substitute_ac_subst_variables { my ($text) = @_; - $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge; + $text =~ s/\$\{([^ \t=:+{}]+)\}/substitute_ac_subst_variables_worker ($1)/ge; return $text; }
Change $KODI_ROOT=/android-tools/xbmc-depends/x86_64-linux-gnu-native/include/gif_lib.h to include <stdlib.h> and change
reallocarray(void *optr, size_t nmemb, size_t size) To reallocarray(void *optr, size_t nmemb, size_t size) __THROW __attribute_warn_unused_result__;
Fix up Google Breakpad
find $KODI_ROOT/kodi/tools/depends/native/google-breakpad-native/x86_64-linux-native -type f -name "*.cc" -print0 | xargs -0 sed -i 's/struct ucontext/ucontext_t/g' find $KODI_ROOT/kodi/tools/depends/native/google-breakpad-native/x86_64-linux-native -type f -name "*.h" -print0 | xargs -0 sed -i 's/struct ucontext/ucontext_t/g' find $KODI_ROOT/kodi/tools/depends/native/google-breakpad-native/x86_64-linux-native -type f -name "*.cc" -print0 | xargs -0 sed -i 's/const ucontext /const ucontext_t /g' find $KODI_ROOT/kodi/tools/depends/native/google-breakpad-native/x86_64-linux-native -type f -name "*.h" -print0 | xargs -0 sed -i 's/const ucontext /const ucontext_t /g'
Fix zlib to have -fPIC use in zlib Makefile
override CFLAGS += -fPIC
Fix libffi
--- Makefile 2018-12-28 18:03:35.002973500 +1300 +++ /media/iwiseman/Segate/Android/kodi/tools/depends/target/libffi/Makefile 2018-12-27 15:24:37.029710200 +1300 @@ -1,5 +1,5 @@ include ../../Makefile.include -DEPS= ../../Makefile.include Makefile +DEPS= ../../Makefile.include Makefile armAssembler.patch
# lib name, version LIBNAME=libffi @@ -8,12 +8,7 @@ ARCHIVE=$(SOURCE).tar.gz # configuration settings -CONFIGURE= ./configure --prefix=$(PREFIX) --disable-shared --disable-builddir -ifeq ($(OS), ios) -ifneq ($(CPU), arm64) -CONFIGURE+=CCASFLAGS=-no-integrated-as -endif -endif +CONFIGURE= ./configure --prefix=$(PREFIX) --disable-shared --disable-builddir
LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a @@ -26,6 +21,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) rm -rf $(PLATFORM); mkdir -p $(PLATFORM) cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + cd $(PLATFORM); patch -p1 -i ../armAssembler.patch cd $(PLATFORM); $(CONFIGURE) $(LIBDYLIB): $(PLATFORM)
Build tools and dependencies
make -j$(getconf _NPROCESSORS_ONLN)
Build all add-ons
cd $KODI_ROOT/kodi
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons
Build Kodi
Configure CMake build:
cd $KODI_ROOT/kodi make -C tools/depends/target/cmakebuildsys
Build Kodi
cd $KODI_ROOT/kodi/build make -j$(getconf _NPROCESSORS_ONLN)
Create package
make apk
Building Amended PVR IPTV Simple Plugin Linux
cd $KODI_ROOT git clone https://github.com/bibble235/pvr.iptvsimple cd pvr.iptvsimple && mkdir build && cd build cmake -DADDONS_TO_BUILD=pvr.iptvsimple -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons make
Building Amended PVR IPTV Simple Plugin Android
cd $KODI_ROOT git clone https://github.com/bibble235/pvr.iptvsimple cd pvr.iptvsimple && mkdir build && cd build cmake -DADDONS_TO_BUILD=pvr.iptvsimple -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../kodi/addons -DPACKAGE_ZIP=1 \ -DCMAKE_TOOLCHAIN_FILE=$KODI_ROOT/Android/kodi/tools/depends/target/binary-addons/arm-linux-androideabi-21-debug/build/depends/share/Toolchain_binaddons.cmake \ ../../kodi/cmake/addons make