Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media-tv/kodi-9999: Use cmake instead of autotools #3027

Closed
wants to merge 1 commit into from

Conversation

candrews
Copy link
Member

@candrews candrews commented Dec 5, 2016

Upstream is dropping support for autotools and requiring the use of cmake:
see xbmc/PR10429

https://bugs.gentoo.org/show_bug.cgi?id=601738

@gentoo-repo-qa-bot gentoo-repo-qa-bot added the assigned PR successfully assigned to the package maintainer(s). label Dec 5, 2016
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull Request assignment

Areas affected: ebuilds
Packages affected: media-tv/kodi

media-tv/kodi: @vapier, @gentoo/video

@candrews
Copy link
Member Author

candrews commented Dec 5, 2016

I'm not a cmake or autotools expert by any means. However, I think I've set this up correctly (using Gentoo documentation and other ebuilds as guidance) but it doesn't work. Here's the error I'm getting:

>>> Working in BUILD_DIR: "/var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build"
cmake -C /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/gentoo_common_config.cmake -G Unix Makefiles -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_CACHE=OFF -DENABLE_INTERNAL_FFMPEG=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_NONFREE=no -DENABLE_ALSA=yes -DENABLE_AIRTUNES=yes -DENABLE_BLURAY=yes -DHAVE_LIBCAP=yes -DENABLE_CEC=no -DENABLE_DVDCSS=yes -DENABLE_OPTICAL=no -DENABLE_DBUS=yes -DENABLE_OPENGLES=no -DENABLE_LIRC=yes -DENABLE_MYSQLCLIENT=no -DENABLE_NFS=no -DENABLE_OPENGL=yes -DENABLE_OPENSSL=yes -DENABLE_PULSEAUDIO=yes -DENABLE_SMBCLIENT=yes -DENABLE_SDL=yes -DENABLE_SSH=yes -DENABLE_LIBUSB=yes -DENABLE_UPNP=yes -DENABLE_VAAPI=yes -DENABLE_VDPAU=no -DENABLE_MICROHTTPD=yes -DENABLE_X11=yes -DENABLE_XSLT=no -DENABLE_AVAHI=yes -DCMAKE_BUILD_TYPE=Release -DCMAKE_USER_MAKE_RULES_OVERRIDE=/var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/gentoo_rules.cmake -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/gentoo_toolchain.cmake  /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999/project/cmake/
loading initial cache file /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/gentoo_common_config.cmake
-- The CXX compiler identification is GNU 6.2.0
-- The C compiler identification is GNU 6.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/x86_64-pc-linux-gnu-gcc
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Source directory: /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999
-- Build directory: /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build
-- Generator: Single-configuration: Release (Unix Makefiles)
-- CMake Version: 3.7.1
-- System type: Linux
CMake Error at scripts/common/ArchSetup.cmake:71 (message):
  Toolchain did not define DEPENDS_PATH or NATIVEPREFIX.  Possibly outdated
  depends.
Call Stack (most recent call first):
  CMakeLists.txt:28 (include)


-- Configuring incomplete, errors occurred!
See also "/var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/CMakeFiles/CMakeOutput.log".
 * ERROR: media-tv/kodi-9999::x-portage failed (configure phase):
 *   cmake failed
 * 
 * Call stack:
 *     ebuild.sh, line  115:  Called src_configure
 *   environment, line 5359:  Called cmake-utils_src_configure
 *   environment, line 1616:  Called _cmake_execute_optionally 'src_configure'
 *   environment, line  558:  Called enable_cmake-utils_src_configure
 *   environment, line 2062:  Called die
 * The specific snippet of code:
 *       "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed";

Could someone who knows a bit more about cmake and its use in ebuilds help me out?

@candrews
Copy link
Member Author

candrews commented Dec 6, 2016

@mgorny based on the git log, you seem to be the authority on cmake-utils.eclass, and that's what's causing me confusion right now.

The cmake command run by the ebuild is:

cmake -C /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/gentoo_common_config.cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_CACHE=OFF -DENABLE_INTERNAL_FFMPEG=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_NONFREE=no -DENABLE_ALSA=yes -DENABLE_AIRTUNES=yes -DENABLE_BLURAY=yes -DHAVE_LIBCAP=yes -DENABLE_CEC=no -DENABLE_DVDCSS=yes -DENABLE_OPTICAL=no -DENABLE_DBUS=yes -DENABLE_OPENGLES=no -DENABLE_LIRC=yes -DENABLE_MYSQLCLIENT=no -DENABLE_NFS=no -DENABLE_OPENGL=yes -DENABLE_OPENSSL=yes -DENABLE_PULSEAUDIO=yes -DENABLE_SMBCLIENT=yes -DENABLE_SDL=yes -DENABLE_SSH=yes -DENABLE_LIBUSB=yes -DENABLE_UPNP=yes -DENABLE_VAAPI=yes -DENABLE_VDPAU=no -DENABLE_MICROHTTPD=yes -DENABLE_X11=yes -DENABLE_XSLT=no -DENABLE_AVAHI=yes -DCMAKE_BUILD_TYPE=Release -DCMAKE_USER_MAKE_RULES_OVERRIDE=/var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/gentoo_rules.cmake -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/media-tv/kodi-9999/work/kodi-9999_build/gentoo_toolchain.cmake  /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999/project/cmake/

