]> CyberLeo.Net >> Repos - CDN/portage-cdn.git/blob - www-client/icecat/icecat-3.6.16-r3.ebuild
net-p2p/freenet: revbump
[CDN/portage-cdn.git] / www-client / icecat / icecat-3.6.16-r3.ebuild
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/www-client/icecat/icecat-3.6.16-r3.ebuild,v 1.6 2011/09/04 00:32:00 phajdan.jr Exp $
4 EAPI="3"
5 WANT_AUTOCONF="2.1"
6
7 inherit flag-o-matic toolchain-funcs eutils mozconfig-3 makeedit multilib pax-utils fdo-mime autotools mozextension java-pkg-opt-2 python
8
9 LANGS="af ar as ast be bg bn-BD bn-IN ca cs cy da de el en en-GB en-US eo es-AR
10 es-CL es-ES es-MX et eu fa fi fr fy-NL ga-IE gl gu-IN he hi-IN hr hu id is it
11 ja ka kk kn ko ku lt lv mk ml mr nb-NO nl nn-NO oc or pa-IN pl pt-BR pt-PT rm ro
12 ru si sk sl sq sr sv-SE ta ta-LK te th tr uk vi zh-CN zh-TW"
13 # Malformed install.rdf: ta-LK
14
15 NOSHORTLANGS="en-GB es-AR es-CL es-MX pt-BR zh-CN zh-TW"
16
17 MAJ_XUL_PV="1.9.2"
18 MAJ_PV="${PV/_*/}" # Without the _rc and _beta stuff
19 DESKTOP_PV="3.6"
20 MY_PV="${PV/_rc/rc}" # Handle beta for SRC_URI
21 #XUL_PV="${MAJ_XUL_PV}${MAJ_PV/${DESKTOP_PV}/}" # Major + Minor version no.s
22 XUL_PV="${MAJ_XUL_PV}.20"
23 FIREFOX_PN="firefox"
24 FIREFOX_P="${FIREFOX_PN}-${PV}"
25 PATCH="${FIREFOX_PN}-3.6-patches-0.4"
26
27 DESCRIPTION="GNU project's edition of Mozilla Firefox"
28 HOMEPAGE="http://www.gnu.org/software/gnuzilla/"
29
30 KEYWORDS="amd64 ppc ppc64 x86"
31 SLOT="0"
32 LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )"
33 IUSE="+alsa +ipc gnome java libnotify system-sqlite wifi"
34
35 SRC_URI="mirror://gnu/gnuzilla/${MY_PV}/${PN}-${MY_PV}.tar.bz2
36         http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.bz2
37         http://dev.gentoo.org/~polynomial-c/mozilla/ff3617.diff.xz
38         http://dev.gentoo.org/~polynomial-c/mozilla/ff3618.diff.xz
39         http://dev.gentoo.org/~polynomial-c/mozilla/ff3620.diff.xz"
40 LANGPACK_URI="http://gnuzilla.gnu.org/download/langpacks/${MY_PV}"
41
42 for X in ${LANGS} ; do
43         if [ "${X}" != "en" ] && [ "${X}" != "en-US" ]; then
44                 SRC_URI="${SRC_URI}
45                         linguas_${X/-/_}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
46         fi
47         IUSE="${IUSE} linguas_${X/-/_}"
48         # english is handled internally
49         if [ "${#X}" == 5 ] && ! has ${X} ${NOSHORTLANGS}; then
50                 if [ "${X}" != "en-US" ]; then
51                         SRC_URI="${SRC_URI}
52                                 linguas_${X%%-*}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
53                 fi
54                 IUSE="${IUSE} linguas_${X%%-*}"
55         fi
56 done
57
58 RDEPEND="
59         >=sys-devel/binutils-2.16.1
60         >=dev-libs/nss-3.12.8
61         >=dev-libs/nspr-4.8.6
62         >=app-text/hunspell-1.2
63         system-sqlite? ( >=dev-db/sqlite-3.7.4[fts3,secure-delete] )
64         alsa? ( media-libs/alsa-lib )
65         >=x11-libs/cairo-1.8.8[X]
66         gnome? ( >=gnome-base/gnome-vfs-2.16.3
67                 >=gnome-base/libgnomeui-2.16.1
68                 >=gnome-base/gconf-2.16.0
69                 >=gnome-base/libgnome-2.16.0 )
70         wifi? ( net-wireless/wireless-tools )
71         libnotify? ( >=x11-libs/libnotify-0.4 )
72         ~net-libs/xulrunner-${XUL_PV}[ipc=,java=,wifi=,libnotify=,system-sqlite=]"
73
74 DEPEND="${RDEPEND}
75         java? ( >=virtual/jdk-1.4 )
76         =dev-lang/python-2*[threads]
77         dev-util/pkgconfig"
78
79 RDEPEND="${RDEPEND} java? ( >=virtual/jre-1.4 )"
80
81 # This is a copy of the launcher program installed as part of xulrunner, so has
82 # already been stripped. Bug #332071 for details.
83 QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${PN}"
84
85 linguas() {
86         local LANG SLANG
87         for LANG in ${LINGUAS}; do
88                 if has ${LANG} en en_US; then
89                         has en ${linguas} || linguas="${linguas:+"${linguas} "}en"
90                         continue
91                 elif has ${LANG} ${LANGS//-/_}; then
92                         has ${LANG//_/-} ${linguas} || linguas="${linguas:+"${linguas} "}${LANG//_/-}"
93                         continue
94                 elif [[ " ${LANGS} " == *" ${LANG}-"* ]]; then
95                         for X in ${LANGS}; do
96                                 if [[ "${X}" == "${LANG}-"* ]] && \
97                                         [[ " ${NOSHORTLANGS} " != *" ${X} "* ]]; then
98                                         has ${X} ${linguas} || linguas="${linguas:+"${linguas} "}${X}"
99                                         continue 2
100                                 fi
101                         done
102                 fi
103                 ewarn "Sorry, but ${PN} does not support the ${LANG} LINGUA"
104         done
105 }
106
107 pkg_setup() {
108         # Ensure we always build with C locale.
109         export LANG="C"
110         export LC_ALL="C"
111         export LC_MESSAGES="C"
112         export LC_CTYPE="C"
113
114         java-pkg-opt-2_pkg_setup
115
116         python_set_active_version 2
117 }
118
119 src_unpack() {
120         #xz -dc -- "${DISTDIR}/icecat-${MY_PV}.tar.xz" | tar xof - || die "failed to unpack"
121         unpack ${A} #${PATCH}.tar.bz2
122
123         linguas
124         for X in ${linguas}; do
125                 # FIXME: Add support for unpacking xpis to portage
126                 [[ ${X} != "en" ]] && xpi_unpack "${P}-${X}.xpi"
127         done
128 }
129
130 src_prepare() {
131         # Make this a 3.6.20 version
132         epatch "${DISTDIR}"/ff3617.diff.xz \
133                 "${DISTDIR}"/ff3618.diff.xz \
134                 "${DISTDIR}"/ff3620.diff.xz
135
136         epatch "${FILESDIR}"/${PN}-3.6.16-curl7217-includes-fix.patch
137
138         # Integrate rebranding
139         sed -i "s|/firefox|/icecat|" \
140                 "${WORKDIR}"/001-firefox_gentoo_install_dirs.patch
141
142         # Fix preferences location
143         sed -i 's|defaults/pref/|defaults/preferences/|' browser/installer/packages-static || die "sed failed"
144
145         # Apply our patches
146         EPATCH_SUFFIX="patch" \
147         EPATCH_FORCE="yes" \
148         epatch "${WORKDIR}"
149
150         # Fix rebranding
151         sed -i 's|\$(DIST)/bin/firefox|\$(DIST)/bin/icecat|' browser/app/Makefile.in
152
153         eautoreconf
154
155         cd js/src
156         eautoreconf
157 }
158
159 src_configure() {
160         # We will build our own .mozconfig
161         rm "${S}"/.mozconfig
162
163         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
164         MEXTENSIONS="default"
165
166         ####################################
167         #
168         # mozconfig, CFLAGS and CXXFLAGS setup
169         #
170         ####################################
171
172         mozconfig_init
173         mozconfig_config
174
175         # It doesn't compile on alpha without this LDFLAGS
176         use alpha && append-ldflags "-Wl,--no-relax"
177
178         # Specific settings for icecat
179         echo "export MOZ_PHOENIX=1" >> "${S}"/.mozconfig
180         echo "mk_add_options MOZ_PHOENIX=1" "${S}"/.mozconfig
181         mozconfig_annotate '' --with-branding=browser/branding/unofficial
182         mozconfig_annotate '' --disable-official-branding
183         mozconfig_annotate '' --with-user-appdir=.icecat
184
185         mozconfig_annotate '' --enable-crypto
186         mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
187         mozconfig_annotate '' --enable-application=browser
188         mozconfig_annotate '' --disable-mailnews
189         mozconfig_annotate 'broken' --disable-crashreporter
190         mozconfig_annotate '' --enable-image-encoder=all
191         mozconfig_annotate '' --enable-canvas
192         mozconfig_annotate 'gtk' --enable-default-toolkit=cairo-gtk2
193         # Bug 60668: Galeon doesn't build without oji enabled, so enable it
194         # regardless of java setting.
195         mozconfig_annotate '' --enable-oji --enable-mathml
196         mozconfig_annotate 'places' --enable-storage --enable-places
197         mozconfig_annotate '' --enable-safe-browsing
198
199         # Build mozdevelop permately
200         mozconfig_annotate ''  --enable-jsd --enable-xpctools
201
202         # System-wide install specs
203         mozconfig_annotate '' --disable-installer
204         mozconfig_annotate '' --disable-updater
205         mozconfig_annotate '' --disable-strip
206         mozconfig_annotate '' --disable-install-strip
207
208         # Use system libraries
209         mozconfig_annotate '' --enable-system-cairo
210         mozconfig_annotate '' --enable-system-hunspell
211         mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${EPREFIX}"/usr
212         mozconfig_annotate '' --with-system-nss --with-nss-prefix="${EPREFIX}"/usr
213         mozconfig_annotate '' --with-system-bz2
214         mozconfig_annotate '' --with-system-libxul
215         mozconfig_annotate '' --with-libxul-sdk="${EPREFIX}"/usr/$(get_libdir)/xulrunner-devel-${MAJ_XUL_PV}
216
217         mozconfig_use_enable gnome gnomevfs
218         mozconfig_use_enable gnome gnomeui
219         mozconfig_use_enable ipc # +ipc, upstream default
220         mozconfig_use_enable libnotify
221         mozconfig_use_enable java javaxpcom
222         mozconfig_use_enable wifi necko-wifi
223         mozconfig_use_enable alsa ogg
224         mozconfig_use_enable alsa wave
225         mozconfig_use_enable system-sqlite
226
227         # Other browser-specific settings
228         mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
229
230         # Finalize and report settings
231         mozconfig_final
232
233         if [[ $(gcc-major-version) -lt 4 ]]; then
234                 append-cxxflags -fno-stack-protector
235         fi
236
237         ####################################
238         #
239         #  Configure and build
240         #
241         ####################################
242
243         CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" PYTHON="$(PYTHON)" econf
244 }
245
246 src_compile() {
247         # Should the build use multiprocessing? Not enabled by default, as it tends to break
248         [ "${WANT_MP}" = "true" ] && jobs=${MAKEOPTS} || jobs="-j1"
249         emake ${jobs} || die
250 }
251
252 src_install() {
253         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
254
255         emake DESTDIR="${D}" install || die "emake install failed"
256
257         linguas
258         for X in ${linguas}; do
259                 [[ ${X} != "en" ]] && xpi_install "${WORKDIR}"/"${P}-${X}"
260         done
261
262         # Install icon and .desktop for menu entry
263         newicon "${S}"/browser/branding/unofficial/default48.png icecat-icon.png
264         newmenu "${FILESDIR}"/icon/icecat.desktop ${PN}-${DESKTOP_PV}.desktop
265
266         # Add StartupNotify=true bug 237317
267         if use startup-notification ; then
268                 echo "StartupNotify=true" >> "${ED}"/usr/share/applications/${PN}-${DESKTOP_PV}.desktop
269         fi
270
271         pax-mark m "${ED}"/${MOZILLA_FIVE_HOME}/${PN}
272
273         # Enable very specific settings not inherited from xulrunner
274         cp "${FILESDIR}"/firefox-default-prefs.js \
275                 "${ED}/${MOZILLA_FIVE_HOME}/defaults/preferences/all-gentoo.js" || \
276                 die "failed to cp icecat-default-prefs.js"
277         # Plugins dir
278         dosym ../nsbrowser/plugins "${MOZILLA_FIVE_HOME}"/plugins \
279                 || die "failed to symlink"
280 }
281
282 pkg_postinst() {
283         ewarn "All the packages built against ${PN} won't compile,"
284         ewarn "any package that fails to build warrants a bug report."
285         elog
286
287         # Update mimedb for the new .desktop file
288         fdo-mime_desktop_database_update
289 }