]> CyberLeo.Net >> Repos - CDN/portage-cdn.git/blob - www-client/icecat/icecat-10.0-r2.ebuild
net-p2p/freenet: revbump
[CDN/portage-cdn.git] / www-client / icecat / icecat-10.0-r2.ebuild
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/icecat/icecat-10.0-r2.ebuild,v 1.2 2012/03/01 15:11:32 ago Exp $
4
5 EAPI="3"
6 VIRTUALX_REQUIRED="pgo"
7 WANT_AUTOCONF="2.1"
8
9 # This list can be updated with scripts/get_langs.sh from the mozilla overlay
10 MOZ_LANGS=(af ak ar as ast be bg bn-BD bn-IN br bs ca cs csb cy da de el en
11 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
12 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
13 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
14 te th tr uk vi zh-CN zh-TW zu)
15
16 # Convert the ebuild version to the upstream mozilla version, used by mozlinguas
17 MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI
18 MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
19 MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI
20
21 # Patch version
22 PATCH="firefox-10.0-patches-0.6"
23 # Upstream ftp release URI that's used by mozlinguas.eclass
24 # We don't use the http mirror because it deletes old tarballs.
25 MOZ_FTP_URI="ftp://ftp.mozilla.org/pub/firefox/releases"
26 MOZ_LANGPACK_PREFIX="10.0.1/linux-i686/xpi/"
27
28 inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-3 multilib pax-utils fdo-mime autotools python virtualx nsplugins mozlinguas
29
30 DESCRIPTION="GNU project's edition of Mozilla Firefox"
31 HOMEPAGE="http://www.gnu.org/software/gnuzilla/"
32
33 KEYWORDS="amd64 ~ppc ~ppc64 ~x86"
34 SLOT="0"
35 LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )"
36 IUSE="+crashreporter +ipc pgo selinux system-sqlite +webm"
37
38 # More URIs appended below...
39 SRC_URI="${SRC_URI}
40         mirror://gnu/gnuzilla/${MOZ_PV}/${PN}-${MOZ_PV}.tar.xz
41         http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
42         http://dev.gentoo.org/~polynomial-c/mozilla/ff1001.diff"
43
44 ASM_DEPEND=">=dev-lang/yasm-1.1"
45
46 # Mesa 7.10 needed for WebGL + bugfixes
47 RDEPEND="
48         >=sys-devel/binutils-2.16.1
49         >=dev-libs/nss-3.13.1
50         >=dev-libs/nspr-4.8.8
51         >=dev-libs/glib-2.26:2
52         >=media-libs/mesa-7.10
53         media-libs/libpng[apng]
54         virtual/libffi
55         system-sqlite? ( >=dev-db/sqlite-3.7.7.1[fts3,secure-delete,threadsafe,unlock-notify,debug=] )
56         webm? ( >=media-libs/libvpx-1.0.0
57                 media-libs/alsa-lib )
58         crashreporter? ( net-misc/curl )
59         selinux? ( sec-policy/selinux-mozilla )"
60 # We don't use PYTHON_DEPEND/PYTHON_USE_WITH for some silly reason
61 DEPEND="${RDEPEND}
62         dev-util/pkgconfig
63         pgo? (
64                 =dev-lang/python-2*[sqlite]
65                 >=sys-devel/gcc-4.5 )
66         webm? ( x86? ( ${ASM_DEPEND} )
67                 amd64? ( ${ASM_DEPEND} ) )"
68
69 QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${PN}"
70
71 pkg_setup() {
72         moz_pkgsetup
73
74         # Avoid PGO profiling problems due to enviroment leakage
75         # These should *always* be cleaned up anyway
76         unset DBUS_SESSION_BUS_ADDRESS \
77                 DISPLAY \
78                 ORBIT_SOCKETDIR \
79                 SESSION_MANAGER \
80                 XDG_SESSION_COOKIE \
81                 XAUTHORITY
82
83         if use pgo ; then
84                 einfo
85                 ewarn "You will do a double build for profile guided optimization."
86                 ewarn "This will result in your build taking at least twice as long as before."
87         fi
88
89         # Ensure we have enough disk space to compile
90         if use pgo || use debug || use test ; then
91                 CHECKREQS_DISK_BUILD="8G"
92         else
93                 CHECKREQS_DISK_BUILD="4G"
94         fi
95         check-reqs_pkg_setup
96 }
97
98 src_unpack() {
99         unpack ${A}
100
101         # Unpack language packs
102         mozlinguas_src_unpack
103 }
104
105 src_prepare() {
106         # Make this a 10.0.1 release
107         epatch "${DISTDIR}"/ff1001.diff
108
109         # Fix preferences location
110         sed -i 's|defaults/pref/|defaults/preferences/|' browser/installer/packages-static || die "sed failed"
111         # Apply our patches
112         EPATCH_EXCLUDE="2000-firefox_gentoo_install_dirs.patch" \
113         EPATCH_SUFFIX="patch" \
114         EPATCH_FORCE="yes" \
115         epatch "${WORKDIR}/firefox"
116
117         epatch "${FILESDIR}"/2000-icecat-6_gentoo_install_dirs.patch
118
119         # Allow user to apply any additional patches without modifing ebuild
120         epatch_user
121
122         # Fix rebranding
123         sed -i 's|\$(DIST)/bin/firefox|\$(DIST)/bin/icecat|' browser/app/Makefile.in
124
125         # Enable gnomebreakpad
126         if use debug ; then
127                 sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
128                         "${S}"/build/unix/run-mozilla.sh || die "sed failed!"
129         fi
130
131         # Disable gnomevfs extension
132         sed -i -e "s:gnomevfs::" "${S}/"browser/confvars.sh \
133                 -e "s:gnomevfs::" "${S}/"xulrunner/confvars.sh \
134                 || die "Failed to remove gnomevfs extension"
135
136         # Ensure that are plugins dir is enabled as default
137         sed -i -e "s:/usr/lib/mozilla/plugins:/usr/$(get_libdir)/nsbrowser/plugins:" \
138                 "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path!"
139
140         # Fix sandbox violations during make clean, bug 372817
141         sed -e "s:\(/no-such-file\):${T}\1:g" \
142                 -i "${S}"/config/rules.mk \
143                 -i "${S}"/js/src/config/rules.mk \
144                 -i "${S}"/nsprpub/configure{.in,} \
145                 || die
146
147         #Fix compilation with curl-7.21.7 bug 376027
148         sed -e '/#include <curl\/types.h>/d'  \
149                 -i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/http_upload.cc \
150                 -i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/libcurl_wrapper.cc \
151                 -i "${S}"/config/system-headers \
152                 -i "${S}"/js/src/config/system-headers || die "Sed failed"
153
154         eautoreconf
155 }
156
157 src_configure() {
158         # We will build our own .mozconfig
159         rm "${S}"/.mozconfig
160
161         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
162         MEXTENSIONS="default"
163
164         ####################################
165         #
166         # mozconfig, CFLAGS and CXXFLAGS setup
167         #
168         ####################################
169
170         mozconfig_init
171         mozconfig_config
172
173         # It doesn't compile on alpha without this LDFLAGS
174         use alpha && append-ldflags "-Wl,--no-relax"
175
176         # Specific settings for icecat
177         echo "export MOZ_PHOENIX=1" >> "${S}"/.mozconfig
178         echo "mk_add_options MOZ_PHOENIX=1" "${S}"/.mozconfig
179         mozconfig_annotate '' --with-branding=browser/branding/unofficial
180         mozconfig_annotate '' --disable-official-branding
181         mozconfig_annotate '' --with-user-appdir=.icecat
182
183         mozconfig_annotate '' --prefix="${EPREFIX}"/usr
184         mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
185         mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
186         mozconfig_annotate '' --disable-gconf
187         mozconfig_annotate '' --disable-mailnews
188         mozconfig_annotate '' --enable-canvas
189         mozconfig_annotate '' --enable-safe-browsing
190         mozconfig_annotate '' --with-system-png
191         mozconfig_annotate '' --enable-system-ffi
192
193         # Other browser-specific settings
194         mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
195         mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
196
197         mozconfig_use_enable system-sqlite
198
199         # Allow for a proper pgo build
200         if use pgo ; then
201                 echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig
202         fi
203
204         # Finalize and report settings
205         mozconfig_final
206
207         if [[ $(gcc-major-version) -lt 4 ]]; then
208                 append-cxxflags -fno-stack-protector
209         elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then
210                 if use amd64 || use x86; then
211                         append-flags -mno-avx
212                 fi
213         fi
214 }
215
216 src_compile() {
217         if use pgo; then
218                 addpredict /root
219                 addpredict /etc/gconf
220                 # Reset and cleanup environment variables used by GNOME/XDG
221                 gnome2_environment_reset
222
223                 # icecat tries to use dri stuff when it's run, see bug 380283
224                 shopt -s nullglob
225                 cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
226                 if test -n "${cards}"; then
227                         # FOSS drivers are fine
228                         addpredict "${cards}"
229                 else
230                         cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g')
231                         if test -n "${cards}"; then
232                                 # Binary drivers seem to cause access violations anyway, so
233                                 # let's use indirect rendering so that the device files aren't
234                                 # touched at all. See bug 394715.
235                                 export LIBGL_ALWAYS_INDIRECT=1
236                         fi
237                 fi
238                 shopt -u nullglob
239
240                 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
241                 MOZ_MAKE_FLAGS="${MAKEOPTS}" \
242                 Xemake -f client.mk profiledbuild || die "Xemake failed"
243         else
244                 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
245                 MOZ_MAKE_FLAGS="${MAKEOPTS}" \
246                 emake -f client.mk || die "emake failed"
247         fi
248
249 }
250
251 src_install() {
252         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
253
254         # MOZ_BUILD_ROOT, and hence OBJ_DIR change depending on arch, compiler, pgo, etc.
255         local obj_dir="$(echo */config.log)"
256         obj_dir="${obj_dir%/*}"
257         cd "${S}/${obj_dir}"
258
259         # Pax mark xpcshell for hardened support, only used for startupcache creation.
260         pax-mark m "${S}/${obj_dir}"/dist/bin/xpcshell
261
262         # Add our default prefs for firefox + xulrunner
263         cp "${FILESDIR}"/gentoo-default-prefs.js-1 \
264                 "${S}/${obj_dir}/dist/bin/defaults/pref/all-gentoo.js" || die
265
266         MOZ_MAKE_FLAGS="${MAKEOPTS}" \
267         emake DESTDIR="${D}" install || die "emake install failed"
268
269         # Install language packs
270         mozlinguas_src_install
271
272         local size sizes icon_path icon name
273
274         sizes="16 32 48"
275         icon_path="${S}/browser/branding/unofficial"
276
277         # Install icons and .desktop for menu entry
278         for size in ${sizes}; do
279                 insinto "/usr/share/icons/hicolor/${size}x${size}/apps"
280                 newins "${icon_path}/default${size}.png" "${PN}.png" || die
281         done
282         # The 128x128 icon has a different name
283         insinto "/usr/share/icons/hicolor/128x128/apps"
284         newins "${icon_path}/mozicon128.png" "${PN}.png" || die
285         # Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
286         newicon "${icon_path}/content/icon48.png" "${PN}.png" || die
287         newmenu "${FILESDIR}/icon/${PN}.desktop" "${PN}.desktop" || die
288         sed -e "/^Icon/s:${PN}-icon:${PN}:" -i \
289                 "${ED}/usr/share/applications/${PN}.desktop" || die
290
291         # Add StartupNotify=true bug 237317
292         if use startup-notification ; then
293                 echo "StartupNotify=true" >> "${ED}/usr/share/applications/${PN}.desktop"
294         fi
295
296         # Required in order to use plugins and even run firefox on hardened.
297         pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{${PN}{,-bin},plugin-container}
298
299         # Plugins dir
300         share_plugins_dir
301 }
302
303 pkg_preinst() {
304         gnome2_icon_savelist
305 }
306
307 pkg_postinst() {
308         # Update mimedb for the new .desktop file
309         fdo-mime_desktop_database_update
310         gnome2_icon_cache_update
311 }
312
313 pkg_postrm() {
314         gnome2_icon_cache_update
315 }