mozconfig-v6.52.eclass 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. #
  4. # @ECLASS: mozconfig-v6.52.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 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? ( !pulseaudio? ( 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-58.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.17.0:3[secure-delete,debug=] )
  114. system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )
  115. system-harfbuzz? ( >=media-libs/harfbuzz-1.3.3:0= >=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_WIFI} ]]; then
  141. if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
  142. IUSE+=" +wifi"
  143. else
  144. IUSE+=" wifi"
  145. fi
  146. RDEPEND+="
  147. wifi? (
  148. kernel_linux? ( >=sys-apps/dbus-0.60
  149. >=dev-libs/dbus-glib-0.72
  150. net-misc/networkmanager )
  151. )"
  152. fi
  153. DEPEND="app-arch/zip
  154. app-arch/unzip
  155. >=sys-devel/binutils-2.16.1
  156. sys-apps/findutils
  157. ${RDEPEND}"
  158. RDEPEND+="
  159. selinux? ( sec-policy/selinux-mozilla )"
  160. # @FUNCTION: mozconfig_config
  161. # @DESCRIPTION:
  162. # Set common configure options for mozilla packages.
  163. # Call this within src_configure() phase, after mozconfig_init
  164. #
  165. # Example:
  166. #
  167. # inherit mozconfig-v6.46
  168. #
  169. # src_configure() {
  170. # mozconfig_init
  171. # mozconfig_config
  172. # # ... misc ebuild-unique settings via calls to
  173. # # ... mozconfig_{annotate,use_with,use_enable}
  174. # mozconfig_final
  175. # }
  176. mozconfig_config() {
  177. # Migrated from mozcoreconf-2
  178. mozconfig_annotate 'system_libs' \
  179. --with-system-zlib \
  180. --with-system-bz2
  181. if has bindist ${IUSE}; then
  182. mozconfig_use_enable !bindist official-branding
  183. if [[ ${PN} == firefox ]] && use bindist ; then
  184. mozconfig_annotate '' --with-branding=browser/branding/aurora
  185. fi
  186. fi
  187. # Enable position independent executables
  188. mozconfig_annotate 'enabled by Gentoo' --enable-pie
  189. mozconfig_use_enable debug
  190. mozconfig_use_enable debug tests
  191. if ! use debug ; then
  192. mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
  193. else
  194. mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
  195. fi
  196. mozconfig_use_enable startup-notification
  197. if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
  198. # wifi pulls in dbus so manage both here
  199. mozconfig_use_enable wifi necko-wifi
  200. if use kernel_linux && use wifi && ! use dbus; then
  201. echo "Enabling dbus support due to wifi request"
  202. mozconfig_annotate 'dbus required by necko-wifi on linux' --enable-dbus
  203. else
  204. mozconfig_use_enable dbus
  205. fi
  206. else
  207. mozconfig_use_enable dbus
  208. mozconfig_annotate 'disabled' --disable-necko-wifi
  209. fi
  210. if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
  211. mozconfig_use_enable jit ion
  212. fi
  213. # These are enabled by default in all mozilla applications
  214. mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${SYSROOT}${EPREFIX}"/usr
  215. mozconfig_annotate '' --with-system-nss --with-nss-prefix="${SYSROOT}${EPREFIX}"/usr
  216. mozconfig_annotate '' --x-includes="${SYSROOT}${EPREFIX}"/usr/include --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
  217. if use system-libevent; then
  218. mozconfig_annotate '' --with-system-libevent="${SYSROOT}${EPREFIX}"/usr
  219. fi
  220. mozconfig_annotate '' --prefix="${EPREFIX}"/usr
  221. mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
  222. mozconfig_annotate 'Gentoo default' --enable-system-hunspell
  223. mozconfig_annotate '' --disable-gnomeui
  224. mozconfig_annotate '' --enable-gio
  225. mozconfig_annotate '' --disable-crashreporter
  226. mozconfig_annotate 'Gentoo default' --with-system-png
  227. mozconfig_annotate '' --enable-system-ffi
  228. mozconfig_annotate 'Gentoo default to honor system linker' --disable-gold
  229. mozconfig_annotate '' --enable-skia
  230. mozconfig_annotate '' --disable-gconf
  231. mozconfig_annotate '' --with-intl-api
  232. # default toolkit is cairo-gtk2, optional use flags can change this
  233. local toolkit="cairo-gtk2"
  234. local toolkit_comment=""
  235. if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
  236. if use gtk3; then
  237. toolkit="cairo-gtk3"
  238. toolkit_comment="gtk3 use flag"
  239. fi
  240. fi
  241. if [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
  242. if ! use gtk2 ; then
  243. toolkit="cairo-gtk3"
  244. else
  245. toolkit_comment="gtk2 use flag"
  246. fi
  247. fi
  248. if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
  249. if use qt5; then
  250. toolkit="cairo-qt"
  251. toolkit_comment="qt5 use flag"
  252. # need to specify these vars because the qt5 versions are not found otherwise,
  253. # and setting --with-qtdir overrides the pkg-config include dirs
  254. local i
  255. for i in qmake moc rcc; do
  256. echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
  257. >> "${S}"/.mozconfig || die
  258. done
  259. echo 'unset QTDIR' >> "${S}"/.mozconfig || die
  260. mozconfig_annotate '+qt5' --disable-gio
  261. fi
  262. fi
  263. mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
  264. # Use jemalloc unless libc is not glibc >= 2.4
  265. # at this time the minimum glibc in the tree is 2.9 so we should be safe.
  266. if use elibc_glibc && use jemalloc; then
  267. # We must force-enable jemalloc 4 via .mozconfig
  268. echo "export MOZ_JEMALLOC4=1" >> "${S}"/.mozconfig || die
  269. mozconfig_annotate '' --enable-replace-malloc
  270. fi
  271. # Instead of the standard --build= and --host=, mozilla uses --host instead
  272. # of --build, and --target intstead of --host.
  273. # Note, mozilla also has --build but it does not do what you think it does.
  274. # Set both --target and --host as mozilla uses python to guess values otherwise
  275. mozconfig_annotate '' --target="${CHOST}"
  276. mozconfig_annotate '' --host="${CBUILD:-${CHOST}}"
  277. mozconfig_use_enable pulseaudio
  278. # force the deprecated alsa sound code if pulseaudio is disabled
  279. if use kernel_linux && ! use pulseaudio ; then
  280. mozconfig_annotate '-pulseaudio' --enable-alsa
  281. fi
  282. mozconfig_use_enable system-cairo
  283. mozconfig_use_enable system-sqlite
  284. mozconfig_use_with system-jpeg
  285. mozconfig_use_with system-icu
  286. mozconfig_use_with system-libvpx
  287. mozconfig_use_with system-harfbuzz
  288. mozconfig_use_with system-harfbuzz system-graphite2
  289. # Modifications to better support ARM, bug 553364
  290. if use neon ; then
  291. mozconfig_annotate '' --with-fpu=neon
  292. mozconfig_annotate '' --with-thumb=yes
  293. mozconfig_annotate '' --with-thumb-interwork=no
  294. fi
  295. if [[ ${CHOST} == armv* ]] ; then
  296. mozconfig_annotate '' --with-float-abi=hard
  297. if ! use system-libvpx ; then
  298. sed -i -e "s|softfp|hard|" \
  299. "${S}"/media/libvpx/moz.build
  300. fi
  301. fi
  302. }
  303. # @FUNCTION: mozconfig_install_prefs
  304. # @DESCRIPTION:
  305. # Set preferences into the prefs.js file specified as a parameter to
  306. # the function. This sets both some common prefs to all mozilla
  307. # packages, and any prefs that may relate to the use flags administered
  308. # by mozconfig_config().
  309. #
  310. # Call this within src_install() phase, after copying the template
  311. # prefs file (if any) from ${FILESDIR}
  312. #
  313. # Example:
  314. #
  315. # inherit mozconfig-v6.46
  316. #
  317. # src_install() {
  318. # cp "${FILESDIR}"/gentoo-default-prefs.js \
  319. # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
  320. # || die
  321. #
  322. # mozconfig_install_prefs \
  323. # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
  324. #
  325. # ...
  326. # }
  327. mozconfig_install_prefs() {
  328. local prefs_file="${1}"
  329. einfo "Adding prefs from mozconfig to ${prefs_file}"
  330. # set dictionary path, to use system hunspell
  331. echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
  332. >>"${prefs_file}" || die
  333. # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
  334. if use system-harfbuzz ; then
  335. echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
  336. >>"${prefs_file}" || die
  337. fi
  338. }