Advertisement
Guest User

Untitled

a guest
Apr 29th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | None | 0 0
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: /var/cvsroot/gentoo-x86/www-client/firefox-bin/firefox-bin-28.0-r1.ebuild,v 1.1 2014/03/29 03:04:03 anarchy Exp $
  4.  
  5. EAPI="5"
  6.  
  7. # Can be updated using scripts/get_langs.sh from mozilla overlay
  8. MOZ_LANGS=(af ar as ast be bg bn-BD bn-IN br bs ca cs csb cy da de el en
  9. 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
  10. gu-IN he hi-IN hr hu hy-AM id is it ja kk kn ko ku lt lv mai mk ml mr nb-NO
  11. nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta
  12. te tr uk vi zh-CN zh-TW zu)
  13.  
  14. # Convert the ebuild version to the upstream mozilla version, used by mozlinguas
  15. MOZ_PV="${PV/_beta/b}" # Handle beta for SRC_URI
  16. MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI
  17. MOZ_PN="${PN/-bin}"
  18. MOZ_P="${MOZ_PN}-${MOZ_PV}"
  19.  
  20. # Upstream ftp release URI that's used by mozlinguas.eclass
  21. # We don't use the http mirror because it deletes old tarballs.
  22. MOZ_FTP_URI="ftp://ftp.mozilla.org/pub/mozilla.org/${MOZ_PN}/releases/"
  23.  
  24. inherit eutils multilib pax-utils fdo-mime gnome2-utils mozlinguas nsplugins
  25.  
  26. DESCRIPTION="Firefox Web Browser"
  27. MOZ_FTP_URI="ftp://ftp.mozilla.org/pub/mozilla.org/${MOZ_PN}/releases"
  28. SRC_URI="${SRC_URI}
  29. amd64? ( ${MOZ_FTP_URI}/${MOZ_PV}/linux-x86_64/en-US/${MOZ_P}.tar.bz2 -> ${PN}_x86_64-${PV}.tar.bz2 )
  30. x86? ( ${MOZ_FTP_URI}/${MOZ_PV}/linux-i686/en-US/${MOZ_P}.tar.bz2 -> ${PN}_i686-${PV}.tar.bz2 )"
  31. HOMEPAGE="http://www.mozilla.com/firefox"
  32. RESTRICT="strip mirror"
  33.  
  34. KEYWORDS="-* ~amd64 ~x86"
  35. SLOT="0"
  36. LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
  37. IUSE="startup-notification"
  38.  
  39. DEPEND="app-arch/unzip"
  40. RDEPEND="dev-libs/dbus-glib
  41. virtual/freedesktop-icon-theme
  42. x11-libs/libXrender
  43. x11-libs/libXt
  44. x11-libs/libXmu
  45.  
  46. >=x11-libs/gtk+-2.2:2
  47. >=media-libs/alsa-lib-1.0.16
  48.  
  49. !net-libs/libproxy[spidermonkey]
  50. "
  51.  
  52. QA_PREBUILT="
  53. opt/${MOZ_PN}/*.so
  54. opt/${MOZ_PN}/${MOZ_PN}
  55. opt/${MOZ_PN}/${PN}
  56. opt/${MOZ_PN}/crashreporter
  57. opt/${MOZ_PN}/webapprt-stub
  58. opt/${MOZ_PN}/plugin-container
  59. opt/${MOZ_PN}/mozilla-xremote-client
  60. opt/${MOZ_PN}/updater
  61. "
  62.  
  63. S="${WORKDIR}/${MOZ_PN}"
  64.  
  65. src_unpack() {
  66. unpack ${A}
  67.  
  68. # Unpack language packs
  69. mozlinguas_src_unpack
  70. }
  71.  
  72. src_install() {
  73. declare MOZILLA_FIVE_HOME=/opt/${MOZ_PN}
  74.  
  75. local size sizes icon_path icon name
  76. sizes="16 32 48"
  77. icon_path="${S}/browser/chrome/icons/default"
  78. icon="${PN}"
  79. name="Mozilla Firefox"
  80.  
  81. # Install icons and .desktop for menu entry
  82. for size in ${sizes}; do
  83. insinto "/usr/share/icons/hicolor/${size}x${size}/apps"
  84. newins "${icon_path}/default${size}.png" "${icon}.png" || die
  85. done
  86. # The 128x128 icon has a different name
  87. insinto "/usr/share/icons/hicolor/128x128/apps"
  88. newins "${icon_path}/../../../icons/mozicon128.png" "${icon}.png" || die
  89. # Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
  90. newicon "${S}"/browser/chrome/icons/default/default48.png ${PN}-icon.png
  91. domenu "${FILESDIR}"/${PN}.desktop
  92. sed -i -e "s:@NAME@:${name}:" -e "s:@ICON@:${icon}:" \
  93. "${ED}/usr/share/applications/${PN}.desktop" || die
  94.  
  95. # Add StartupNotify=true bug 237317
  96. if use startup-notification; then
  97. echo "StartupNotify=true" >> "${D}"/usr/share/applications/${PN}.desktop
  98. fi
  99.  
  100. # Install firefox in /opt
  101. dodir ${MOZILLA_FIVE_HOME%/*}
  102. mv "${S}" "${D}"${MOZILLA_FIVE_HOME} || die
  103.  
  104. # Fix prefs that make no sense for a system-wide install
  105. insinto ${MOZILLA_FIVE_HOME}/defaults/pref/
  106. doins "${FILESDIR}"/local-settings.js
  107. # Copy preferences file so we can do a simple rename.
  108. cp "${FILESDIR}"/all-gentoo-1.js "${D}"${MOZILLA_FIVE_HOME}/all-gentoo.js
  109.  
  110. # Install language packs
  111. mozlinguas_src_install
  112.  
  113. local LANG=${linguas%% *}
  114. if [[ -n ${LANG} && ${LANG} != "en" ]]; then
  115. elog "Setting default locale to ${LANG}"
  116. echo "pref(\"general.useragent.locale\", \"${LANG}\");" \
  117. >> "${D}${MOZILLA_FIVE_HOME}"/defaults/pref/${PN}-prefs.js || \
  118. die "sed failed to change locale"
  119. fi
  120.  
  121. # Create /usr/bin/firefox-bin
  122. dodir /usr/bin/
  123. cat <<-EOF >"${D}"/usr/bin/${PN}
  124. #!/bin/sh
  125. unset LD_PRELOAD
  126. LD_LIBRARY_PATH="/opt/firefox/"
  127. GTK_PATH=/usr/lib/gtk-2.0/
  128. exec /opt/${MOZ_PN}/${MOZ_PN} "\$@"
  129. EOF
  130. fperms 0755 /usr/bin/${PN}
  131.  
  132. # revdep-rebuild entry
  133. insinto /etc/revdep-rebuild
  134. doins "${FILESDIR}"/10${PN} || die
  135.  
  136. # Plugins dir
  137. share_plugins_dir
  138.  
  139. # Required in order to use plugins and even run firefox on hardened.
  140. pax-mark mr "${ED}"/${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container}
  141. }
  142.  
  143. pkg_preinst() {
  144. gnome2_icon_savelist
  145. }
  146.  
  147. pkg_postinst() {
  148. if ! has_version 'gnome-base/gconf' || ! has_version 'gnome-base/orbit' \
  149. || ! has_version 'net-misc/curl'; then
  150. einfo
  151. einfo "For using the crashreporter, you need gnome-base/gconf,"
  152. einfo "gnome-base/orbit and net-misc/curl emerged."
  153. einfo
  154. fi
  155. # Drop requirement of curl not built with nss as it's not necessary anymore
  156. #if has_version 'net-misc/curl[nss]'; then
  157. # einfo
  158. # einfo "Crashreporter won't be able to send reports"
  159. # einfo "if you have curl emerged with the nss USE-flag"
  160. # einfo
  161. #fi
  162.  
  163. # Update mimedb for the new .desktop file
  164. fdo-mime_desktop_database_update
  165. gnome2_icon_cache_update
  166. }
  167.  
  168. pkg_postrm() {
  169. gnome2_icon_cache_update
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement