mozconfig-v6.51.eclass 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. #
  4. # @ECLASS: mozconfig-v6.46.eclass
  5. # @MAINTAINER:
  6. # mozilla team <mozilla@gentoo.org>
  7. # @BLURB: the new mozilla common configuration eclass for FF33 and newer, v6
  8. # @DESCRIPTION:
  9. # This eclass is used in mozilla ebuilds (firefox, thunderbird, seamonkey)
  10. # to provide a single common place for the common mozilla engine compoments.
  11. #
  12. # The eclass provides all common dependencies as well as common use flags.
  13. #
  14. # Some use flags which may be optional in particular mozilla packages can be
  15. # supported through setting eclass variables.
  16. #
  17. # This eclass inherits mozconfig helper functions as defined in mozcoreconf-v3,
  18. # and so ebuilds inheriting this eclass do not need to inherit that.
  19. case ${EAPI} in
  20. 0|1|2|3|4)
  21. die "EAPI=${EAPI} not supported"
  22. ;;
  23. 5)
  24. inherit multilib
  25. ;;
  26. esac
  27. inherit flag-o-matic toolchain-funcs mozcoreconf-v4
  28. # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_WIFI
  29. # @DESCRIPTION:
  30. # Set this variable before the inherit line, when an ebuild needs to provide
  31. # optional necko-wifi support via IUSE="wifi". Currently this would include
  32. # ebuilds for firefox, and potentially seamonkey.
  33. #
  34. # Leave the variable UNSET if necko-wifi support should not be available.
  35. # Set the variable to "enabled" if the use flag should be enabled by default.
  36. # Set the variable to any value if the use flag should exist but not be default-enabled.
  37. # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_JIT
  38. # @DESCRIPTION:
  39. # Set this variable before the inherit line, when an ebuild needs to provide
  40. # deterministic jit support via IUSE="jit". The upstream default will be used
  41. # otherwise, which is generally to enable jit unless support for the platform
  42. # is missing.
  43. #
  44. # Set the variable to "enabled" if the use flag should be enabled by default.
  45. # Set the variable to any value if the use flag should exist but not be default-enabled.
  46. # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK3
  47. # @DESCRIPTION:
  48. # Set this variable before the inherit line, when an ebuild can provide
  49. # optional gtk3 support via IUSE="gtk3". Currently this would include
  50. # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
  51. #
  52. # Leave the variable UNSET if gtk3 support should not be available.
  53. # Set the variable to "enabled" if the use flag should be enabled by default.
  54. # Set the variable to any value if the use flag should exist but not be default-enabled.
  55. # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK2ONLY
  56. # @DESCRIPTION:
  57. # Set this variable before the inherit line, when an ebuild can provide
  58. # optional gtk2-only support via IUSE="gtk2".
  59. #
  60. # Note that this option conflicts directly with MOZCONFIG_OPTIONAL_GTK3, both
  61. # variables cannot be set at the same time and this variable will be ignored if
  62. # MOZCONFIG_OPTIONAL_GTK3 is set.
  63. #
  64. # Leave the variable UNSET if gtk2-only support should not be available.
  65. # Set the variable to "enabled" if the use flag should be enabled by default.
  66. # Set the variable to any value if the use flag should exist but not be default-enabled.
  67. # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
  68. # @DESCRIPTION:
  69. # Set this variable before the inherit line, when an ebuild can provide
  70. # optional qt5 support via IUSE="qt5". Currently this would include
  71. # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
  72. #
  73. # Leave the variable UNSET if qt5 support should not be available.
  74. # Set the variable to "enabled" if the use flag should be enabled by default.
  75. # Set the variable to any value if the use flag should exist but not be default-enabled.
  76. # use-flags common among all mozilla ebuilds
  77. IUSE="${IUSE} dbus debug +jemalloc neon pulseaudio selinux +skia startup-notification system-cairo
  78. system-harfbuzz system-icu system-jpeg system-libevent system-sqlite system-libvpx"
  79. # some notes on deps:
  80. # gtk:2 minimum is technically 2.10 but gio support (enabled by default) needs 2.14
  81. # media-libs/mesa needs to be 10.2 or above due to a bug with flash+vdpau
  82. RDEPEND=">=app-text/hunspell-1.2:=
  83. dev-libs/atk
  84. dev-libs/expat
  85. >=x11-libs/cairo-1.10[X]
  86. x11-libs/gdk-pixbuf
  87. >=x11-libs/pango-1.22.0
  88. >=media-libs/libpng-1.6.25:0=[apng]
  89. >=media-libs/mesa-10.2:*
  90. media-libs/fontconfig
  91. >=media-libs/freetype-2.4.10
  92. kernel_linux? ( media-libs/alsa-lib )
  93. pulseaudio? ( media-sound/pulseaudio )
  94. virtual/freedesktop-icon-theme
  95. dbus? ( >=sys-apps/dbus-0.60
  96. >=dev-libs/dbus-glib-0.72 )
  97. startup-notification? ( >=x11-libs/startup-notification-0.8 )
  98. >=dev-libs/glib-2.26:2
  99. >=sys-libs/zlib-1.2.3
  100. >=virtual/libffi-3.0.10
  101. virtual/ffmpeg
  102. x11-libs/libX11
  103. x11-libs/libXcomposite
  104. x11-libs/libXdamage
  105. x11-libs/libXext
  106. x11-libs/libXfixes
  107. x11-libs/libXrender
  108. x11-libs/libXt
  109. system-cairo? ( >=x11-libs/cairo-1.12[X,xcb] >=x11-libs/pixman-0.19.2 )
  110. system-icu? ( >=dev-libs/icu-56.1:= )
  111. system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
  112. system-libevent? ( >=dev-libs/libevent-2.0:0= )
  113. system-sqlite? ( >=dev-db/sqlite-3.14.1:3[secure-delete,debug=] )
  114. system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )
  115. system-harfbuzz? ( >=media-libs/harfbuzz-1.2.6:0=[graphite,icu] >=media-gfx/graphite2-1.3.8 )
  116. "
  117. if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
  118. MOZCONFIG_OPTIONAL_GTK2ONLY=
  119. if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
  120. IUSE+=" +gtk3"
  121. else
  122. IUSE+=" gtk3"
  123. fi
  124. RDEPEND+="
  125. gtk3? ( >=x11-libs/gtk+-3.4.0:3 )
  126. !gtk3? ( >=x11-libs/gtk+-2.18:2 )"
  127. elif [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
  128. if [[ ${MOZCONFIG_OPTIONAL_GTK2ONLY} = "enabled" ]]; then
  129. IUSE+=" +gtk2"
  130. else
  131. IUSE+=" gtk2"
  132. fi
  133. RDEPEND+="
  134. gtk2? ( >=x11-libs/gtk+-2.18:2 )
  135. !gtk2? ( >=x11-libs/gtk+-3.4.0:3 )"
  136. else
  137. RDEPEND+="
  138. >=x11-libs/gtk+-2.18:2"
  139. fi
  140. if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
  141. inherit qmake-utils
  142. if [[ ${MOZCONFIG_OPTIONAL_QT5} = "enabled" ]]; then
  143. IUSE+=" +qt5"
  144. else
  145. IUSE+=" qt5"
  146. fi
  147. RDEPEND+="
  148. qt5? (
  149. dev-qt/qtcore:5
  150. dev-qt/qtgui:5
  151. dev-qt/qtnetwork:5
  152. dev-qt/qtprintsupport:5
  153. dev-qt/qtwidgets:5
  154. dev-qt/qtxml:5
  155. dev-qt/qtdeclarative:5
  156. )"
  157. fi
  158. if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
  159. if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
  160. IUSE+=" +wifi"
  161. else
  162. IUSE+=" wifi"
  163. fi
  164. RDEPEND+="
  165. wifi? (
  166. kernel_linux? ( >=sys-apps/dbus-0.60
  167. >=dev-libs/dbus-glib-0.72
  168. net-misc/networkmanager )
  169. )"
  170. fi
  171. if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
  172. if [[ ${MOZCONFIG_OPTIONAL_JIT} = "enabled" ]]; then
  173. IUSE+=" +jit"
  174. else
  175. IUSE+=" jit"
  176. fi
  177. fi
  178. DEPEND="app-arch/zip
  179. app-arch/unzip
  180. >=sys-devel/binutils-2.16.1
  181. sys-apps/findutils
  182. ${RDEPEND}"
  183. RDEPEND+="
  184. selinux? ( sec-policy/selinux-mozilla )"
  185. # force system-icu if system-harfbuzz is selected, to avoid potential ABI issues
  186. REQUIRED_USE="
  187. system-harfbuzz? ( system-icu )"
  188. # only one of gtk3 or qt5 should be permitted to be selected, since only one will be used.
  189. [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
  190. REQUIRED_USE+=" ?? ( gtk3 qt5 )"
  191. # only one of gtk2 or qt5 should be permitted to be selected, since only one will be used.
  192. [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
  193. REQUIRED_USE+=" ?? ( gtk2 qt5 )"
  194. # @FUNCTION: mozconfig_config
  195. # @DESCRIPTION:
  196. # Set common configure options for mozilla packages.
  197. # Call this within src_configure() phase, after mozconfig_init
  198. #
  199. # Example:
  200. #
  201. # inherit mozconfig-v6.46
  202. #
  203. # src_configure() {
  204. # mozconfig_init
  205. # mozconfig_config
  206. # # ... misc ebuild-unique settings via calls to
  207. # # ... mozconfig_{annotate,use_with,use_enable}
  208. # mozconfig_final
  209. # }
  210. mozconfig_config() {
  211. # Migrated from mozcoreconf-2
  212. mozconfig_annotate 'system_libs' \
  213. --with-system-zlib \
  214. --with-system-bz2
  215. if has bindist ${IUSE}; then
  216. mozconfig_use_enable !bindist official-branding
  217. if [[ ${PN} == firefox ]] && use bindist ; then
  218. mozconfig_annotate '' --with-branding=browser/branding/aurora
  219. fi
  220. fi
  221. # Enable position independent executables
  222. mozconfig_annotate 'enabled by Gentoo' --enable-pie
  223. mozconfig_use_enable debug
  224. mozconfig_use_enable debug tests
  225. if ! use debug ; then
  226. mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
  227. else
  228. mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
  229. fi
  230. mozconfig_use_enable startup-notification
  231. if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
  232. # wifi pulls in dbus so manage both here
  233. mozconfig_use_enable wifi necko-wifi
  234. if use kernel_linux && use wifi && ! use dbus; then
  235. echo "Enabling dbus support due to wifi request"
  236. mozconfig_annotate 'dbus required by necko-wifi on linux' --enable-dbus
  237. else
  238. mozconfig_use_enable dbus
  239. fi
  240. else
  241. mozconfig_use_enable dbus
  242. mozconfig_annotate 'disabled' --disable-necko-wifi
  243. fi
  244. if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
  245. mozconfig_use_enable jit ion
  246. fi
  247. # These are enabled by default in all mozilla applications
  248. mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${SYSROOT}${EPREFIX}"/usr
  249. mozconfig_annotate '' --with-system-nss --with-nss-prefix="${SYSROOT}${EPREFIX}"/usr
  250. mozconfig_annotate '' --x-includes="${SYSROOT}${EPREFIX}"/usr/include --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
  251. if use system-libevent; then
  252. mozconfig_annotate '' --with-system-libevent="${SYSROOT}${EPREFIX}"/usr
  253. fi
  254. mozconfig_annotate '' --prefix="${EPREFIX}"/usr
  255. mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
  256. mozconfig_annotate 'Gentoo default' --enable-system-hunspell
  257. mozconfig_annotate '' --disable-gnomeui
  258. mozconfig_annotate '' --enable-gio
  259. mozconfig_annotate '' --disable-crashreporter
  260. mozconfig_annotate 'Gentoo default' --with-system-png
  261. mozconfig_annotate '' --enable-system-ffi
  262. mozconfig_annotate 'Gentoo default to honor system linker' --disable-gold
  263. mozconfig_use_enable skia
  264. mozconfig_annotate '' --disable-gconf
  265. mozconfig_annotate '' --with-intl-api
  266. # default toolkit is cairo-gtk2, optional use flags can change this
  267. local toolkit="cairo-gtk2"
  268. local toolkit_comment=""
  269. if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
  270. if use gtk3; then
  271. toolkit="cairo-gtk3"
  272. toolkit_comment="gtk3 use flag"
  273. fi
  274. fi
  275. if [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
  276. if ! use gtk2 ; then
  277. toolkit="cairo-gtk3"
  278. else
  279. toolkit_comment="gtk2 use flag"
  280. fi
  281. fi
  282. if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
  283. if use qt5; then
  284. toolkit="cairo-qt"
  285. toolkit_comment="qt5 use flag"
  286. # need to specify these vars because the qt5 versions are not found otherwise,
  287. # and setting --with-qtdir overrides the pkg-config include dirs
  288. local i
  289. for i in qmake moc rcc; do
  290. echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
  291. >> "${S}"/.mozconfig || die
  292. done
  293. echo 'unset QTDIR' >> "${S}"/.mozconfig || die
  294. mozconfig_annotate '+qt5' --disable-gio
  295. fi
  296. fi
  297. mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
  298. # Use jemalloc unless libc is not glibc >= 2.4
  299. # at this time the minimum glibc in the tree is 2.9 so we should be safe.
  300. if use elibc_glibc && use jemalloc; then
  301. # We must force-enable jemalloc 4 via .mozconfig
  302. echo "export MOZ_JEMALLOC4=1" >> "${S}"/.mozconfig || die
  303. mozconfig_annotate '' --enable-replace-malloc
  304. fi
  305. # Instead of the standard --build= and --host=, mozilla uses --host instead
  306. # of --build, and --target intstead of --host.
  307. # Note, mozilla also has --build but it does not do what you think it does.
  308. # Set both --target and --host as mozilla uses python to guess values otherwise
  309. mozconfig_annotate '' --target="${CHOST}"
  310. mozconfig_annotate '' --host="${CBUILD:-${CHOST}}"
  311. mozconfig_use_enable pulseaudio
  312. mozconfig_use_enable system-cairo
  313. mozconfig_use_enable system-sqlite
  314. mozconfig_use_with system-jpeg
  315. mozconfig_use_with system-icu
  316. mozconfig_use_with system-libvpx
  317. mozconfig_use_with system-harfbuzz
  318. mozconfig_use_with system-harfbuzz system-graphite2
  319. # Modifications to better support ARM, bug 553364
  320. if use neon ; then
  321. mozconfig_annotate '' --with-fpu=neon
  322. mozconfig_annotate '' --with-thumb=yes
  323. mozconfig_annotate '' --with-thumb-interwork=no
  324. fi
  325. if [[ ${CHOST} == armv* ]] ; then
  326. mozconfig_annotate '' --with-float-abi=hard
  327. mozconfig_annotate '' --enable-skia
  328. if ! use system-libvpx ; then
  329. sed -i -e "s|softfp|hard|" \
  330. "${S}"/media/libvpx/moz.build
  331. fi
  332. fi
  333. }
  334. # @FUNCTION: mozconfig_install_prefs
  335. # @DESCRIPTION:
  336. # Set preferences into the prefs.js file specified as a parameter to
  337. # the function. This sets both some common prefs to all mozilla
  338. # packages, and any prefs that may relate to the use flags administered
  339. # by mozconfig_config().
  340. #
  341. # Call this within src_install() phase, after copying the template
  342. # prefs file (if any) from ${FILESDIR}
  343. #
  344. # Example:
  345. #
  346. # inherit mozconfig-v6.46
  347. #
  348. # src_install() {
  349. # cp "${FILESDIR}"/gentoo-default-prefs.js \
  350. # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
  351. # || die
  352. #
  353. # mozconfig_install_prefs \
  354. # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
  355. #
  356. # ...
  357. # }
  358. mozconfig_install_prefs() {
  359. local prefs_file="${1}"
  360. einfo "Adding prefs from mozconfig to ${prefs_file}"
  361. # set dictionary path, to use system hunspell
  362. echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
  363. >>"${prefs_file}" || die
  364. # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
  365. if use system-harfbuzz ; then
  366. echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
  367. >>"${prefs_file}" || die
  368. fi
  369. # force cairo as the canvas renderer if USE=skia is disabled
  370. if ! use skia ; then
  371. echo "lockPref(\"gfx.canvas.azure.backends\",\"cairo\");" \
  372. >>"${prefs_file}" || die
  373. echo "lockPref(\"gfx.content.azure.backends\",\"cairo\");" \
  374. >>"${prefs_file}" || die
  375. fi
  376. }