kodi-17.0-r1.ebuild 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. # Does not work with py3 here
  5. PYTHON_COMPAT=( python2_7 )
  6. PYTHON_REQ_USE="sqlite"
  7. inherit eutils linux-info python-single-r1 cmake-utils autotools
  8. LIBDVDCSS_COMMIT="2f12236bc1c92f73c21e973363f79eb300de603f"
  9. LIBDVDREAD_COMMIT="17d99db97e7b8f23077b342369d3c22a6250affd"
  10. LIBDVDNAV_COMMIT="43b5f81f5fe30bceae3b7cecf2b0ca57fc930dac"
  11. FFMPEG_VERSION="3.1.6"
  12. CODENAME="Krypton"
  13. SRC_URI="https://github.com/xbmc/libdvdcss/archive/${LIBDVDCSS_COMMIT}.tar.gz -> libdvdcss-${LIBDVDCSS_COMMIT}.tar.gz
  14. https://github.com/xbmc/libdvdread/archive/${LIBDVDREAD_COMMIT}.tar.gz -> libdvdread-${LIBDVDREAD_COMMIT}.tar.gz
  15. https://github.com/xbmc/libdvdnav/archive/${LIBDVDNAV_COMMIT}.tar.gz -> libdvdnav-${LIBDVDNAV_COMMIT}.tar.gz
  16. !system-ffmpeg? ( https://github.com/xbmc/FFmpeg/archive/${FFMPEG_VERSION}-${CODENAME}.tar.gz -> ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}.tar.gz )"
  17. DESCRIPTION="Kodi is a free and open source media-player and entertainment hub"
  18. HOMEPAGE="https://kodi.tv/ http://kodi.wiki/"
  19. LICENSE="GPL-2"
  20. SLOT="0"
  21. # use flag is called libusb so that it doesn't fool people in thinking that
  22. # it is _required_ for USB support. Otherwise they'll disable udev and
  23. # that's going to be worse.
  24. IUSE="airplay alsa bluetooth bluray caps cec +css dbus debug dvd gles libressl libusb lirc mysql nfs nonfree +opengl +ssl pulseaudio samba sftp systemd +system-ffmpeg test +udev udisks upnp upower vaapi vdpau webserver +X +xslt zeroconf"
  25. REQUIRED_USE="
  26. ${PYTHON_REQUIRED_USE}
  27. || ( gles opengl )
  28. udev? ( !libusb )
  29. udisks? ( dbus )
  30. upower? ( dbus )
  31. "
  32. COMMON_DEPEND="${PYTHON_DEPS}
  33. airplay? (
  34. app-pda/libplist
  35. net-libs/shairplay
  36. )
  37. alsa? ( media-libs/alsa-lib )
  38. bluetooth? ( net-wireless/bluez )
  39. bluray? ( >=media-libs/libbluray-0.7.0 )
  40. caps? ( sys-libs/libcap )
  41. dbus? ( sys-apps/dbus )
  42. dev-db/sqlite
  43. dev-libs/expat
  44. dev-libs/fribidi
  45. cec? ( >=dev-libs/libcec-4.0 )
  46. dev-libs/libpcre[cxx]
  47. dev-libs/libxml2
  48. >=dev-libs/lzo-2.04
  49. dev-libs/tinyxml[stl]
  50. >=dev-libs/yajl-2
  51. dev-python/pillow[${PYTHON_USEDEP}]
  52. dev-libs/libcdio
  53. gles? ( media-libs/mesa[gles2] )
  54. libusb? ( virtual/libusb:1 )
  55. media-fonts/corefonts
  56. >=media-fonts/noto-20160531
  57. media-fonts/roboto
  58. media-libs/fontconfig
  59. media-libs/freetype
  60. >=media-libs/libass-0.13.4
  61. media-libs/mesa[egl]
  62. >=media-libs/taglib-1.11.1
  63. system-ffmpeg? ( >=media-video/ffmpeg-${FFMPEG_VERSION}:=[encode,postproc] )
  64. mysql? ( virtual/mysql )
  65. >=net-misc/curl-7.51.0
  66. nfs? ( net-fs/libnfs:= )
  67. opengl? ( media-libs/glu )
  68. ssl? (
  69. !libressl? ( >=dev-libs/openssl-1.0.2j:0= )
  70. libressl? ( dev-libs/libressl:0= )
  71. )
  72. pulseaudio? ( media-sound/pulseaudio )
  73. samba? ( >=net-fs/samba-3.4.6[smbclient(+)] )
  74. sftp? ( net-libs/libssh[sftp] )
  75. sys-libs/zlib
  76. udev? ( virtual/udev )
  77. vaapi? ( x11-libs/libva[opengl] )
  78. vdpau? (
  79. || ( >=x11-libs/libvdpau-1.1 >=x11-drivers/nvidia-drivers-180.51 )
  80. media-video/ffmpeg[vdpau]
  81. )
  82. webserver? ( >=net-libs/libmicrohttpd-0.9.50[messages] )
  83. X? (
  84. x11-libs/libdrm
  85. x11-libs/libX11
  86. x11-libs/libXrandr
  87. x11-libs/libXrender
  88. )
  89. xslt? ( dev-libs/libxslt )
  90. zeroconf? ( net-dns/avahi[dbus] )
  91. "
  92. RDEPEND="${COMMON_DEPEND}
  93. lirc? (
  94. || ( app-misc/lirc app-misc/inputlircd )
  95. )
  96. !media-tv/xbmc
  97. udisks? ( sys-fs/udisks:0 )
  98. upower? (
  99. systemd? ( sys-power/upower )
  100. !systemd? (
  101. || ( sys-power/upower-pm-utils sys-power/upower )
  102. )
  103. )
  104. "
  105. DEPEND="${COMMON_DEPEND}
  106. app-arch/bzip2
  107. app-arch/unzip
  108. app-arch/xz-utils
  109. app-arch/zip
  110. dev-lang/swig
  111. dev-libs/crossguid
  112. dev-util/cmake
  113. dev-util/gperf
  114. media-libs/giflib
  115. >=media-libs/libjpeg-turbo-1.5.1:=
  116. >=media-libs/libpng-1.6.26:0=
  117. test? ( dev-cpp/gtest )
  118. virtual/pkgconfig
  119. x86? ( dev-lang/nasm )
  120. "
  121. case ${PV} in
  122. 9999)
  123. EGIT_REPO_URI="git://github.com/xbmc/xbmc.git"
  124. inherit git-r3
  125. # Force java for latest git version to avoid having to hand maintain the
  126. # generated addons package. #488118
  127. DEPEND+="
  128. virtual/jre
  129. "
  130. ;;
  131. *)
  132. MY_PV=${PV/_p/_r}
  133. MY_PV=${MY_PV/_alpha/a}
  134. MY_PV=${MY_PV/_beta/b}
  135. MY_PV=${MY_PV/_rc/rc}
  136. MY_P="${PN}-${MY_PV}"
  137. SRC_URI+=" https://github.com/xbmc/xbmc/archive/${MY_PV}-${CODENAME}.tar.gz -> ${MY_P}.tar.gz
  138. !java? ( https://github.com/candrews/gentoo-kodi/raw/master/${MY_P}-generated-addons.tar.xz )"
  139. KEYWORDS="~amd64 ~x86"
  140. IUSE+=" java"
  141. DEPEND+="
  142. java? ( virtual/jre )
  143. "
  144. S=${WORKDIR}/xbmc-${MY_PV}-${CODENAME}
  145. ;;
  146. esac
  147. CONFIG_CHECK="~IP_MULTICAST"
  148. ERROR_IP_MULTICAST="
  149. In some cases Kodi needs to access multicast addresses.
  150. Please consider enabling IP_MULTICAST under Networking options.
  151. "
  152. CMAKE_USE_DIR=${S}/project/cmake/
  153. pkg_setup() {
  154. check_extra_config
  155. python-single-r1_pkg_setup
  156. }
  157. src_prepare() {
  158. if in_iuse java && use !java; then
  159. eapply "${FILESDIR}"/${PN}-cmake-no-java.patch
  160. fi
  161. cmake-utils_src_prepare
  162. # avoid long delays when powerkit isn't running #348580
  163. sed -i \
  164. -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
  165. xbmc/linux/*.cpp || die
  166. # Prepare tools and libs witch are configured with autotools during compile time
  167. AUTOTOOLS_DIRS=(
  168. "${S}"/lib/cpluff
  169. "${S}"/tools/depends/native/TexturePacker/src
  170. "${S}"/tools/depends/native/JsonSchemaBuilder/src
  171. )
  172. local d
  173. for d in "${AUTOTOOLS_DIRS[@]}" ; do
  174. pushd ${d} >/dev/null || die
  175. AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" eautoreconf
  176. popd >/dev/null || die
  177. done
  178. elibtoolize
  179. # Prevent autoreconf rerun
  180. sed -e 's/autoreconf -vif/echo "autoreconf already done in src_prepare()"/' -i \
  181. "${S}"/project/cmake/modules/FindCpluff.cmake \
  182. "${S}"/tools/depends/native/TexturePacker/src/autogen.sh \
  183. "${S}"/tools/depends/native/JsonSchemaBuilder/src/autogen.sh
  184. }
  185. src_configure() {
  186. local CMAKE_BUILD_TYPE=$(usex debug Debug RelWithDebInfo)
  187. local mycmakeargs=(
  188. -Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
  189. -DENABLE_LDGOLD=OFF # https://bugs.gentoo.org/show_bug.cgi?id=606124
  190. -DENABLE_ALSA=$(usex alsa)
  191. -DENABLE_AIRTUNES=$(usex airplay)
  192. -DENABLE_AVAHI=$(usex zeroconf)
  193. -DENABLE_BLUETOOTH=$(usex bluetooth)
  194. -DENABLE_BLURAY=$(usex bluray)
  195. -DENABLE_CCACHE=OFF
  196. -DENABLE_CEC=$(usex cec)
  197. -DENABLE_DBUS=$(usex dbus)
  198. -DENABLE_DVDCSS=$(usex css)
  199. -DENABLE_INTERNAL_CROSSGUID=OFF
  200. -DENABLE_INTERNAL_FFMPEG="$(usex !system-ffmpeg)"
  201. -DENABLE_CAP=$(usex caps)
  202. -DENABLE_LIRC=$(usex lirc)
  203. -DENABLE_MICROHTTPD=$(usex webserver)
  204. -DENABLE_MYSQLCLIENT=$(usex mysql)
  205. -DENABLE_NFS=$(usex nfs)
  206. -DENABLE_NONFREE=$(usex nonfree)
  207. -DENABLE_OPENGLES=$(usex gles)
  208. -DENABLE_OPENGL=$(usex opengl)
  209. -DENABLE_OPENSSL=$(usex ssl)
  210. -DENABLE_OPTICAL=$(usex dvd)
  211. -DENABLE_PLIST=$(usex airplay)
  212. -DENABLE_PULSEAUDIO=$(usex pulseaudio)
  213. -DENABLE_SMBCLIENT=$(usex samba)
  214. -DENABLE_SSH=$(usex sftp)
  215. -DENABLE_UDEV=$(usex udev)
  216. -DENABLE_UPNP=$(usex upnp)
  217. -DENABLE_VAAPI=$(usex vaapi)
  218. -DENABLE_VDPAU=$(usex vdpau)
  219. -DENABLE_X11=$(usex X)
  220. -DENABLE_XSLT=$(usex xslt)
  221. -Dlibdvdread_URL="${DISTDIR}/libdvdread-${LIBDVDREAD_COMMIT}.tar.gz"
  222. -Dlibdvdnav_URL="${DISTDIR}/libdvdnav-${LIBDVDNAV_COMMIT}.tar.gz"
  223. -Dlibdvdcss_URL="${DISTDIR}/libdvdcss-${LIBDVDCSS_COMMIT}.tar.gz"
  224. )
  225. use libusb && mycmakeargs+=( -DENABLE_LIBUSB=$(usex libusb) )
  226. use !system-ffmpeg && mycmakeargs+=( -DFFMPEG_URL="${DISTDIR}/ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}.tar.gz" )
  227. cmake-utils_src_configure
  228. }
  229. src_compile() {
  230. cmake-utils_src_compile all $(usev test)
  231. }
  232. src_install() {
  233. cmake-utils_src_install
  234. rm "${ED%/}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}* || die
  235. newicon media/icon48x48.png kodi.png
  236. # Replace bundled fonts with system ones.
  237. rm "${ED%/}"/usr/share/kodi/addons/skin.estouchy/fonts/NotoSans-Regular.ttf || die
  238. dosym /usr/share/fonts/noto/NotoSans-Regular.ttf \
  239. usr/share/kodi/addons/skin.estouchy/fonts/NotoSans-Regular.ttf
  240. local f
  241. for f in NotoMono-Regular.ttf NotoSans-Bold.ttf NotoSans-Regular.ttf ; do
  242. rm "${ED%/}"/usr/share/kodi/addons/skin.estuary/fonts/"${f}" || die
  243. dosym /usr/share/fonts/noto/"${f}" \
  244. usr/share/kodi/addons/skin.estuary/fonts/"${f}"
  245. done
  246. rm "${ED%/}"/usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf || die
  247. dosym /usr/share/fonts/roboto/Roboto-Thin.ttf \
  248. usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf
  249. python_domodule tools/EventClients/lib/python/xbmcclient.py
  250. python_newscript "tools/EventClients/Clients/Kodi Send/kodi-send.py" kodi-send
  251. }