Advertisement
Guest User

Untitled

a guest
Jun 17th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.31 KB | None | 0 0
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: /var/cvsroot/gentoo-x86/www-client/firefox/firefox-13.0.ebuild,v 1.4 2012/06/12 05:11:58 polynomial-c Exp $
  4.  
  5. EAPI="3"
  6. VIRTUALX_REQUIRED="pgo"
  7. WANT_AUTOCONF="2.1"
  8. MOZ_ESR=""
  9.  
  10. # This list can be updated with scripts/get_langs.sh from the mozilla overlay
  11. MOZ_LANGS=(af ak ar as ast be bg bn-BD bn-IN br bs ca cs csb cy da de el en
  12. en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa fi fr fy-NL ga-IE gd gl
  13. gu-IN he hi-IN hr hu hy-AM id is it ja kk kn ko ku lg lt lv mai mk ml mr nb-NO
  14. nl nn-NO nso or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta ta-LK
  15. te th tr uk vi zh-CN zh-TW zu)
  16.  
  17. # Convert the ebuild version to the upstream mozilla version, used by mozlinguas
  18. MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI
  19. MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
  20. MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI
  21.  
  22. if [[ ${MOZ_ESR} == 1 ]]; then
  23. # ESR releases have slightly version numbers
  24. MOZ_PV="${MOZ_PV}esr"
  25. fi
  26.  
  27. # Changeset for alpha snapshot
  28. CHANGESET="e56ecd8b3a68"
  29. # Patch version
  30. PATCH="${PN}-13.0-patches-0.2"
  31. # Upstream ftp release URI that's used by mozlinguas.eclass
  32. # We don't use the http mirror because it deletes old tarballs.
  33. MOZ_FTP_URI="ftp://ftp.mozilla.org/pub/${PN}/releases/"
  34.  
  35. inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-3 multilib pax-utils fdo-mime autotools python virtualx nsplugins mozlinguas
  36.  
  37. DESCRIPTION="Firefox Web Browser"
  38. HOMEPAGE="http://www.mozilla.com/firefox"
  39.  
  40. KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
  41. SLOT="0"
  42. LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )"
  43. IUSE="bindist +crashreporter +ipc +jit +minimal pgo selinux system-sqlite +webm kde"
  44.  
  45. # More URIs appended below...
  46. # http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
  47. SRC_URI="${SRC_URI}
  48. http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
  49. http://aur.archlinux.org/packages/fi/firefox-kde-opensuse/firefox-kde-opensuse.tar.gz"
  50. ASM_DEPEND=">=dev-lang/yasm-1.1"
  51.  
  52. # Mesa 7.10 needed for WebGL + bugfixes
  53. RDEPEND="
  54. >=sys-devel/binutils-2.16.1
  55. >=dev-libs/nss-3.13.5
  56. >=dev-libs/nspr-4.9.1
  57. >=dev-libs/glib-2.26:2
  58. >=media-libs/mesa-7.10
  59. >=media-libs/libpng-1.5.9[apng]
  60. virtual/libffi
  61. system-sqlite? ( >=dev-db/sqlite-3.7.10[fts3,secure-delete,threadsafe,unlock-notify,debug=] )
  62. webm? ( >=media-libs/libvpx-1.0.0
  63. media-libs/alsa-lib )
  64. crashreporter? ( net-misc/curl )
  65. selinux? ( sec-policy/selinux-mozilla )"
  66. # We don't use PYTHON_DEPEND/PYTHON_USE_WITH for some silly reason
  67. DEPEND="${RDEPEND}
  68. virtual/pkgconfig
  69. pgo? (
  70. =dev-lang/python-2*[sqlite]
  71. >=sys-devel/gcc-4.5 )
  72. webm? ( x86? ( ${ASM_DEPEND} )
  73. amd64? ( ${ASM_DEPEND} )
  74. virtual/opengl )"
  75.  
  76. # No source releases for alpha|beta
  77. if [[ ${PV} =~ alpha ]]; then
  78. SRC_URI="${SRC_URI}
  79. http://dev.gentoo.org/~anarchy/mozilla/firefox/firefox-${MOZ_PV}_${CHANGESET}.source.tar.bz2"
  80. S="${WORKDIR}/mozilla-central"
  81. elif [[ ${PV} =~ beta ]]; then
  82. S="${WORKDIR}/mozilla-beta"
  83. SRC_URI="${SRC_URI}
  84. ${MOZ_FTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2"
  85. else
  86. SRC_URI="${SRC_URI}
  87. ${MOZ_FTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2"
  88. if [[ ${MOZ_ESR} == 1 ]]; then
  89. S="${WORKDIR}/mozilla-esr${PV%%.*}"
  90. else
  91. S="${WORKDIR}/mozilla-release"
  92. fi
  93. fi
  94.  
  95. QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/firefox"
  96.  
  97. pkg_setup() {
  98. moz_pkgsetup
  99.  
  100. # Avoid PGO profiling problems due to enviroment leakage
  101. # These should *always* be cleaned up anyway
  102. unset DBUS_SESSION_BUS_ADDRESS \
  103. DISPLAY \
  104. ORBIT_SOCKETDIR \
  105. SESSION_MANAGER \
  106. XDG_SESSION_COOKIE \
  107. XAUTHORITY
  108.  
  109. if ! use bindist; then
  110. einfo
  111. elog "You are enabling official branding. You may not redistribute this build"
  112. elog "to any users on your network or the internet. Doing so puts yourself into"
  113. elog "a legal problem with Mozilla Foundation"
  114. elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag"
  115. fi
  116.  
  117. if use pgo; then
  118. einfo
  119. ewarn "You will do a double build for profile guided optimization."
  120. ewarn "This will result in your build taking at least twice as long as before."
  121. fi
  122.  
  123. # Ensure we have enough disk space to compile
  124. if use pgo || use debug || use test ; then
  125. CHECKREQS_DISK_BUILD="8G"
  126. else
  127. CHECKREQS_DISK_BUILD="4G"
  128. fi
  129. check-reqs_pkg_setup
  130. }
  131.  
  132. src_unpack() {
  133. unpack ${A}
  134.  
  135. # Unpack language packs
  136. mozlinguas_src_unpack
  137. }
  138.  
  139. src_prepare() {
  140. # Apply our patches
  141. EPATCH_SUFFIX="patch" \
  142. EPATCH_FORCE="yes" \
  143. EPATCH_EXCLUDE="2002_fix-preferences-gentoo.patch \
  144. 2003_fix_system_hunspell_dict_detection.patch \
  145. 5000_fix-title-backspace.patch \
  146. 5001_allow_locked_prefs.patch \
  147. 5002_avoid_spurious_run_items_in_application_handlers.patch \
  148. 5003_properly_launch_applications_set_in_home.patch \
  149. 5004_use_yarr_instead_of_pcre_on_unsupported_platforms.patch \
  150. 5009_load_dependent_libraries_with_their_real_path.patch \
  151. 6001_add_alpha_defines_in_ipc.patch \
  152. 6007_dont_hardcode_page_size.patch \
  153. 6008_fix_crashreporter_with_gcc_4.7.patch \
  154. 6009_fix_system_cairo_support.patch \
  155. 6010_fix_missing_ifdef_moz_media.patch"
  156. epatch "${WORKDIR}/firefox"
  157.  
  158. if use kde; then
  159. rm -f browser/components/shell/src/nsKDEShellService.cpp \
  160. browser/components/shell/src/nsKDEShellService.h \
  161. browser/components/shell/src/nsUnixShellService.cpp \
  162. browser/components/shell/src/nsUnixShellService.h \
  163. browser/base/content/browser-kde.xul
  164. rm -f toolkit/xre/nsKDEUtils.cpp \
  165. toolkit/xre/nsKDEUtils.h \
  166. uriloader/exthandler/unix/nsCommonRegistry.cpp \
  167. uriloader/exthandler/unix/nsCommonRegistry.h \
  168. uriloader/exthandler/unix/nsKDERegistry.cpp \
  169. uriloader/exthandler/unix/nsKDERegistry.h \
  170. toolkit/content/widgets/dialog-kde.xml \
  171. toolkit/content/widgets/preferences-kde.xml
  172.  
  173. install -m 644 "${WORKDIR}/firefox-kde-opensuse/kde.js" browser/app/profile/kde.js
  174.  
  175. EPATCH_SUFFIX="patch" \
  176. EPATCH_FORCE="yes" \
  177. EPATCH_OPTS="-Np1"
  178. EPATCH_EXCLUDE="firefox-install-dir.patch mozilla-firefox-1.0-lang.patch" \
  179. epatch "${WORKDIR}/firefox-kde-opensuse"
  180. fi
  181.  
  182. # Allow user to apply any additional patches without modifing ebuild
  183. epatch_user
  184.  
  185. # Enable gnomebreakpad
  186. if use debug ; then
  187. sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
  188. "${S}"/build/unix/run-mozilla.sh || die "sed failed!"
  189. fi
  190.  
  191. # Disable gnomevfs extension
  192. sed -i -e "s:gnomevfs::" "${S}/"browser/confvars.sh \
  193. -e "s:gnomevfs::" "${S}/"xulrunner/confvars.sh \
  194. || die "Failed to remove gnomevfs extension"
  195.  
  196. # Ensure that are plugins dir is enabled as default
  197. sed -i -e "s:/usr/lib/mozilla/plugins:/usr/$(get_libdir)/nsbrowser/plugins:" \
  198. "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path!"
  199.  
  200. # Fix sandbox violations during make clean, bug 372817
  201. sed -e "s:\(/no-such-file\):${T}\1:g" \
  202. -i "${S}"/config/rules.mk \
  203. -i "${S}"/js/src/config/rules.mk \
  204. -i "${S}"/nsprpub/configure{.in,} \
  205. || die
  206.  
  207. #Fix compilation with curl-7.21.7 bug 376027
  208. sed -e '/#include <curl\/types.h>/d' \
  209. -i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/http_upload.cc \
  210. -i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/libcurl_wrapper.cc \
  211. -i "${S}"/config/system-headers \
  212. -i "${S}"/js/src/config/system-headers || die "Sed failed"
  213.  
  214. eautoreconf
  215. }
  216.  
  217. src_configure() {
  218. MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
  219. MEXTENSIONS="default"
  220.  
  221. ####################################
  222. #
  223. # mozconfig, CFLAGS and CXXFLAGS setup
  224. #
  225. ####################################
  226.  
  227. mozconfig_init
  228. mozconfig_config
  229.  
  230. # It doesn't compile on alpha without this LDFLAGS
  231. use alpha && append-ldflags "-Wl,--no-relax"
  232.  
  233. mozconfig_annotate '' --prefix="${EPREFIX}"/usr
  234. mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
  235. mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
  236. mozconfig_annotate '' --disable-gconf
  237. mozconfig_annotate '' --disable-mailnews
  238. mozconfig_annotate '' --enable-canvas
  239. mozconfig_annotate '' --enable-safe-browsing
  240. mozconfig_annotate '' --with-system-png
  241. mozconfig_annotate '' --enable-system-ffi
  242.  
  243. # Other ff-specific settings
  244. mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
  245. mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
  246.  
  247. mozconfig_use_enable system-sqlite
  248. # Both methodjit and tracejit conflict with PaX
  249. mozconfig_use_enable jit methodjit
  250. mozconfig_use_enable jit tracejit
  251.  
  252. # Allow for a proper pgo build
  253. if use pgo; then
  254. echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig
  255. fi
  256.  
  257. # Finalize and report settings
  258. mozconfig_final
  259.  
  260. if [[ $(gcc-major-version) -lt 4 ]]; then
  261. append-cxxflags -fno-stack-protector
  262. elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then
  263. if use amd64 || use x86; then
  264. append-flags -mno-avx
  265. fi
  266. fi
  267. }
  268.  
  269. src_compile() {
  270. if use pgo; then
  271. addpredict /root
  272. addpredict /etc/gconf
  273. # Reset and cleanup environment variables used by GNOME/XDG
  274. gnome2_environment_reset
  275.  
  276. # Firefox tries to use dri stuff when it's run, see bug 380283
  277. shopt -s nullglob
  278. cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
  279. if test -n "${cards}"; then
  280. # FOSS drivers are fine
  281. addpredict "${cards}"
  282. else
  283. cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g')
  284. if test -n "${cards}"; then
  285. # Binary drivers seem to cause access violations anyway, so
  286. # let's use indirect rendering so that the device files aren't
  287. # touched at all. See bug 394715.
  288. export LIBGL_ALWAYS_INDIRECT=1
  289. fi
  290. fi
  291. shopt -u nullglob
  292.  
  293. CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
  294. MOZ_MAKE_FLAGS="${MAKEOPTS}" \
  295. Xemake -f client.mk profiledbuild || die "Xemake failed"
  296. else
  297. CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
  298. MOZ_MAKE_FLAGS="${MAKEOPTS}" \
  299. emake -f client.mk || die "emake failed"
  300. fi
  301.  
  302. }
  303.  
  304. src_install() {
  305. MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
  306.  
  307. # MOZ_BUILD_ROOT, and hence OBJ_DIR change depending on arch, compiler, pgo, etc.
  308. local obj_dir="$(echo */config.log)"
  309. obj_dir="${obj_dir%/*}"
  310. cd "${S}/${obj_dir}"
  311.  
  312. # Without methodjit and tracejit there's no conflict with PaX
  313. if use jit; then
  314. # Pax mark xpcshell for hardened support, only used for startupcache creation.
  315. pax-mark m "${S}/${obj_dir}"/dist/bin/xpcshell
  316. fi
  317.  
  318. # Add our default prefs for firefox + xulrunner
  319. cp "${FILESDIR}"/gentoo-default-prefs.js-1 \
  320. "${S}/${obj_dir}/dist/bin/defaults/pref/all-gentoo.js" || die
  321.  
  322. MOZ_MAKE_FLAGS="${MAKEOPTS}" \
  323. emake DESTDIR="${D}" install || die "emake install failed"
  324.  
  325. # Install language packs
  326. mozlinguas_src_install
  327.  
  328. local size sizes icon_path icon name
  329. if use bindist; then
  330. sizes="16 32 48"
  331. icon_path="${S}/browser/branding/aurora"
  332. # Firefox's new rapid release cycle means no more codenames
  333. # Let's just stick with this one...
  334. icon="aurora"
  335. name="Aurora"
  336. else
  337. sizes="16 22 24 32 256"
  338. icon_path="${S}/browser/branding/official"
  339. icon="${PN}"
  340. name="Mozilla Firefox"
  341. fi
  342.  
  343. # Install icons and .desktop for menu entry
  344. for size in ${sizes}; do
  345. insinto "/usr/share/icons/hicolor/${size}x${size}/apps"
  346. newins "${icon_path}/default${size}.png" "${icon}.png" || die
  347. done
  348. # The 128x128 icon has a different name
  349. insinto "/usr/share/icons/hicolor/128x128/apps"
  350. newins "${icon_path}/mozicon128.png" "${icon}.png" || die
  351. # Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
  352. newicon "${icon_path}/content/icon48.png" "${icon}.png" || die
  353. newmenu "${FILESDIR}/icon/${PN}.desktop" "${PN}.desktop" || die
  354. sed -i -e "s:@NAME@:${name}:" -e "s:@ICON@:${icon}:" \
  355. "${ED}/usr/share/applications/${PN}.desktop" || die
  356.  
  357. # Add StartupNotify=true bug 237317
  358. if use startup-notification ; then
  359. echo "StartupNotify=true" >> "${ED}/usr/share/applications/${PN}.desktop"
  360. fi
  361.  
  362. # Without methodjit and tracejit there's no conflict with PaX
  363. if use jit; then
  364. # Required in order to use plugins and even run firefox on hardened.
  365. pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin}
  366. fi
  367.  
  368. # Plugin-container needs to be pax-marked for hardened to ensure plugins such as flash
  369. # continue to work as expected.
  370. pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/plugin-container
  371.  
  372. # Plugins dir
  373. share_plugins_dir
  374.  
  375. if use minimal; then
  376. rm -rf "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk} || \
  377. die "Failed to remove sdk and headers"
  378. fi
  379.  
  380. # very ugly hack to make firefox not sigbus on sparc
  381. # FIXME: is this still needed??
  382. use sparc && { sed -e 's/Firefox/FirefoxGentoo/g' \
  383. -i "${ED}/${MOZILLA_FIVE_HOME}/application.ini" || \
  384. die "sparc sed failed"; }
  385. }
  386.  
  387. pkg_preinst() {
  388. gnome2_icon_savelist
  389. }
  390.  
  391. pkg_postinst() {
  392. # Update mimedb for the new .desktop file
  393. fdo-mime_desktop_database_update
  394. gnome2_icon_cache_update
  395. }
  396.  
  397. pkg_postrm() {
  398. gnome2_icon_cache_update
  399. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement