/[gentoo-x86]/www-client/chromium/chromium-10.0.612.1-r1.ebuild
Gentoo

Contents of /www-client/chromium/chromium-10.0.612.1-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Jan 2 15:31:35 2011 UTC (3 years, 8 months ago) by phajdan.jr
Branch: MAIN
Changes since 1.1: +14 -4 lines
Fix locale-sensitive test failures, bug #350349.

(Portage version: 2.1.9.25/cvs/Linux i686)

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/chromium/chromium-10.0.612.1-r1.ebuild,v 1.1 2010/12/22 11:51:41 phajdan.jr Exp $
4
5 EAPI="3"
6 PYTHON_DEPEND="2:2.6"
7
8 inherit eutils flag-o-matic multilib pax-utils portability python \
9 toolchain-funcs versionator virtualx
10
11 DESCRIPTION="Open-source version of Google Chrome web browser"
12 HOMEPAGE="http://chromium.org/"
13 SRC_URI="http://build.chromium.org/buildbot/official/${P}.tar.bz2"
14
15 LICENSE="BSD"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86"
18 IUSE="cups +gecko-mediaplayer gnome gnome-keyring system-sqlite system-v8"
19
20 RDEPEND="app-arch/bzip2
21 system-sqlite? (
22 >=dev-db/sqlite-3.7.2[fts3,icu,secure-delete,threadsafe]
23 )
24 system-v8? ( >=dev-lang/v8-3.0.0.1 )
25 dev-libs/dbus-glib
26 >=dev-libs/icu-4.4.1
27 >=dev-libs/libevent-1.4.13
28 dev-libs/libxml2
29 dev-libs/libxslt
30 >=dev-libs/nss-3.12.3
31 gnome? ( >=gnome-base/gconf-2.24.0 )
32 gnome-keyring? ( >=gnome-base/gnome-keyring-2.28.2 )
33 >=media-libs/alsa-lib-1.0.19
34 virtual/jpeg
35 media-libs/libpng
36 media-libs/libvpx
37 media-libs/speex
38 >=media-video/ffmpeg-0.6_p25767[threads]
39 cups? ( >=net-print/cups-1.3.11 )
40 sys-libs/zlib
41 >=x11-libs/gtk+-2.14.7
42 x11-libs/libXScrnSaver
43 x11-libs/libXtst"
44 DEPEND="${RDEPEND}
45 dev-lang/perl
46 >=dev-util/chromium-tools-0.1.4
47 >=dev-util/gperf-3.0.3
48 >=dev-util/pkgconfig-0.23
49 sys-devel/flex"
50 RDEPEND+="
51 || (
52 x11-themes/gnome-icon-theme
53 x11-themes/oxygen-molecule
54 x11-themes/tango-icon-theme
55 x11-themes/xfce4-icon-theme
56 )
57 x11-misc/xdg-utils
58 virtual/ttf-fonts
59 gecko-mediaplayer? ( !www-plugins/gecko-mediaplayer[gnome] )"
60
61 egyp() {
62 set -- build/gyp_chromium --depth=. "${@}"
63 echo "${@}" >&2
64 "${@}"
65 }
66
67 get_installed_v8_version() {
68 best_version dev-lang/v8 | sed -e 's@dev-lang/v8-@@g'
69 }
70
71 remove_bundled_lib() {
72 local out
73 out="$(find $1 -type f \! -iname '*.gyp' -print -delete)" \
74 || die "failed to remove bundled library $1"
75 if [[ -z $out ]]; then
76 die "no files matched when removing bundled library $1"
77 fi
78 }
79
80 pkg_setup() {
81 CHROMIUM_HOME="/usr/$(get_libdir)/chromium-browser"
82
83 # Make sure the build system will use the right tools, bug #340795.
84 tc-export AR CC CXX RANLIB
85
86 # Make sure the build system will use the right python, bug #344367.
87 python_set_active_version 2
88 python_pkg_setup
89
90 # Prevent user problems like bug #299777.
91 if ! grep -q /dev/shm <<< $(get_mounts); then
92 ewarn "You don't have tmpfs mounted at /dev/shm."
93 ewarn "${PN} may fail to start in that configuration."
94 ewarn "Please uncomment the /dev/shm entry in /etc/fstab,"
95 ewarn "and run 'mount /dev/shm'."
96 fi
97 if [ `stat -c %a /dev/shm` -ne 1777 ]; then
98 ewarn "/dev/shm does not have correct permissions."
99 ewarn "${PN} may fail to start in that configuration."
100 ewarn "Please run 'chmod 1777 /dev/shm'."
101 fi
102
103 # Prevent user problems like bug #348235.
104 eshopts_push -s extglob
105 if is-flagq '-g?(gdb)?([1-9])'; then
106 ewarn "You have enabled debug info (probably have -g or -ggdb in your \$C{,XX}FLAGS)."
107 ewarn "You may experience really long compilation times and/or increased memory usage."
108 ewarn "If compilation fails, please try removing -g{,gdb} before reporting a bug."
109 fi
110 eshopts_pop
111 }
112
113 src_prepare() {
114 # Enable optional support for gecko-mediaplayer.
115 epatch "${FILESDIR}"/${PN}-gecko-mediaplayer-r0.patch
116
117 # Make sure we don't use bundled libvpx headers.
118 epatch "${FILESDIR}"/${PN}-system-vpx-r1.patch
119
120 epatch "${FILESDIR}"/${PN}-system-icu-r2.patch
121
122 epatch "${FILESDIR}"/${PN}-system-speex-r0.patch
123
124 remove_bundled_lib "third_party/bzip2"
125 remove_bundled_lib "third_party/codesighs"
126 remove_bundled_lib "third_party/icu"
127 remove_bundled_lib "third_party/jemalloc"
128 remove_bundled_lib "third_party/lcov"
129 remove_bundled_lib "third_party/libevent"
130 remove_bundled_lib "third_party/libjpeg"
131 remove_bundled_lib "third_party/libpng"
132 remove_bundled_lib "third_party/libvpx"
133 remove_bundled_lib "third_party/libxml"
134 remove_bundled_lib "third_party/libxslt"
135 remove_bundled_lib "third_party/lzma_sdk"
136 remove_bundled_lib "third_party/molokocacao"
137 remove_bundled_lib "third_party/speex"
138 remove_bundled_lib "third_party/ocmock"
139 remove_bundled_lib "third_party/yasm"
140 # TODO: also remove third_party/ffmpeg (needs to be compile-tested).
141 # TODO: also remove third_party/zlib. For now the compilation fails if we
142 # remove it (minizip-related).
143
144 # Provide our own gyp file that links with the system speex.
145 # TODO: move this upstream.
146 cp "${FILESDIR}"/speex.gyp third_party/speex || die
147
148 local v8_bundled="$(v8-extract-version v8/src/version.cc)"
149 if use system-v8; then
150 local v8_installed="$(get_installed_v8_version)"
151 einfo "V8 version: bundled - ${v8_bundled}; installed - ${v8_installed}"
152 version_is_at_least "${v8_bundled}" "${v8_installed}" || die
153 else
154 einfo "Bundled V8 version: ${v8_bundled}"
155 fi
156
157 if use system-sqlite; then
158 remove_bundled_lib "third_party/sqlite/src"
159 remove_bundled_lib "third_party/sqlite/preprocessed"
160 fi
161
162 if use system-v8; then
163 # Provide our own gyp file that links with the system v8.
164 # TODO: move this upstream.
165 cp "${FILESDIR}"/v8.gyp v8/tools/gyp || die
166
167 remove_bundled_lib "v8"
168
169 # The implementation files include v8 headers with full path,
170 # like #include "v8/include/v8.h". Make sure the system headers
171 # will be used.
172 # TODO: find a solution that can be upstreamed.
173 rmdir v8/include || die
174 ln -s /usr/include v8/include || die
175 fi
176
177 # Make sure the build system will use the right python, bug #344367.
178 # Only convert directories that need it, to save time.
179 python_convert_shebangs -q -r 2 build tools
180 }
181
182 src_configure() {
183 local myconf=""
184
185 # Never tell the build system to "enable" SSE2, it has a few unexpected
186 # additions, bug #336871.
187 myconf+=" -Ddisable_sse2=1"
188
189 # Use system-provided libraries.
190 # TODO: use_system_hunspell (upstream changes needed).
191 # TODO: use_system_ssl (need to consult upstream).
192 myconf+="
193 -Duse_system_bzip2=1
194 -Duse_system_ffmpeg=1
195 -Duse_system_icu=1
196 -Duse_system_libevent=1
197 -Duse_system_libjpeg=1
198 -Duse_system_libpng=1
199 -Duse_system_libxml=1
200 -Duse_system_vpx=1
201 -Duse_system_zlib=1"
202
203 if use system-sqlite; then
204 myconf+=" -Duse_system_sqlite=1"
205 fi
206
207 # The dependency on cups is optional, see bug #324105.
208 if use cups; then
209 myconf+=" -Duse_cups=1"
210 else
211 myconf+=" -Duse_cups=0"
212 fi
213
214 # Make GConf dependency optional, http://crbug.com/13322.
215 if use gnome; then
216 myconf+=" -Duse_gconf=1"
217 else
218 myconf+=" -Duse_gconf=0"
219 fi
220
221 if use "gnome-keyring"; then
222 myconf+=" -Duse_gnome_keyring=1 -Dlinux_link_gnome_keyring=1"
223 else
224 # TODO: we should also disable code trying to dlopen
225 # gnome-keyring in that case.
226 myconf+=" -Duse_gnome_keyring=0 -Dlinux_link_gnome_keyring=0"
227 fi
228
229 # Enable sandbox.
230 myconf+="
231 -Dlinux_sandbox_path=${CHROMIUM_HOME}/chrome_sandbox
232 -Dlinux_sandbox_chrome_path=${CHROMIUM_HOME}/chrome"
233
234 if host-is-pax; then
235 # Prevent the build from failing (bug #301880). The performance
236 # difference is very small.
237 myconf+=" -Dv8_use_snapshot=0"
238 fi
239
240 if use gecko-mediaplayer; then
241 # Disable hardcoded blacklist for gecko-mediaplayer.
242 # When www-plugins/gecko-mediaplayer is compiled with USE=gnome, it causes
243 # the browser to hang. We can handle the situation via dependencies,
244 # thus making it possible to use gecko-mediaplayer.
245 append-flags -DGENTOO_CHROMIUM_ENABLE_GECKO_MEDIAPLAYER
246 fi
247
248 # Our system ffmpeg should support more codecs than the bundled one
249 # for Chromium.
250 myconf+=" -Dproprietary_codecs=1"
251
252 # Use target arch detection logic from bug #296917.
253 local myarch="$ABI"
254 [[ $myarch = "" ]] && myarch="$ARCH"
255
256 if [[ $myarch = amd64 ]] ; then
257 myconf+=" -Dtarget_arch=x64"
258 elif [[ $myarch = x86 ]] ; then
259 myconf+=" -Dtarget_arch=ia32"
260 elif [[ $myarch = arm ]] ; then
261 # TODO: check this again after
262 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39509 is fixed.
263 append-flags -fno-tree-sink
264
265 myconf+=" -Dtarget_arch=arm -Ddisable_nacl=1 -Dlinux_use_tcmalloc=0"
266 else
267 die "Failed to determine target arch, got '$myarch'."
268 fi
269
270 # Make sure that -Werror doesn't get added to CFLAGS by the build system.
271 # Depending on GCC version the warnings are different and we don't want
272 # the build to fail because of that.
273 myconf+=" -Dwerror="
274
275 egyp ${myconf} || die
276 }
277
278 src_compile() {
279 emake chrome chrome_sandbox base_unittests net_unittests \
280 BUILDTYPE=Release V=1 || die
281 pax-mark m out/Release/chrome
282 if use test; then
283 emake base_unittests net_unittests \
284 BUILDTYPE=Release V=1 || die
285 pax-mark m out/Release/{base_unittests,net_unittests}
286 fi
287 }
288
289 src_test() {
290 # For more info see bug #350349.
291 local mylocale='en_US.utf8'
292 if ! locale -a | grep -q "$mylocale"; then
293 eerror "${PN} requires ${mylocale} locale for tests"
294 eerror "Please read the following guides for more information:"
295 eerror " http://www.gentoo.org/doc/en/guide-localization.xml"
296 eerror " http://www.gentoo.org/doc/en/utf-8.xml"
297 die "locale ${mylocale} is not supported"
298 fi
299
300 # Make test failures non-fatal for now. This needs more investigation.
301 LC_ALL="${mylocale}" maketype=out/Release/base_unittests virtualmake \
302 || eerror "base_unittests failed"
303 LC_ALL="${mylocale}" maketype=out/Release/net_unittests virtualmake \
304 || eerror "net_unittests failed"
305 }
306
307 src_install() {
308 exeinto "${CHROMIUM_HOME}"
309 doexe out/Release/chrome
310 doexe out/Release/chrome_sandbox || die
311 fperms 4755 "${CHROMIUM_HOME}/chrome_sandbox"
312 doexe out/Release/xdg-settings || die
313 doexe "${FILESDIR}"/chromium-launcher.sh || die
314
315 insinto "${CHROMIUM_HOME}"
316 doins out/Release/chrome.pak || die
317 doins out/Release/resources.pak || die
318
319 doins -r out/Release/locales || die
320 doins -r out/Release/resources || die
321
322 # chrome.1 is for chromium --help
323 newman out/Release/chrome.1 chrome.1 || die
324 newman out/Release/chrome.1 chromium.1 || die
325
326 # Chromium looks for these in its folder
327 # See media_posix.cc and base_paths_linux.cc
328 dosym /usr/$(get_libdir)/libavcodec.so.52 "${CHROMIUM_HOME}" || die
329 dosym /usr/$(get_libdir)/libavformat.so.52 "${CHROMIUM_HOME}" || die
330 dosym /usr/$(get_libdir)/libavutil.so.50 "${CHROMIUM_HOME}" || die
331
332 # Install icon and desktop entry.
333 newicon out/Release/product_logo_48.png ${PN}-browser.png || die
334 dosym "${CHROMIUM_HOME}/chromium-launcher.sh" /usr/bin/chromium || die
335 make_desktop_entry chromium "Chromium" ${PN}-browser "Network;WebBrowser" \
336 "MimeType=text/html;text/xml;application/xhtml+xml;"
337 sed -e "/^Exec/s/$/ %U/" -i "${D}"/usr/share/applications/*.desktop || die
338
339 # Install GNOME default application entry (bug #303100).
340 if use gnome; then
341 dodir /usr/share/gnome-control-center/default-apps || die
342 insinto /usr/share/gnome-control-center/default-apps
343 doins "${FILESDIR}"/chromium.xml || die
344 fi
345 }

  ViewVC Help
Powered by ViewVC 1.1.20