which gives the error above.

However, by removing the additions made by cmake-utils I get this command:

cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_CACHE=OFF -DENABLE_INTERNAL_FFMPEG=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_NONFREE=no -DENABLE_ALSA=yes -DENABLE_AIRTUNES=yes -DENABLE_BLURAY=yes -DHAVE_LIBCAP=yes -DENABLE_CEC=no -DENABLE_DVDCSS=yes -DENABLE_OPTICAL=no -DENABLE_DBUS=yes -DENABLE_OPENGLES=no -DENABLE_LIRC=yes -DENABLE_MYSQLCLIENT=no -DENABLE_NFS=no -DENABLE_OPENGL=yes -DENABLE_OPENSSL=yes -DENABLE_PULSEAUDIO=yes -DENABLE_SMBCLIENT=yes -DENABLE_SDL=yes -DENABLE_SSH=yes -DENABLE_LIBUSB=yes -DENABLE_UPNP=yes -DENABLE_VAAPI=yes -DENABLE_VDPAU=no -DENABLE_MICROHTTPD=yes -DENABLE_X11=yes -DENABLE_XSLT=no -DENABLE_AVAHI=yes -DCMAKE_BUILD_TYPE=Release  /var/tmp/portage/media-tv/kodi-9999/work/kodi-9999/project/cmake/

which works.

Do you have any tips as to what next steps I can take to figure out why the gentoo additions cause this problem?

@akva2
Copy link

akva2 commented Dec 7, 2016

"sorry" for jumping in, but seeing i'm the autotools removal dude (in work clothes): this is not your fault. this is the kodi cmake buildsystem assuming that a toolchain file means you must be crosscompiling, and then things goes haywire for you obviously. this must be fixed before autotools removal.

@notspiff
Copy link

notspiff commented Dec 7, 2016

please try with pr ref'd above.

@mgorny mgorny changed the title media-tv/kodi-9999: Use cmake instead of autotools [wip] media-tv/kodi-9999: Use cmake instead of autotools Dec 7, 2016
@hauihau
Copy link

hauihau commented Dec 8, 2016

I have some remarks:

-> combine use flags cdio and optical: ENABLE_OPTICAL requires CDIO (I've chosen dvd in my local overlay)

-> udev is preferred over usb (see project/cmake/CMakeLists.txt), so better force udev instead of usb

-> keep use flag texturepacker, or at least add its built time dependencies on lzo, libpng, giflib and virtual/jpeg to DEPEND

-> change udisks? ( sys-fs/udisks:0 ) to udisks? ( sys-fs/udisks )

-> remove "?? ( gles vaapi )" from REQUIRED_USE

-> remove toolchain-funcs from inherit

-> remove all ac_cv_* from ebuild

-> remove export HELP2MAN from src_configure

-> modify src_unpack see BZ#598150

-> add dev-db/sqlite to COMMON_DEPEND

-> raise ffmpeg dep to >=3.1.6

-> move app-arch/bzip2, app-arch/unzip and app-arch/zip from COMMOND_DEPEND to DEPEND (need to check if these are still needed)

-> remove \ from mycmakeargs (this should be an array)

-> add cmake option for bluetooth to mycmakeargs

-> -DENABLE_CACHE=OFF should read -DENABLE_CCACHE=OFF

-> remove many more unneeded packages (BZ#598460):

  • app-i18n/enca
  • dev-python/simplejson
  • dev-python/pillow
  • media-fonts/corefonts
  • media-libs/flac
  • media-libs/jasper
  • media-libs/jbigkit
  • media-libs/libmad
  • media-libs/libmodplug
  • media-libs/libmpeg2
  • media-libs/libsamplerate
  • media-libs/tiff
  • media-sound/wavpack
  • media-libs/glew
  • x11-apps/xdpyinfo
  • x11-apps/mesa-progs
  • x11-libs/libXinerama
  • x11-proto/xineramaproto

@candrews
Copy link
Member Author

candrews commented Dec 11, 2016

I have some remarks:

-> combine use flags cdio and optical: ENABLE_OPTICAL requires CDIO (I've chosen dvd in my local overlay)

Done

-> udev is preferred over usb (see project/cmake/CMakeLists.txt), so better force udev instead of usb
Sorry, can you clarify what change you're suggesting?

-> keep use flag texturepacker, or at least add its built time dependencies on lzo, libpng, giflib and virtual/jpeg to DEPEND

Based on my reading of the cmake setup, texturepacker isn't optional, so we can't have a use flag controlling it. libpng is the only dependency you mentioned that wasn't already present, so I've added that (I also double checked - kodi does use it so it definitely should be there).

-> change udisks? ( sys-fs/udisks:0 ) to udisks? ( sys-fs/udisks )

Done

-> remove "?? ( gles vaapi )" from REQUIRED_USE

Done

-> remove toolchain-funcs from inherit

Done

-> remove all ac_cv_* from ebuild

Done

-> remove export HELP2MAN from src_configure

Done

-> modify src_unpack see BZ#598150

Done

-> add dev-db/sqlite to COMMON_DEPEND

I believe that's covered by PYTHON_REQ_USE="sqlite", but I think what you're saying also makes sense. Done.

-> raise ffmpeg dep to >=3.1.6

Done

-> move app-arch/bzip2, app-arch/unzip and app-arch/zip from COMMOND_DEPEND to DEPEND (need to check if these are still needed)

Makes sense. From looking at the kodi source, I agree these aren't used at runtime. Done.

-> remove \ from mycmakeargs (this should be an array)

Done.

-> add cmake option for bluetooth to mycmakeargs

There is no cmake argument to enable/disable bluetooth (ENABLE_BLUETOOTH isn't an option). I think we just need a conditional dependency on dev-python/pybluez.

-> -DENABLE_CACHE=OFF should read -DENABLE_CCACHE=OFF

Done.

-> remove many more unneeded packages (BZ#598460):

Also dropped dependencies on media-libs/libmpeg2, media-libs/tiff, and media-libs/jasper.
Added dependency on pulseaudio? ( media-sound/pulseaudio )

app-i18n/enca

Done

dev-python/simplejson

Done

dev-python/pillow

I believe pillow is used - can you please check again?

media-fonts/corefonts

Are you sure corefonts are unnecessary?

media-libs/flac

Done.

media-libs/jasper

Done.

media-libs/jbigkit

Done

media-libs/libmad

Done

media-libs/libmodplug

Done

media-libs/libmpeg2

Done (dropped in xbmc/xbmc#8687 )

media-libs/libsamplerate

Done

media-libs/tiff

Done

media-sound/wavpack

Looks like this may be used... https://github.com/xbmc/xbmc/blob/17.0b6-Krypton/xbmc/music/tags/TagLoaderTagLib.cpp#L46 Thoughts?

media-libs/glew

Looks like this may be used... https://github.com/xbmc/xbmc/blob/17.0b6-Krypton/tools/depends/xbmc-addons.include#L93 Thoughts?

x11-apps/xdpyinfo

Done

x11-apps/mesa-progs

Done

x11-libs/libXinerama

Done

x11-proto/xineramaproto

Thank you very much for this feedback - I look forward to further feedback from you.

I've submitted some pull requests to Kodi requesting they update the documented dependencies:
xbmc/xbmc#11111
xbmc/xbmc#11112
xbmc/xbmc#11113

Would you mind doing the same for any others as well as letting me know?

@candrews
Copy link
Member Author

@notspiff Thanks for jumping in - I'm using notspiff/xbmc@578050b as a patch, and made good progress. However, I'm now getting this error:

/usr/include/fribidi/fribidi-common.h:61:20: fatal error: glib.h: No such file or directory

Notably, glib.h exists and is available at /usr/include/glib-2.0/glib.h. Therefore, I believe there's a problem with https://github.com/xbmc/xbmc/blob/master/project/cmake/modules/FindFribidi.cmake and how it sets up the include dir - can you help with that issue?

@hauihau
Copy link

hauihau commented Dec 11, 2016

-> udev is preferred over usb (see project/cmake/CMakeLists.txt), so better force udev instead of usb
Sorry, can you clarify what change you're suggesting?

The current ebuild hast +usb. But UDEV will be used, if it is found, because according to CMakeLists.txt, LibUSB is only searched, if UDEV_FOUND is false:
if(NOT UDEV_FOUND)
core_optional_dep(LibUSB)
endif()

Note: configure.ac does the same,:
# if libudev is available, we don't need libusb
if test "x$use_libudev" != "xno"; then
use_libusb="no"
AC_MSG_NOTICE($libusb_disabled_udev_found)
...

-> keep use flag texturepacker, or at least add its built time dependencies on lzo, libpng, giflib and virtual/jpeg to DEPEND
Based on my reading of the cmake setup, texturepacker isn't optional, so we can't have a use flag controlling it.

I guess that is something like crossguid, perhaps there may be a standalone texturepacker. But I agree, as long as this isn't the case, we should hard depend on the texturepacker deps but only fuer built time.

libpng is the only dependency you mentioned that wasn't already present, so I've added that (I also double checked - kodi does use it so it definitely should be there).

I can't find any place where kodi uses libpng:
htpc kodi-9999 # grep -r png.h
tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp:#include "png.h"

-> add dev-db/sqlite to COMMON_DEPEND
I believe that's covered by PYTHON_REQ_USE="sqlite", but I think what you're saying also makes sense. Done.

I have no clue why kodi depends on python[sqlite]. Kodi itself is using sqlite as the default database backend if I'm correct. It also has it as required_dep in CMakeLists.txt.

-> add cmake option for bluetooth to mycmakeargs
There is no cmake argument to enable/disable bluetooth (ENABLE_BLUETOOTH isn't an option). I think we just need a conditional dependency on dev-python/pybluez.

You're right. Only configure.ac has a switch for bluetooth. There is a FindBluetooth.cmake file, but it is not used. Perhaps we should report that to the kodi guys.

../xbmc/network/TCPServer.cpp has a #ifdef HAVE_LIBBLUETOOTH which is only set by configure.ac, while there is no occurence in project/cmake

dev-python/pillow
I believe pillow is used - can you please check again?

I've removed the dep some time ago and kodi builds just fine

media-fonts/corefonts
Are you sure corefonts are unnecessary?

I've removed the dep some time ago and kodi builds just fine

media-sound/wavpack
Looks like this may be used... https://github.com/xbmc/xbmc/blob/17.0b6-Krypton/xbmc/music/tags/TagLoaderTagLib.cpp#L46 Thoughts?

The include is provided by taglib:
htpc kodi-9999 # qfile /usr/include/taglib/wavpackfile.h
media-libs/taglib (/usr/include/taglib/wavpackfile.h)

media-libs/glew
Looks like this may be used... https://github.com/xbmc/xbmc/blob/17.0b6-Krypton/tools/depends/xbmc-addons.include#L93 Thoughts?

I don't know if this file is also used in cmake builds, I can find it only in a Makefile:
htpc kodi-9999 # grep -r xbmc-addons.include .
./tools/depends/target/binary-addons/Makefile:include ../../xbmc-addons.include

I've submitted some pull requests to Kodi requesting they update the documented dependencies:
xbmc/xbmc#11111
xbmc/xbmc#11112
xbmc/xbmc#11113

Thanks!

Would you mind doing the same for any others as well as letting me know?

Which others do you mean?

Perhaps we should ask kodi developers about pillow, wavpack, corefonts and glew. Even though wavpack and glew ar einstalled on my system, they are not used:
htpc kodi-9999 # grep -ir wavpack /var/db/pkg/media-tv/kodi-9999/NEEDED
htpc kodi-9999 # grep -ir glew /var/db/pkg/media-tv/kodi-9999/NEEDED
htpc kodi-9999 # strings /usr/lib64/kodi/kodi.bin | egrep -i '(wavpack|glew)' | c++filt
handle_708_TGW_ToggleWindows(cc708_service_decoder*, int)
TagLib::WavPack::File::File(TagLib::IOStream*, bool, TagLib::AudioProperties::ReadStyle)
TagLib::WavPack::File::APETag(bool)
togglewatched
ToggleWindows
htpc kodi-9999 #

@mgorny mgorny added the work in progress The PR is not yet ready to be merged. label Dec 11, 2016
@hudokkow
Copy link

@candrews , fribidi problem solved by xbmc/xbmc#11116

@candrews
Copy link
Member Author

candrews commented Dec 11, 2016

The current ebuild hast +usb. But UDEv will be used, if it is found, because according to CMakeLists.txt, LibUSB is only searched, if UDEV_FOUND is false:
if(NOT UDEV_FOUND)
core_optional_dep(LibUSB)
endif()

I see what you're saying, thanks for the clarification. Perhaps the usb and udev flags should conflict then... that may be annoying for users though. Another option is to have the libusb only pulled in if usb is set and udev is not. What are your thoughts?

I can't find any place where kodi uses libpng

I agree, I've removed the dependency on libpng.

You're right. Only configure.ac has a switch for bluetooth. There is a FindBluetooth.cmake file, but it is not used. Perhaps we should report that to the kodi guys.

Reported: http://trac.kodi.tv/ticket/17129#ticket

media-fonts/corefonts
Are you sure corefonts are unnecessary?

I've removed the dep some time ago and kodi builds just fine

Yes, but does it work right at run time? :-)

media-sound/wavpack
Looks like this may be used... https://github.com/xbmc/xbmc/blob/17.0b6-Krypton/xbmc/music/tags/TagLoaderTagLib.cpp#L46 Thoughts?

The include is provided by taglib:
htpc kodi-9999 # qfile /usr/include/taglib/wavpackfile.h
media-libs/taglib (/usr/include/taglib/wavpackfile.h)

Removed that dependency.

media-libs/glew
Looks like this may be used... https://github.com/xbmc/xbmc/blob/17.0b6-Krypton/tools/depends/xbmc-addons.include#L93 Thoughts?

I don't know if this file is also used in cmake builds, I can find it only in a Makefile:
htpc kodi-9999 # grep -r xbmc-addons.include .
./tools/depends/target/binary-addons/Makefile:include ../../xbmc-addons.include

glew was removed from kodi: xbmc/xbmc#8631
I've submitted a PR to remove the remaining references to it:
xbmc/xbmc#11128

@cjmayo
Copy link
Contributor

cjmayo commented Dec 11, 2016

Thanks to the work here I've now been able to build kodi-17.0_beta6 with cmake, although I had to add USE="webserver" (more on that at the end).
Also looks like most of the skin pngs are being built but not installed e.g. DefaultVideo.png
A few notes on the build and the discussion here.

  • For corefonts, arial.ttf is found in the source (perhaps it isn't critical to have it?):
$ grep -rn arial.ttf
addons/skin.estuary/xml/Font.xml:134:			<filename>arial.ttf</filename>
addons/skin.estuary/xml/Font.xml:139:			<filename>arial.ttf</filename>
...
system/settings/settings.xml:669:          <default>arial.ttf</default>
xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp:124:      text->PrepareRender("arial.ttf", 1, 16, 0, m_font, m_fontBorder);
xbmc/guilib/GUIFontManager.cpp:140:      if (strFilename != "arial.ttf")
xbmc/guilib/GUIFontManager.cpp:142:        CLog::Log(LOGERROR, "Couldn't load font name: %s(%s), trying to substitute arial.ttf", strFontName.c_str(), strFilename.c_str());
xbmc/guilib/GUIFontManager.cpp:143:        return LoadTTF(strFontName, "arial.ttf", textColor, shadowColor, iSize, iStyle, border, lineSpacing, originalAspect);
xbmc/utils/Splash.cpp:75:      auto messageFont = g_fontManager.LoadTTF("__splash__", "arial.ttf", 0xFFFFFFFF, 0, 20, FONT_STYLE_NORMAL, false, 1.0f, 1.0f, &res);
$ ldd /usr/lib64/kodi/kodi.bin | grep png
	libpng16.so.16 => /usr/lib64/libpng16.so.16

Messages during build:

-- Found PNG: /usr/lib64/libpng.so (found version "1.6.26+apng") 

/var/tmp/portage/media-tv/kodi-17.0_beta6-r100/work/kodi-17.0_beta6_build/addons/skin.estuary/media/Textures.xbt -dupecheck
This is a PNG - lets load it via libpng...
DefaultActor.png                              
yes
  • Use existing PATCHES instead of epatch?

  • With kodi-17.0_beta6 to stop library download from GitHub add to mycmakeargs:

		-Dlibdvdread_URL="${DISTDIR}/libdvdread-${LIBDVDREAD_COMMIT}.tar.gz" \
		-Dlibdvdnav_URL="${DISTDIR}/libdvdnav-${LIBDVDNAV_COMMIT}.tar.gz" \
		-Dlibdvdcss_URL="${DISTDIR}/libdvdcss-${LIBDVDCSS_COMMIT}.tar.gz" \

Then src_unpack() can be removed.

  • src_install() needs cmake-utils_src_install rather than default

  • Needed to patch out use of gtk-update-icon-cache:
    cjmayo/xbmc@5c3762d
    (Is that a good idea for non-Gentoo users?)

  • Already had net-libs/libmicrohttpd installed with USE="-webserver":

-- MICROHTTPD enabled: No
....
build/network/httprequesthandler/python/network_httprequesthandlers_python.a(HTTPPythonWsgiInvoker.cpp.o):HTTPPythonWsgiInvoker.cpp:PythonModules: error: undefined reference to 'PythonBindings::initModule_xbmcwsgi()'
build/network/httprequesthandler/network_httprequesthandlers.a(HTTPRequestHandlerUtils.cpp.o):HTTPRequestHandlerUtils.cpp:function HTTPRequestHandlerUtils::GetRequestHeaderValue(MHD_Connection*, MHD_ValueKind, std::string const&): error: undefined reference to 'MHD_lookup_connection_value'
build/network/httprequesthandler/network_httprequesthandlers.a(HTTPRequestHandlerUtils.cpp.o):HTTPRequestHandlerUtils.cpp:function HTTPRequestHandlerUtils::GetRequestHeaderValues(MHD_Connection*, MHD_ValueKind, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >&): error: undefined reference to 'MHD_get_connection_values'
build/network/httprequesthandler/network_httprequesthandlers.a(HTTPRequestHandlerUtils.cpp.o):HTTPRequestHandlerUtils.cpp:function HTTPRequestHandlerUtils::GetRequestHeaderValues(MHD_Connection*, MHD_ValueKind, std::multimap<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >&): error: undefined reference to 'MHD_get_connection_values'

@hauihau
Copy link

hauihau commented Dec 11, 2016

I see what you're saying, thanks for the clarification. Perhaps the usb and udev flags should conflict then... that may be annoying for users though. Another option is to have the libusb only pulled in if usb is set and udev is not. What are your thoughts?

I have no idea how to deal with that. Perhaps there is some default behaviour which gentoo prefers.

I can't find any place where kodi uses libpng
I agree, I've removed the dependency on libpng.

TexturePacker requires libpng, so please do not remove it, add it to DEPEND

media-fonts/corefonts
Are you sure corefonts are unnecessary?
I've removed the dep some time ago and kodi builds just fine
Yes, but does it work right at run time? :-)

Haven't seen any change in behaviour so far.

@hauihau
Copy link

hauihau commented Dec 11, 2016

Also looks like most of the skin pngs are being built but not installed e.g. DefaultVideo.png
A few notes on the build and the discussion here.

Not 100% sure, but this maybe because texturepacker packs all these images in one file.

For corefonts, arial.ttf is found in the source (perhaps it isn't critical to have it?):
$ grep -rn arial.ttf
addons/skin.estuary/xml/Font.xml:134: arial.ttf
addons/skin.estuary/xml/Font.xml:139: arial.ttf
...

Thats just an additional fontset defined which uses arial instead of noto.

system/settings/settings.xml:669: arial.ttf

Looks like arial is used as default for subtitles, so the depencendy on corefonts should stay in my opinion. Arial is also used if the configured font can not be found/loaded (see xbmc/guilib/GUIFontManager.cpp)

udisks is used over dbus, and it is the original "org.freedesktop.UDisks" not "org.freedesktop.UDisks2":
https://github.com/xbmc/xbmc/blob/master/xbmc/storage/linux/UDisksProvider.cpp#L281
https://bugs.gentoo.org/show_bug.cgi?id=503862

Didn't see that, thanks. Perhaps also a candidate for upstream kodi to look at.

Haven't tested this on master, but
xbmc/xbmc#11102
at least my kodi-17.0_beta6 is using libpng:
$ ldd /usr/lib64/kodi/kodi.bin | grep png
libpng16.so.16 => /usr/lib64/libpng16.so.16

This comes as a dependency from another used shared lib:

htpc kodi-9999 # lddtree /usr/lib64/kodi/kodi.bin 
kodi.bin => /usr/lib64/kodi/kodi.bin (interpreter => /lib64/ld-linux-x86-64.so.2)
[snip]
    libpcre.so.1 => /lib64/libpcre.so.1
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6
        libbz2.so.1 => /lib64/libbz2.so.1
        libpng16.so.16 => /usr/lib64/libpng16.so.16
    libtag.so.1 => /usr/lib64/libtag.so.1
[snip]

Messages during build:
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.26+apng")

Yes, because tools/depends/native/TexturePacker/CMakeLists.txt requires it:
find_package(PNG REQUIRED)

Already had net-libs/libmicrohttpd installed with USE="-webserver":
-- MICROHTTPD enabled: No
....
build/network/httprequesthandler/python/network_httprequesthandlers_python.a(HTTPPythonWsgiInvoker.cpp.o):HTTPPythonWsgiInvoker.cpp:PythonModules: error: undefined reference to 'PythonBindings::initModule_xbmcwsgi()'
build/network/httprequesthandler/network_httprequesthandlers.a(HTTPRequestHandlerUtils.cpp.o):HTTPRequestHandlerUtils.cpp:function HTTPRequestHandlerUtils::GetRequestHeaderValue(MHD_Connection*, MHD_ValueKind, std::string const&): error: undefined reference to 'MHD_lookup_connection_value'
build/network/httprequesthandler/network_httprequesthandlers.a(HTTPRequestHandlerUtils.cpp.o):HTTPRequestHandlerUtils.cpp:function HTTPRequestHandlerUtils::GetRequestHeaderValues(MHD_Connection*, MHD_ValueKind, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > >&): error: undefined reference to 'MHD_get_connection_values'
build/network/httprequesthandler/network_httprequesthandlers.a(HTTPRequestHandlerUtils.cpp.o):HTTPRequestHandlerUtils.cpp:function HTTPRequestHandlerUtils::GetRequestHeaderValues(MHD_Connection*, MHD_ValueKind, std::multimap<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > >&): error: undefined reference to 'MHD_get_connection_values'

Looks like an error which upstream kodi should fix.

@hauihau
Copy link

hauihau commented Dec 11, 2016

@candrews:

  • please move libpng, giflib and virtual/jpeg too DEPEND (they aren't needed by kodi itself, only TexturePacker uses them, so DEPEND is sufficient).
  • please revert the change to pybluez, bluez should stay, see [cmake] Add support for Bluetooth xbmc/xbmc#11137
  • please remove media-fonts/anonymous-pro and media-fonts/dejavu from COMMON_DEPEND
  • please remove midi from USE
  • is there a specific reason why samba is auto enabled?
  • "?? ( gles vaapi )" REQUIRED_USE is still present, also remove "# gles/vaapi: ..."
  • "X? ( x11-proto/xineramaproto )" is still in DEPEND
  • add x11-libs/libdrm to COMMON_DEPEND "X? ( ... )", LibDRM is required wirh Enable_X11)
  • use flag airplay enabled AIRTUNES which searches for Shairplay which is not available in Gentoo, airplay instead should control ENABLE_PLIST which controls building of AirPlayServer.cpp
  • -DHAVE_LIBCAP looks like it has no effect, cmake outputs "Manually-specified variables were not used by the project: HAVE_LIBCAP"
  • The same for -DHAVE_LIBUSB (or -DENABLE_LIBUSB)

@hudokkow
Copy link

We are giving you guys a run for your money. 😉
Thanks for finding the bugs. We're here to squash'em. Hopefully...

@hauihau
Copy link

hauihau commented Dec 12, 2016

@hudokkow:

could you please tell us about:

  • migration plans to UDisks2
  • is pillow needed
  • is corefonts needed
  • the undefined references when ENABLE_MICROHTTPD=off but libmicrohttpd is installed
  • how to pass/enable HAVE_LIBCAP

@candrews
Copy link
Member Author

candrews commented Dec 12, 2016

please move libpng, giflib and virtual/jpeg too DEPEND (they aren't needed by kodi itself, only TexturePacker uses them, so DEPEND is sufficient).

Makes sense. Done.

please revert the change to pybluez, bluez should stay, see xbmc/xbmc#11137

Thanks for the details. Done.

please remove media-fonts/anonymous-pro and media-fonts/dejavu from COMMON_DEPEND

Good point. Done.

please remove midi from USE

Done.

is there a specific reason why samba is auto enabled?

Nope. I don't think it should be either. Done.

"?? ( gles vaapi )" REQUIRED_USE is still present, also remove "# gles/vaapi: ..."

Oops. Done.

"X? ( x11-proto/xineramaproto )" is still in DEPEND

Oops. Done.

add x11-libs/libdrm to COMMON_DEPEND "X? ( ... )", LibDRM is required wirh Enable_X11)

Another good catch - done.

use flag airplay enabled AIRTUNES which searches for Shairplay which is not available in Gentoo, airplay instead should control ENABLE_PLIST which controls building of AirPlayServer.cpp

Agreed - here's the bug for shairplay in Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=538932
If it ever gets into portage, we can revisit.

-DHAVE_LIBCAP looks like it has no effect, cmake outputs "Manually-specified variables were not used by the project: HAVE_LIBCAP"

I think that's a bug in the Kodi, I reported it at http://trac.kodi.tv/ticket/17130

The same for -DHAVE_LIBUSB (or -DENABLE_LIBUSB)

Since ENABLE_LIBUSB/HAVE_LIBUSB are only checked if ENABLE_UDEV is off, I fixed this by not specifying -DENABLE_LIBUSB unless the libusb use flag is specified.

the undefined references when ENABLE_MICROHTTPD=off but libmicrohttpd is installed

Reported at http://trac.kodi.tv/ticket/17131

Needed to patch out use of gtk-update-icon-cache:
cjmayo/xbmc@5c3762d
(Is that a good idea for non-Gentoo users?)

I'm not sure how that works for other distros... but I've included the patch in the ebuild here.

@notspiff
Copy link

notspiff commented Dec 12, 2016

I have no clue why kodi depends on python[sqlite]. Kodi itself is using sqlite as the default database
backend if I'm correct. It also has it as required_dep in CMakeLists.txt.

it's due to legacy. lots of add-ons (used to) implicitly assume it's available in the kodi-hosted python env without explicitly depending on a script module. since we run on the system interpreter, it needs to be around on the system level. when these assumptions were made, kodi used its own embedded interpreter where it was always supplied, hence the reference to 'legacy'.

@herrnst
Copy link
Contributor

herrnst commented Dec 21, 2016

@candrews re dev-libs/libplatform: The rename was done due to the upstream rename (which was neccessary due to some package naming conflict with debian IIRC), which also involved API breakage (namespace was moved from PLATFORM:: to P8PLATFORM::). Also, IIRC, there wasn't a live ebuild available for the platform lib at that time. Lastly, I wanted all Kodi related things in one place/overlay.

Since the platform lib really is p8platform now, IMHO the ebuild should be named accordingly and also conflict with the old library, and also have the package name aligned with other distros like debian/ubuntu.

@herrnst
Copy link
Contributor

herrnst commented Dec 25, 2016

@candrews Before this PR gets merged, you should pick herrnst/gentoo-kodi-overlay@14917a6 (or adjust accordingly) as the CMake project files were moved.

@candrews candrews force-pushed the kodicmake branch 3 times, most recently from 830dc58 to e7be8a8 Compare December 25, 2016 17:52
@candrews
Copy link
Member Author

Thanks @herrnst! I've made that change.

@candrews
Copy link
Member Author

@SoapGentoo I think this is ready for merging - can you take a peek at it please?

|| ( gles opengl )
udev? ( !libusb )
udisks? ( dbus )
upower? ( dbus )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing PYTHON_REQUIRED_USE (which is very important for python-single-r1!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's obvious... I wonder if repoman can be improved to catch that kind of thing.

>=net-misc/curl-7.51.0
nfs? ( net-fs/libnfs:= )
opengl? ( media-libs/glu )
openssl? ( >=dev-libs/openssl-1.0.2j:0= )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the only SSL/TLS/whatever provider? If so, USE=ssl enables/disables SSL/TLS, whereas USE=openssl selects the impl, conditional on USE=ssl

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libressl also works, so I've updated it accordingly.

}

src_unpack() {
[[ ${PV} == 9999 ]] && git-r3_src_unpack || default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really necessary? doesn't git-r3.eclass override it if its inherited in a -9999 ebuild? Just asking

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it does! That's really cool

}

src_prepare() {
default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never use default with cmake-utils, always use cmake-utils_src_prepare!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today I learned :-)

}

src_configure() {
local CMAKE_BUILD_TYPE=$(usex debug Debug RelWithDebInfo)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general please totally avoid this. Gentoo sets its own CMAKE_BUILD_TYPE which is totally orthogonal to the classic ones, and if the build breaks, it makes too many assumptions about CMAKE_BUILD_TYPE. CMake-based build systems should be agnostic of CMAKE_BUILD_TYPE.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree in principal, Kodi only works with specific cmake build types; it fails if the cmake build type is set to Gentoo as happens by default. So I think we have to set CMAKE_BUILD_TYPE here, unfortunately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright then, can you try and get this removed upstream then?

}

src_compile() {
default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call cmake-utils_src_compile instead of default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


rm "${ED%/}"/usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf || die
dosym /usr/share/fonts/roboto/Roboto-Thin.ttf \
usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't compared them bitwise, but can't this be done in a loop to reduce the churn? Just a suggestion

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense and cuts down on the number of lines a bit

@frace
Copy link
Contributor

frace commented Jan 4, 2017

Isn't it recommended to use eclass functions provided by inheritance?

E.g. from CMAKE-UTILS.ECLASS:

cmake-utils_use_enable [flag name]
Based on use_enable. See ebuild(5).
cmake-utils_use_enable foo FOO echoes -DENABLE_FOO=ON if foo is enabled and -DENABLE_FOO=OFF if it is disabled.

@candrews
Copy link
Member Author

candrews commented Jan 4, 2017

Isn't it recommended to use eclass functions provided by inheritance?

E.g. from CMAKE-UTILS.ECLASS:

cmake-utils_use_enable [flag name]
Based on use_enable. See ebuild(5).
cmake-utils_use_enable foo FOO echoes -DENABLE_FOO=ON if foo is enabled and -DENABLE_FOO=OFF if it is disabled.

cmake-utils_use_* is banned in EAPI 6: https://groups.google.com/forum/#!topic/linux.gentoo.dev/QxCQJ_8taqg

@frace
Copy link
Contributor

frace commented Jan 4, 2017

cmake-utils_use_* is banned in EAPI 6: https://groups.google.com/forum/#!topic/linux.gentoo.dev/QxCQJ_8taqg

I see the point of the discussion. But I can't see the final decision to do so. According to the current version and documentation it still exists:

@candrews candrews force-pushed the kodicmake branch 3 times, most recently from 4797834 to 3d56e67 Compare January 4, 2017 19:15
@SoapGentoo
Copy link
Member

yes, all those eclass functions have been killed because they add no value

rm "${ED%/}"/usr/share/kodi/addons/skin.estuary/fonts/NotoSans-Regular.ttf || die
dosym /usr/share/fonts/noto/NotoSans-Regular.ttf \
usr/share/kodi/addons/skin.estuary/fonts/NotoSans-Regular.ttf
for f in NotoMono-Regular.ttf NotoSans-Bold.ttf NotoSans-Regular.ttf ; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget to make f local

dosym /usr/share/fonts/noto/NotoSans-Regular.ttf \
usr/share/kodi/addons/skin.estouchy/fonts/NotoSans-Regular.ttf

for f in NotoMono-Regular.ttf NotoSans-Bold.ttf NotoSans-Regular.ttf ; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make f local


rm "${ED%/}"/usr/share/kodi/addons/skin.estouchy/fonts/Roboto-Thin.ttf || die
dosym /usr/share/fonts/roboto/Roboto-Thin.ttf \
usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you put everything in the loop with

	local f
	for f in NotoMono-Regular.ttf NotoSans-Bold.ttf NotoSans-Regular.ttf NotoSans-Regular.ttf Roboto-Thin.ttf; do
		rm "${ED%/}"/usr/share/kodi/addons/skin.*/fonts/"${f}" || die
		dosym /usr/share/fonts/noto/"${f}" \
			usr/share/kodi/addons/skin.estuary/fonts/"${f}"
	done

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so.

  • "Roboto-Thin.ttf" isn't in /usr/share/fonts/noto/ so dosym would make a broken symlink
  • There are two skins, esuary and estouchy - this loop would remove the fonts from both estuary and estouchy, but only add them back into estuary.

Upstream has dropped support for autotools and requires the use of cmake.

Gentoo-bug: 601738, 598460, 598460
@frace
Copy link
Contributor

frace commented Jan 13, 2017

Agreed - here's the bug for shairplay in Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=538932
If it ever gets into portage, we can revisit.

Just wanted to let you know I opened a PR to get net-libs/shairplay into portage: #3425

frace added a commit to frace/kodi-overlay that referenced this pull request Jan 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s). work in progress The PR is not yet ready to be merged.
Projects
None yet