]> CyberLeo.Net >> Repos - CDN/portage-cdn.git/blob - www-client/icecat/icecat-3.6.16-r4.ebuild
www-client/icecat: salvage into overlay and unmask
[CDN/portage-cdn.git] / www-client / icecat / icecat-3.6.16-r4.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-r4.ebuild,v 1.1 2011/08/31 09:37:47 polynomial-c 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}.21"
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         http://dev.gentoo.org/~polynomial-c/mozilla/ff3621.diff.xz"
41 LANGPACK_URI="http://gnuzilla.gnu.org/download/langpacks/${MY_PV}"
42
43 for X in ${LANGS} ; do
44         if [ "${X}" != "en" ] && [ "${X}" != "en-US" ]; then
45                 SRC_URI="${SRC_URI}
46                         linguas_${X/-/_}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
47         fi
48         IUSE="${IUSE} linguas_${X/-/_}"
49         # english is handled internally
50         if [ "${#X}" == 5 ] && ! has ${X} ${NOSHORTLANGS}; then
51                 if [ "${X}" != "en-US" ]; then
52                         SRC_URI="${SRC_URI}
53                                 linguas_${X%%-*}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
54                 fi
55                 IUSE="${IUSE} linguas_${X%%-*}"
56         fi
57 done
58
59 RDEPEND="
60         >=sys-devel/binutils-2.16.1
61         >=dev-libs/nss-3.12.8
62         >=dev-libs/nspr-4.8.6
63         >=app-text/hunspell-1.2
64         system-sqlite? ( >=dev-db/sqlite-3.7.4[fts3,secure-delete] )
65         alsa? ( media-libs/alsa-lib )
66         >=x11-libs/cairo-1.8.8[X]
67         gnome? ( >=gnome-base/gnome-vfs-2.16.3
68                 >=gnome-base/libgnomeui-2.16.1
69                 >=gnome-base/gconf-2.16.0
70                 >=gnome-base/libgnome-2.16.0 )
71         wifi? ( net-wireless/wireless-tools )
72         libnotify? ( >=x11-libs/libnotify-0.4 )
73         ~net-libs/xulrunner-${XUL_PV}[ipc=,java=,wifi=,libnotify=,system-sqlite=]"
74
75 DEPEND="${RDEPEND}
76         java? ( >=virtual/jdk-1.4 )
77         =dev-lang/python-2*[threads]
78         dev-util/pkgconfig"
79
80 RDEPEND="${RDEPEND} java? ( >=virtual/jre-1.4 )"
81
82 # This is a copy of the launcher program installed as part of xulrunner, so has
83 # already been stripped. Bug #332071 for details.
84 QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${PN}"
85
86 linguas() {
87         local LANG SLANG
88         for LANG in ${LINGUAS}; do
89                 if has ${LANG} en en_US; then
90                         has en ${linguas} || linguas="${linguas:+"${linguas} "}en"
91                         continue
92                 elif has ${LANG} ${LANGS//-/_}; then
93                         has ${LANG//_/-} ${linguas} || linguas="${linguas:+"${linguas} "}${LANG//_/-}"
94                         continue
95                 elif [[ " ${LANGS} " == *" ${LANG}-"* ]]; then
96                         for X in ${LANGS}; do
97                                 if [[ "${X}" == "${LANG}-"* ]] && \
98                                         [[ " ${NOSHORTLANGS} " != *" ${X} "* ]]; then
99                                         has ${X} ${linguas} || linguas="${linguas:+"${linguas} "}${X}"
100                                         continue 2
101                                 fi
102                         done
103                 fi
104                 ewarn "Sorry, but ${PN} does not support the ${LANG} LINGUA"
105         done
106 }
107
108 pkg_setup() {
109         # Ensure we always build with C locale.
110         export LANG="C"
111         export LC_ALL="C"
112         export LC_MESSAGES="C"
113         export LC_CTYPE="C"
114
115         java-pkg-opt-2_pkg_setup
116
117         python_set_active_version 2
118 }
119
120 src_unpack() {
121         #xz -dc -- "${DISTDIR}/icecat-${MY_PV}.tar.xz" | tar xof - || die "failed to unpack"
122         unpack ${A} #${PATCH}.tar.bz2
123
124         linguas
125         for X in ${linguas}; do
126                 # FIXME: Add support for unpacking xpis to portage
127                 [[ ${X} != "en" ]] && xpi_unpack "${P}-${X}.xpi"
128         done
129 }
130
131 src_prepare() {
132         # Make this a 3.6.21 version
133         epatch "${DISTDIR}"/ff3617.diff.xz \
134                 "${DISTDIR}"/ff3618.diff.xz \
135                 "${DISTDIR}"/ff3620.diff.xz \
136                 "${DISTDIR}"/ff3621.diff.xz
137
138         epatch "${FILESDIR}"/${PN}-3.6.16-curl7217-includes-fix.patch
139
140         # Integrate rebranding
141         sed -i "s|/firefox|/icecat|" \
142                 "${WORKDIR}"/001-firefox_gentoo_install_dirs.patch
143
144         # Fix preferences location
145         sed -i 's|defaults/pref/|defaults/preferences/|' browser/installer/packages-static || die "sed failed"
146
147         # Apply our patches
148         EPATCH_SUFFIX="patch" \
149         EPATCH_FORCE="yes" \
150         epatch "${WORKDIR}"
151
152         # Fix rebranding
153         sed -i 's|\$(DIST)/bin/firefox|\$(DIST)/bin/icecat|' browser/app/Makefile.in
154
155         eautoreconf
156
157         cd js/src
158         eautoreconf
159 }
160
161 src_configure() {
162         # We will build our own .mozconfig
163         rm "${S}"/.mozconfig
164
165         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
166         MEXTENSIONS="default"
167
168         ####################################
169         #
170         # mozconfig, CFLAGS and CXXFLAGS setup
171         #
172         ####################################
173
174         mozconfig_init
175         mozconfig_config
176
177         # It doesn't compile on alpha without this LDFLAGS
178         use alpha && append-ldflags "-Wl,--no-relax"
179
180         # Specific settings for icecat
181         echo "export MOZ_PHOENIX=1" >> "${S}"/.mozconfig
182         echo "mk_add_options MOZ_PHOENIX=1" "${S}"/.mozconfig
183         mozconfig_annotate '' --with-branding=browser/branding/unofficial
184         mozconfig_annotate '' --disable-official-branding
185         mozconfig_annotate '' --with-user-appdir=.icecat
186
187         mozconfig_annotate '' --enable-crypto
188         mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
189         mozconfig_annotate '' --enable-application=browser
190         mozconfig_annotate '' --disable-mailnews
191         mozconfig_annotate 'broken' --disable-crashreporter
192         mozconfig_annotate '' --enable-image-encoder=all
193         mozconfig_annotate '' --enable-canvas
194         mozconfig_annotate 'gtk' --enable-default-toolkit=cairo-gtk2
195         # Bug 60668: Galeon doesn't build without oji enabled, so enable it
196         # regardless of java setting.
197         mozconfig_annotate '' --enable-oji --enable-mathml
198         mozconfig_annotate 'places' --enable-storage --enable-places
199         mozconfig_annotate '' --enable-safe-browsing
200
201         # Build mozdevelop permately
202         mozconfig_annotate ''  --enable-jsd --enable-xpctools
203
204         # System-wide install specs
205         mozconfig_annotate '' --disable-installer
206         mozconfig_annotate '' --disable-updater
207         mozconfig_annotate '' --disable-strip
208         mozconfig_annotate '' --disable-install-strip
209
210         # Use system libraries
211         mozconfig_annotate '' --enable-system-cairo
212         mozconfig_annotate '' --enable-system-hunspell
213         mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${EPREFIX}"/usr
214         mozconfig_annotate '' --with-system-nss --with-nss-prefix="${EPREFIX}"/usr
215         mozconfig_annotate '' --with-system-bz2
216         mozconfig_annotate '' --with-system-libxul
217         mozconfig_annotate '' --with-libxul-sdk="${EPREFIX}"/usr/$(get_libdir)/xulrunner-devel-${MAJ_XUL_PV}
218
219         mozconfig_use_enable gnome gnomevfs
220         mozconfig_use_enable gnome gnomeui
221         mozconfig_use_enable ipc # +ipc, upstream default
222         mozconfig_use_enable libnotify
223         mozconfig_use_enable java javaxpcom
224         mozconfig_use_enable wifi necko-wifi
225         mozconfig_use_enable alsa ogg
226         mozconfig_use_enable alsa wave
227         mozconfig_use_enable system-sqlite
228
229         # Other browser-specific settings
230         mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
231
232         # Finalize and report settings
233         mozconfig_final
234
235         if [[ $(gcc-major-version) -lt 4 ]]; then
236                 append-cxxflags -fno-stack-protector
237         fi
238
239         ####################################
240         #
241         #  Configure and build
242         #
243         ####################################
244
245         CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" PYTHON="$(PYTHON)" econf
246 }
247
248 src_compile() {
249         # Should the build use multiprocessing? Not enabled by default, as it tends to break
250         [ "${WANT_MP}" = "true" ] && jobs=${MAKEOPTS} || jobs="-j1"
251         emake ${jobs} || die
252 }
253
254 src_install() {
255         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
256
257         emake DESTDIR="${D}" install || die "emake install failed"
258
259         linguas
260         for X in ${linguas}; do
261                 [[ ${X} != "en" ]] && xpi_install "${WORKDIR}"/"${P}-${X}"
262         done
263
264         # Install icon and .desktop for menu entry
265         newicon "${S}"/browser/branding/unofficial/default48.png icecat-icon.png
266         newmenu "${FILESDIR}"/icon/icecat.desktop ${PN}-${DESKTOP_PV}.desktop
267
268         # Add StartupNotify=true bug 237317
269         if use startup-notification ; then
270                 echo "StartupNotify=true" >> "${ED}"/usr/share/applications/${PN}-${DESKTOP_PV}.desktop
271         fi
272
273         pax-mark m "${ED}"/${MOZILLA_FIVE_HOME}/${PN}
274
275         # Enable very specific settings not inherited from xulrunner
276         cp "${FILESDIR}"/firefox-default-prefs.js \
277                 "${ED}/${MOZILLA_FIVE_HOME}/defaults/preferences/all-gentoo.js" || \
278                 die "failed to cp icecat-default-prefs.js"
279         # Plugins dir
280         dosym ../nsbrowser/plugins "${MOZILLA_FIVE_HOME}"/plugins \
281                 || die "failed to symlink"
282 }
283
284 pkg_postinst() {
285         ewarn "All the packages built against ${PN} won't compile,"
286         ewarn "any package that fails to build warrants a bug report."
287         elog
288
289         # Update mimedb for the new .desktop file
290         fdo-mime_desktop_database_update
291 }