| 1 |
# Copyright 1999-2010 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/www-client/chromium/chromium-6.0.472.22.ebuild,v 1.1 2010/08/06 03:08:12 phajdan.jr Exp $ |
| 4 |
|
| 5 |
EAPI="2" |
| 6 |
|
| 7 |
inherit eutils flag-o-matic multilib pax-utils toolchain-funcs |
| 8 |
|
| 9 |
DESCRIPTION="Open-source version of Google Chrome web browser" |
| 10 |
HOMEPAGE="http://chromium.org/" |
| 11 |
SRC_URI="http://build.chromium.org/buildbot/official/${P}.tar.bz2" |
| 12 |
|
| 13 |
LICENSE="BSD" |
| 14 |
SLOT="0" |
| 15 |
KEYWORDS="~amd64 ~arm ~x86" |
| 16 |
IUSE="cups gnome sse2" |
| 17 |
|
| 18 |
RDEPEND="app-arch/bzip2 |
| 19 |
>=dev-libs/libevent-1.4.13 |
| 20 |
>=dev-libs/nss-3.12.3 |
| 21 |
>=gnome-base/gconf-2.24.0 |
| 22 |
gnome? ( >=gnome-base/gnome-keyring-2.28.2 ) |
| 23 |
>=media-libs/alsa-lib-1.0.19 |
| 24 |
media-libs/jpeg:0 |
| 25 |
media-libs/libpng |
| 26 |
media-video/ffmpeg[threads] |
| 27 |
cups? ( >=net-print/cups-1.4.4 ) |
| 28 |
sys-libs/zlib |
| 29 |
>=x11-libs/gtk+-2.14.7 |
| 30 |
x11-libs/libXScrnSaver" |
| 31 |
DEPEND="${RDEPEND} |
| 32 |
dev-lang/perl |
| 33 |
>=dev-util/gperf-3.0.3 |
| 34 |
>=dev-util/pkgconfig-0.23 |
| 35 |
>=gnome-base/gnome-keyring-2.28.2 |
| 36 |
sys-devel/flex" |
| 37 |
RDEPEND+=" |
| 38 |
|| ( |
| 39 |
x11-themes/gnome-icon-theme |
| 40 |
x11-themes/oxygen-molecule |
| 41 |
x11-themes/tango-icon-theme |
| 42 |
x11-themes/xfce4-icon-theme |
| 43 |
) |
| 44 |
x11-apps/xmessage |
| 45 |
x11-misc/xdg-utils |
| 46 |
virtual/ttf-fonts" |
| 47 |
|
| 48 |
get_chromium_home() { |
| 49 |
echo "/usr/$(get_libdir)/chromium-browser" |
| 50 |
} |
| 51 |
|
| 52 |
remove_bundled_lib() { |
| 53 |
einfo "Removing bundled library $1 ..." |
| 54 |
local out |
| 55 |
out="$(find $1 -mindepth 1 \! -iname '*.gyp' -print -delete)" \ |
| 56 |
|| die "failed to remove bundled library $1" |
| 57 |
if [[ -z $out ]]; then |
| 58 |
die "no files matched when removing bundled library $1" |
| 59 |
fi |
| 60 |
} |
| 61 |
|
| 62 |
src_prepare() { |
| 63 |
# Disable VP8 until we have a recent enough system-provided ffmpeg. |
| 64 |
epatch "${FILESDIR}"/${PN}-disable-vp8-r1.patch |
| 65 |
|
| 66 |
# Workaround for upstream bug http://crbug.com/50678. |
| 67 |
epatch "${FILESDIR}"/${PN}-ffmpeg-compatibility-r0.patch |
| 68 |
|
| 69 |
remove_bundled_lib "third_party/bzip2" |
| 70 |
remove_bundled_lib "third_party/codesighs" |
| 71 |
remove_bundled_lib "third_party/cros" |
| 72 |
remove_bundled_lib "third_party/jemalloc" |
| 73 |
remove_bundled_lib "third_party/lcov" |
| 74 |
remove_bundled_lib "third_party/libevent" |
| 75 |
remove_bundled_lib "third_party/libjpeg" |
| 76 |
remove_bundled_lib "third_party/libpng" |
| 77 |
remove_bundled_lib "third_party/libvpx" |
| 78 |
remove_bundled_lib "third_party/lzma_sdk" |
| 79 |
remove_bundled_lib "third_party/molokocacao" |
| 80 |
remove_bundled_lib "third_party/ocmock" |
| 81 |
remove_bundled_lib "third_party/py" |
| 82 |
remove_bundled_lib "third_party/pyftpdlib" |
| 83 |
remove_bundled_lib "third_party/simplejson" |
| 84 |
remove_bundled_lib "third_party/tlslite" |
| 85 |
# TODO: also remove third_party/libxml and third_party/libxslt when |
| 86 |
# http://crbug.com/29333 is fixed. |
| 87 |
# TODO: also remove third_party/zlib. For now the compilation fails if we |
| 88 |
# remove it (minizip-related). |
| 89 |
} |
| 90 |
|
| 91 |
src_configure() { |
| 92 |
local myconf="" |
| 93 |
|
| 94 |
# Make it possible to build chromium on non-sse2 systems. |
| 95 |
if use sse2; then |
| 96 |
myconf="${myconf} -Ddisable_sse2=0" |
| 97 |
else |
| 98 |
myconf="${myconf} -Ddisable_sse2=1" |
| 99 |
fi |
| 100 |
|
| 101 |
# Use system-provided libraries. |
| 102 |
# TODO: use_system_libxml (http://crbug.com/29333). |
| 103 |
# TODO: use_system_sqlite (http://crbug.com/22208). |
| 104 |
# TODO: use_system_icu, use_system_hunspell (upstream changes needed). |
| 105 |
# TODO: use_system_ssl when we have a recent enough system NSS. |
| 106 |
myconf="${myconf} |
| 107 |
-Duse_system_bzip2=1 |
| 108 |
-Duse_system_ffmpeg=1 |
| 109 |
-Duse_system_libevent=1 |
| 110 |
-Duse_system_libjpeg=1 |
| 111 |
-Duse_system_libpng=1 |
| 112 |
-Duse_system_zlib=1" |
| 113 |
|
| 114 |
# The system-provided ffmpeg supports more codecs. Enable them in chromium. |
| 115 |
myconf="${myconf} -Dproprietary_codecs=1" |
| 116 |
|
| 117 |
# The dependency on cups is optional, see bug #324105. |
| 118 |
if use cups; then |
| 119 |
myconf="${myconf} -Duse_cups=1" |
| 120 |
else |
| 121 |
myconf="${myconf} -Duse_cups=0" |
| 122 |
fi |
| 123 |
|
| 124 |
if use gnome; then |
| 125 |
myconf="${myconf} -Dlinux_link_gnome_keyring=1" |
| 126 |
else |
| 127 |
# TODO: we should also disable code trying to dlopen |
| 128 |
# gnome-keyring in that case. |
| 129 |
myconf="${myconf} -Dlinux_link_gnome_keyring=0" |
| 130 |
fi |
| 131 |
|
| 132 |
# Enable sandbox. |
| 133 |
myconf="${myconf} |
| 134 |
-Dlinux_sandbox_path=$(get_chromium_home)/chrome_sandbox |
| 135 |
-Dlinux_sandbox_chrome_path=$(get_chromium_home)/chrome" |
| 136 |
|
| 137 |
# Disable the V8 snapshot. It breaks the build on hardened (bug #301880), |
| 138 |
# and the performance gain isn't worth it. |
| 139 |
myconf="${myconf} -Dv8_use_snapshot=0" |
| 140 |
|
| 141 |
# Disable tcmalloc memory allocator. It causes problems, |
| 142 |
# for example bug #320419. |
| 143 |
myconf="${myconf} -Dlinux_use_tcmalloc=0" |
| 144 |
|
| 145 |
# Disable gpu rendering, it is incompatible with nvidia-drivers, |
| 146 |
# bug #319331. |
| 147 |
myconf="${myconf} -Denable_gpu=0" |
| 148 |
|
| 149 |
# Use target arch detection logic from bug #296917. |
| 150 |
local myarch="$ABI" |
| 151 |
[[ $myarch = "" ]] && myarch="$ARCH" |
| 152 |
|
| 153 |
if [[ $myarch = amd64 ]] ; then |
| 154 |
myconf="${myconf} -Dtarget_arch=x64" |
| 155 |
elif [[ $myarch = x86 ]] ; then |
| 156 |
myconf="${myconf} -Dtarget_arch=ia32" |
| 157 |
elif [[ $myarch = arm ]] ; then |
| 158 |
# TODO: check this again after |
| 159 |
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39509 is fixed. |
| 160 |
append-flags -fno-tree-sink |
| 161 |
|
| 162 |
myconf="${myconf} -Dtarget_arch=arm -Ddisable_nacl=1 -Dlinux_use_tcmalloc=0" |
| 163 |
else |
| 164 |
die "Failed to determine target arch, got '$myarch'." |
| 165 |
fi |
| 166 |
|
| 167 |
if [[ "$(gcc-major-version)$(gcc-minor-version)" == "44" ]]; then |
| 168 |
myconf="${myconf} -Dno_strict_aliasing=1 -Dgcc_version=44" |
| 169 |
fi |
| 170 |
|
| 171 |
# Make sure that -Werror doesn't get added to CFLAGS by the build system. |
| 172 |
# Depending on GCC version the warnings are different and we don't want |
| 173 |
# the build to fail because of that. |
| 174 |
myconf="${myconf} -Dwerror=" |
| 175 |
|
| 176 |
build/gyp_chromium -f make build/all.gyp ${myconf} --depth=. || die "gyp failed" |
| 177 |
} |
| 178 |
|
| 179 |
src_compile() { |
| 180 |
emake -r V=1 chrome chrome_sandbox BUILDTYPE=Release \ |
| 181 |
rootdir="${S}" \ |
| 182 |
CC="$(tc-getCC)" \ |
| 183 |
CXX="$(tc-getCXX)" \ |
| 184 |
AR="$(tc-getAR)" \ |
| 185 |
RANLIB="$(tc-getRANLIB)" \ |
| 186 |
|| die "compilation failed" |
| 187 |
} |
| 188 |
|
| 189 |
src_install() { |
| 190 |
dodir "$(get_chromium_home)" |
| 191 |
|
| 192 |
exeinto "$(get_chromium_home)" |
| 193 |
pax-mark m out/Release/chrome |
| 194 |
doexe out/Release/chrome |
| 195 |
doexe out/Release/chrome_sandbox |
| 196 |
fperms 4755 "$(get_chromium_home)/chrome_sandbox" |
| 197 |
doexe out/Release/xdg-settings |
| 198 |
doexe "${FILESDIR}"/chromium-launcher.sh |
| 199 |
|
| 200 |
insinto "$(get_chromium_home)" |
| 201 |
doins out/Release/chrome.pak || die "installing chrome.pak failed" |
| 202 |
doins out/Release/resources.pak || die "installing resources.pak failed" |
| 203 |
|
| 204 |
doins -r out/Release/locales |
| 205 |
doins -r out/Release/resources |
| 206 |
|
| 207 |
# chrome.1 is for chromium --help |
| 208 |
newman out/Release/chrome.1 chrome.1 |
| 209 |
newman out/Release/chrome.1 chromium.1 |
| 210 |
|
| 211 |
# Use system plugins by default. |
| 212 |
dosym /usr/$(get_libdir)/nsbrowser/plugins "$(get_chromium_home)/plugins" |
| 213 |
|
| 214 |
# Install icon and desktop entry. |
| 215 |
newicon out/Release/product_logo_48.png ${PN}-browser.png |
| 216 |
dosym "$(get_chromium_home)/chromium-launcher.sh" /usr/bin/chromium |
| 217 |
make_desktop_entry chromium "Chromium" ${PN}-browser "Network;WebBrowser" \ |
| 218 |
"MimeType=text/html;text/xml;application/xhtml+xml;" |
| 219 |
sed -e "/^Exec/s/$/ %U/" -i "${D}"/usr/share/applications/*.desktop \ |
| 220 |
|| die "desktop file sed failed" |
| 221 |
|
| 222 |
# Install GNOME default application entry (bug #303100). |
| 223 |
dodir /usr/share/gnome-control-center/default-apps |
| 224 |
insinto /usr/share/gnome-control-center/default-apps |
| 225 |
doins "${FILESDIR}"/chromium.xml |
| 226 |
} |