mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-30 23:34:12 +03:00
kodi: fix cross compilation
- provide native binaries - set cpu / os / etc. flags - fix wayland compilation
This commit is contained in:
parent
97309f7fa2
commit
dcb8c6fa8b
@ -4,22 +4,20 @@
|
|||||||
, boost, avahi, lame, autoreconfHook
|
, boost, avahi, lame, autoreconfHook
|
||||||
, gettext, pcre-cpp, yajl, fribidi, which
|
, gettext, pcre-cpp, yajl, fribidi, which
|
||||||
, openssl, gperf, tinyxml2, taglib, libssh, swig, jre
|
, openssl, gperf, tinyxml2, taglib, libssh, swig, jre
|
||||||
, libX11, xorgproto, libxml2
|
, libxml2, systemd
|
||||||
, libXt, libXmu, libXext
|
|
||||||
, libXinerama, libXrandr
|
|
||||||
, libXtst, libXfixes, systemd
|
|
||||||
, alsaLib, libGLU, libGL, glew, fontconfig, freetype, ftgl
|
, alsaLib, libGLU, libGL, glew, fontconfig, freetype, ftgl
|
||||||
, libjpeg, libpng, libtiff
|
, libjpeg, libpng, libtiff
|
||||||
, libmpeg2, libsamplerate, libmad
|
, libmpeg2, libsamplerate, libmad
|
||||||
, libogg, libvorbis, flac, libxslt
|
, libogg, libvorbis, flac, libxslt
|
||||||
, lzo, libcdio, libmodplug, libass, libbluray
|
, lzo, libcdio, libmodplug, libass, libbluray
|
||||||
, sqlite, libmysqlclient, nasm, gnutls, libva, libdrm
|
, sqlite, libmysqlclient, nasm, gnutls, libva, libdrm
|
||||||
, curl, bzip2, zip, unzip, glxinfo, xdpyinfo
|
, curl, bzip2, zip, unzip, glxinfo
|
||||||
, libcec, libcec_platform, dcadec, libuuid
|
, libcec, libcec_platform, dcadec, libuuid
|
||||||
, libcrossguid, libmicrohttpd
|
, libcrossguid, libmicrohttpd
|
||||||
, bluez, doxygen, giflib, glib, harfbuzz, lcms2, libidn, libpthreadstubs, libtasn1, libXdmcp
|
, bluez, doxygen, giflib, glib, harfbuzz, lcms2, libidn, libpthreadstubs, libtasn1
|
||||||
, libplist, p11-kit, zlib, flatbuffers, fmt, fstrcmp, rapidjson
|
, libplist, p11-kit, zlib, flatbuffers, fmt, fstrcmp, rapidjson
|
||||||
, lirc
|
, lirc
|
||||||
|
, x11Support ? true, libX11, xorgproto, libXt, libXmu, libXext, libXinerama, libXrandr, libXtst, libXfixes, xdpyinfo, libXdmcp
|
||||||
, dbusSupport ? true, dbus ? null
|
, dbusSupport ? true, dbus ? null
|
||||||
, joystickSupport ? true, cwiid ? null
|
, joystickSupport ? true, cwiid ? null
|
||||||
, nfsSupport ? true, libnfs ? null
|
, nfsSupport ? true, libnfs ? null
|
||||||
@ -32,6 +30,7 @@
|
|||||||
, useWayland ? false, wayland ? null, wayland-protocols ? null
|
, useWayland ? false, wayland ? null, wayland-protocols ? null
|
||||||
, waylandpp ? null, libxkbcommon ? null
|
, waylandpp ? null, libxkbcommon ? null
|
||||||
, useGbm ? false, mesa ? null, libinput ? null
|
, useGbm ? false, mesa ? null, libinput ? null
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert dbusSupport -> dbus != null;
|
assert dbusSupport -> dbus != null;
|
||||||
@ -94,10 +93,18 @@ let
|
|||||||
sha256 = "1krsjlr949iy5l6ljxancza1yi6w1annxc5s6k283i9mb15qy8cy";
|
sha256 = "1krsjlr949iy5l6ljxancza1yi6w1annxc5s6k283i9mb15qy8cy";
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
cp ${kodi_src}/tools/depends/target/ffmpeg/{CMakeLists.txt,*.cmake} .
|
cp ${kodi_src}/tools/depends/target/ffmpeg/{CMakeLists.txt,*.cmake} .
|
||||||
|
sed -i 's/ --cpu=''${CPU}//' CMakeLists.txt
|
||||||
|
sed -i 's/--strip=''${CMAKE_STRIP}/--strip=''${CMAKE_STRIP} --ranlib=''${CMAKE_RANLIB}/' CMakeLists.txt
|
||||||
'';
|
'';
|
||||||
buildInputs = [ gnutls libidn libtasn1 p11-kit zlib libva ]
|
cmakeFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||||
|
"-DCROSSCOMPILING=ON"
|
||||||
|
"-DCPU=${stdenv.hostPlatform.parsed.cpu.name}"
|
||||||
|
"-DOS=${stdenv.hostPlatform.parsed.kernel.name}"
|
||||||
|
"-DPKG_CONFIG_EXECUTABLE=pkgconfig"
|
||||||
|
];
|
||||||
|
buildInputs = [ libidn libtasn1 p11-kit zlib libva ]
|
||||||
++ lib.optional vdpauSupport libvdpau;
|
++ lib.optional vdpauSupport libvdpau;
|
||||||
nativeBuildInputs = [ cmake nasm pkgconfig ];
|
nativeBuildInputs = [ cmake nasm pkgconfig gnutls ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# We can build these externally but FindLibDvd.cmake forces us to build it
|
# We can build these externally but FindLibDvd.cmake forces us to build it
|
||||||
@ -152,29 +159,31 @@ in stdenv.mkDerivation {
|
|||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
gnutls libidn libtasn1 nasm p11-kit
|
gnutls libidn libtasn1 nasm p11-kit
|
||||||
libxml2 yasm python2Packages.python
|
libxml2 python2Packages.python
|
||||||
boost libmicrohttpd
|
boost libmicrohttpd
|
||||||
gettext pcre-cpp yajl fribidi libva libdrm
|
gettext pcre-cpp yajl fribidi libva libdrm
|
||||||
openssl gperf tinyxml2 taglib libssh swig jre
|
openssl gperf tinyxml2 taglib libssh
|
||||||
libX11 xorgproto libXt libXmu libXext
|
alsaLib libGL libGLU fontconfig freetype ftgl
|
||||||
libXinerama libXrandr libXtst libXfixes
|
|
||||||
alsaLib libGL libGLU glew fontconfig freetype ftgl
|
|
||||||
libjpeg libpng libtiff
|
libjpeg libpng libtiff
|
||||||
libmpeg2 libsamplerate libmad
|
libmpeg2 libsamplerate libmad
|
||||||
libogg libvorbis flac libxslt systemd
|
libogg libvorbis flac libxslt systemd
|
||||||
lzo libcdio libmodplug libass libbluray
|
lzo libcdio libmodplug libass libbluray
|
||||||
sqlite libmysqlclient avahi lame
|
sqlite libmysqlclient avahi lame
|
||||||
curl bzip2 zip unzip glxinfo xdpyinfo
|
curl bzip2 zip unzip glxinfo
|
||||||
libcec libcec_platform dcadec libuuid
|
libcec libcec_platform dcadec libuuid
|
||||||
libgcrypt libgpgerror libunistring
|
libgcrypt libgpgerror libunistring
|
||||||
libcrossguid cwiid libplist
|
libcrossguid libplist
|
||||||
bluez giflib glib harfbuzz lcms2 libpthreadstubs libXdmcp
|
bluez giflib glib harfbuzz lcms2 libpthreadstubs
|
||||||
ffmpeg flatbuffers fmt fstrcmp rapidjson
|
ffmpeg flatbuffers fmt fstrcmp rapidjson
|
||||||
lirc
|
lirc
|
||||||
# libdvdcss libdvdnav libdvdread
|
# libdvdcss libdvdnav libdvdread
|
||||||
]
|
]
|
||||||
|
++ lib.optional x11Support [
|
||||||
|
libX11 xorgproto libXt libXmu libXext libXdmcp
|
||||||
|
libXinerama libXrandr libXtst libXfixes
|
||||||
|
]
|
||||||
++ lib.optional dbusSupport dbus
|
++ lib.optional dbusSupport dbus
|
||||||
++ lib.optionals joystickSupport [ cwiid ]
|
++ lib.optional joystickSupport cwiid
|
||||||
++ lib.optional nfsSupport libnfs
|
++ lib.optional nfsSupport libnfs
|
||||||
++ lib.optional pulseSupport libpulseaudio
|
++ lib.optional pulseSupport libpulseaudio
|
||||||
++ lib.optional rtmpSupport rtmpdump
|
++ lib.optional rtmpSupport rtmpdump
|
||||||
@ -183,7 +192,7 @@ in stdenv.mkDerivation {
|
|||||||
++ lib.optional usbSupport libusb
|
++ lib.optional usbSupport libusb
|
||||||
++ lib.optional vdpauSupport libvdpau
|
++ lib.optional vdpauSupport libvdpau
|
||||||
++ lib.optionals useWayland [
|
++ lib.optionals useWayland [
|
||||||
wayland waylandpp
|
wayland waylandpp wayland-protocols
|
||||||
# Not sure why ".dev" is needed here, but CMake doesn't find libxkbcommon otherwise
|
# Not sure why ".dev" is needed here, but CMake doesn't find libxkbcommon otherwise
|
||||||
libxkbcommon.dev
|
libxkbcommon.dev
|
||||||
]
|
]
|
||||||
@ -200,8 +209,16 @@ in stdenv.mkDerivation {
|
|||||||
which
|
which
|
||||||
pkgconfig gnumake
|
pkgconfig gnumake
|
||||||
autoconf automake libtool # still needed for some components. Check if that is the case with 19.0
|
autoconf automake libtool # still needed for some components. Check if that is the case with 19.0
|
||||||
|
jre yasm gettext python2Packages.python flatbuffers
|
||||||
|
|
||||||
|
# for TexturePacker
|
||||||
|
giflib zlib libpng libjpeg lzo
|
||||||
] ++ lib.optionals useWayland [ wayland-protocols ];
|
] ++ lib.optionals useWayland [ wayland-protocols ];
|
||||||
|
|
||||||
|
depsBuildBuild = [
|
||||||
|
buildPackages.stdenv.cc
|
||||||
|
];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-Dlibdvdcss_URL=${libdvdcss.src}"
|
"-Dlibdvdcss_URL=${libdvdcss.src}"
|
||||||
"-Dlibdvdnav_URL=${libdvdnav.src}"
|
"-Dlibdvdnav_URL=${libdvdnav.src}"
|
||||||
@ -210,9 +227,14 @@ in stdenv.mkDerivation {
|
|||||||
"-DENABLE_EVENTCLIENTS=ON"
|
"-DENABLE_EVENTCLIENTS=ON"
|
||||||
"-DENABLE_INTERNAL_CROSSGUID=OFF"
|
"-DENABLE_INTERNAL_CROSSGUID=OFF"
|
||||||
"-DENABLE_OPTICAL=ON"
|
"-DENABLE_OPTICAL=ON"
|
||||||
|
"-DLIRC_DEVICE=/run/lirc/lircd"
|
||||||
|
"-DSWIG_EXECUTABLE=${buildPackages.swig}/bin/swig"
|
||||||
|
"-DFLATBUFFERS_FLATC_EXECUTABLE=${buildPackages.flatbuffers}/bin/flatc"
|
||||||
|
"-DPYTHON_EXECUTABLE=${buildPackages.python2Packages.python}/bin/python"
|
||||||
] ++ lib.optional useWayland [
|
] ++ lib.optional useWayland [
|
||||||
"-DCORE_PLATFORM_NAME=wayland"
|
"-DCORE_PLATFORM_NAME=wayland"
|
||||||
"-DWAYLAND_RENDER_SYSTEM=gl"
|
"-DWAYLAND_RENDER_SYSTEM=gl"
|
||||||
|
"-DWAYLANDPP_SCANNER=${buildPackages.waylandpp}/bin/wayland-scanner++"
|
||||||
] ++ lib.optional useGbm [
|
] ++ lib.optional useGbm [
|
||||||
"-DCORE_PLATFORM_NAME=gbm"
|
"-DCORE_PLATFORM_NAME=gbm"
|
||||||
"-DGBM_RENDER_SYSTEM=gles"
|
"-DGBM_RENDER_SYSTEM=gles"
|
||||||
@ -224,6 +246,16 @@ in stdenv.mkDerivation {
|
|||||||
# I'm guessing there is a thing waiting to time out
|
# I'm guessing there is a thing waiting to time out
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
|
# Need these tools on the build system when cross compiling,
|
||||||
|
# hacky, but have found no other way.
|
||||||
|
preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||||
|
CXX=c++ LD=ld make -C tools/depends/native/JsonSchemaBuilder
|
||||||
|
cmakeFlags+=" -DWITH_JSONSCHEMABUILDER=$PWD/tools/depends/native/JsonSchemaBuilder/bin"
|
||||||
|
|
||||||
|
CXX=c++ LD=ld make EXTRA_CONFIGURE= -C tools/depends/native/TexturePacker
|
||||||
|
cmakeFlags+=" -DWITH_TEXTUREPACKER=$PWD/tools/depends/native/TexturePacker/bin"
|
||||||
|
'';
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace xbmc/platform/linux/LinuxTimezone.cpp \
|
substituteInPlace xbmc/platform/linux/LinuxTimezone.cpp \
|
||||||
--replace 'usr/share/zoneinfo' 'etc/zoneinfo'
|
--replace 'usr/share/zoneinfo' 'etc/zoneinfo'
|
||||||
@ -232,9 +264,11 @@ in stdenv.mkDerivation {
|
|||||||
postInstall = ''
|
postInstall = ''
|
||||||
for p in $(ls $out/bin/) ; do
|
for p in $(ls $out/bin/) ; do
|
||||||
wrapProgram $out/bin/$p \
|
wrapProgram $out/bin/$p \
|
||||||
--prefix PATH ":" "${lib.makeBinPath [ python2Packages.python glxinfo xdpyinfo ]}" \
|
--prefix PATH ":" "${lib.makeBinPath ([ python2Packages.python glxinfo ] ++ lib.optional x11Support xdpyinfo)}" \
|
||||||
--prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
|
--prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
|
||||||
([ curl systemd libmad libvdpau libcec libcec_platform rtmpdump libass ] ++ lib.optional nfsSupport libnfs)}"
|
([ curl systemd libmad libvdpau libcec libcec_platform libass ]
|
||||||
|
++ lib.optional nfsSupport libnfs
|
||||||
|
++ lib.optional rtmpSupport rtmpdump)}"
|
||||||
done
|
done
|
||||||
|
|
||||||
substituteInPlace $out/share/xsessions/kodi.desktop \
|
substituteInPlace $out/share/xsessions/kodi.desktop \
|
||||||
|
Loading…
Reference in New Issue
Block a user