Build kodi: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Line 120: Line 120:
  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 "*.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'
  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 fontconfig
Index: fontconfig-2.12.1/fontconfig/fontconfig.h
===================================================================
--- fontconfig-2.12.1.orig/fontconfig/fontconfig.h
+++ fontconfig-2.12.1/fontconfig/fontconfig.h
@@ -128,7 +128,8 @@ typedef int        FcBool;
  #define FC_USER_CACHE_FILE        ".fonts.cache-" FC_CACHE_VERSION
  /* Adjust outline rasterizer */
-#define FC_CHAR_WIDTH      "charwidth" /* Int */
+#define FC_CHARWIDTH      "charwidth" /* Int */
+#define FC_CHAR_WIDTH      FC_CHARWIDTH
  #define FC_CHAR_HEIGHT    "charheight"/* Int */
  #define FC_MATRIX          "matrix"    /* FcMatrix */
Index: fontconfig-2.12.1/src/fcobjs.h
===================================================================
--- fontconfig-2.12.1.orig/src/fcobjs.h
+++ fontconfig-2.12.1/src/fcobjs.h
@@ -51,7 +51,7 @@ FC_OBJECT (DPI,                      FcTypeDouble,  NULL)
  FC_OBJECT (RGBA,              FcTypeInteger,  NULL)
  FC_OBJECT (SCALE,              FcTypeDouble,  NULL)
  FC_OBJECT (MINSPACE,          FcTypeBool,    NULL)
-FC_OBJECT (CHAR_WIDTH,        FcTypeInteger,  NULL)
+FC_OBJECT (CHARWIDTH,          FcTypeInteger,  NULL)
  FC_OBJECT (CHAR_HEIGHT,                FcTypeInteger,  NULL)
  FC_OBJECT (MATRIX,            FcTypeMatrix,  NULL)
  FC_OBJECT (CHARSET,            FcTypeCharSet,  FcCompareCharSet)
Index: fontconfig-2.12.1/src/fcobjshash.gperf
===================================================================
--- fontconfig-2.12.1.orig/src/fcobjshash.gperf
+++ fontconfig-2.12.1/src/fcobjshash.gperf
@@ -44,7 +44,7 @@ int id;
  "rgba",FC_RGBA_OBJECT
  "scale",FC_SCALE_OBJECT
  "minspace",FC_MINSPACE_OBJECT
-"charwidth",FC_CHAR_WIDTH_OBJECT
+"charwidth",FC_CHARWIDTH_OBJECT
  "charheight",FC_CHAR_HEIGHT_OBJECT
  "matrix",FC_MATRIX_OBJECT
===================================================================
--- fontconfig-2.12.1.orig/src/fcobjshash.h
+++ fontconfig-2.12.1/src/fcobjshash.h
@@ -275,7 +275,7 @@
  #line 26 "fcobjshash.gperf"
        {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str40,FC_WIDTH_OBJECT},
  #line 47 "fcobjshash.gperf"
-      {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str41,FC_CHAR_WIDTH_OBJECT},
+      {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str41,FC_CHARWIDTH_OBJECT},
  #line 48 "fcobjshash.gperf"
        {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str42,FC_CHAR_HEIGHT_OBJECT},
  #line 44 "fcobjshash.gperf"


Fix zlib to have -fPIC use in zlib Makefile<br>
Fix zlib to have -fPIC use in zlib Makefile<br>

Revision as of 04:30, 29 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;
 }


Fix $KODI_ROOT=/android-tools/xbmc-depends/x86_64-linux-gnu-native/include/gif_lib.h

--- /tmp/gif_lib.h      2018-12-29 16:30:47.441889499 +1300
+++ /media/iwiseman/Segate/Kypton/android-tools/xbmc-depends/x86_64-linux-gnu-native/include/gif_lib.h  2018-12-29 16:32:05.610388400 +1300
@@ -20,6 +20,7 @@ 

 #include <stddef.h>
 #include <stdbool.h>
+#include <stdlib.h>

 #define GIF_STAMP "GIFVER"          /* First chars in file - GIF stamp.  */
 #define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1
@@ -245,7 +246,7 @@
 extern int GifBitSize(int n);

 extern void *
-reallocarray(void *optr, size_t nmemb, size_t size);
+reallocarray(void *optr, size_t nmemb, size_t size)  __THROW __attribute_warn_unused_result__;

 /******************************************************************************
  Support for the in-core structures allocation (slurp mode).

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 fontconfig

Index: fontconfig-2.12.1/fontconfig/fontconfig.h
===================================================================
--- fontconfig-2.12.1.orig/fontconfig/fontconfig.h
+++ fontconfig-2.12.1/fontconfig/fontconfig.h
@@ -128,7 +128,8 @@ typedef int         FcBool;
 #define FC_USER_CACHE_FILE         ".fonts.cache-" FC_CACHE_VERSION

 /* Adjust outline rasterizer */
-#define FC_CHAR_WIDTH      "charwidth" /* Int */
+#define FC_CHARWIDTH       "charwidth" /* Int */
+#define FC_CHAR_WIDTH      FC_CHARWIDTH
 #define FC_CHAR_HEIGHT     "charheight"/* Int */
 #define FC_MATRIX          "matrix"    /* FcMatrix */ 

Index: fontconfig-2.12.1/src/fcobjs.h
===================================================================
--- fontconfig-2.12.1.orig/src/fcobjs.h
+++ fontconfig-2.12.1/src/fcobjs.h
@@ -51,7 +51,7 @@ FC_OBJECT (DPI,                       FcTypeDouble,   NULL)
 FC_OBJECT (RGBA,               FcTypeInteger,  NULL)
 FC_OBJECT (SCALE,              FcTypeDouble,   NULL)
 FC_OBJECT (MINSPACE,           FcTypeBool,     NULL)
-FC_OBJECT (CHAR_WIDTH,         FcTypeInteger,  NULL)
+FC_OBJECT (CHARWIDTH,          FcTypeInteger,  NULL)
 FC_OBJECT (CHAR_HEIGHT,                FcTypeInteger,  NULL)
 FC_OBJECT (MATRIX,             FcTypeMatrix,   NULL)
 FC_OBJECT (CHARSET,            FcTypeCharSet,  FcCompareCharSet)
Index: fontconfig-2.12.1/src/fcobjshash.gperf
===================================================================
--- fontconfig-2.12.1.orig/src/fcobjshash.gperf
+++ fontconfig-2.12.1/src/fcobjshash.gperf
@@ -44,7 +44,7 @@ int id;
 "rgba",FC_RGBA_OBJECT
 "scale",FC_SCALE_OBJECT
 "minspace",FC_MINSPACE_OBJECT
-"charwidth",FC_CHAR_WIDTH_OBJECT
+"charwidth",FC_CHARWIDTH_OBJECT
 "charheight",FC_CHAR_HEIGHT_OBJECT
 "matrix",FC_MATRIX_OBJECT
===================================================================
--- fontconfig-2.12.1.orig/src/fcobjshash.h
+++ fontconfig-2.12.1/src/fcobjshash.h
@@ -275,7 +275,7 @@
 #line 26 "fcobjshash.gperf"
       {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str40,FC_WIDTH_OBJECT},
 #line 47 "fcobjshash.gperf"
-      {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str41,FC_CHAR_WIDTH_OBJECT},
+      {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str41,FC_CHARWIDTH_OBJECT},
 #line 48 "fcobjshash.gperf"
       {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str42,FC_CHAR_HEIGHT_OBJECT},
 #line 44 "fcobjshash.gperf"

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