summaryrefslogtreecommitdiff
blob: eb672dec08fb3f52aba00688f819aa83347b41f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-client/chromium-bin/chromium-bin-9999.ebuild,v 1.41 2010/05/12 18:46:03 phajdan.jr Exp $

EAPI="2"
inherit eutils multilib portability

DESCRIPTION="Open-source version of Google Chrome web browser (binary version)"
HOMEPAGE="http://code.google.com/chromium/"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""
IUSE="+plugins-symlink"

DEPEND="app-arch/unzip"
RDEPEND="app-arch/bzip2
	gnome-base/gconf
	>=media-libs/alsa-lib-1.0.19
	<media-libs/jpeg-7
	=media-libs/libpng-1.2*
	>=sys-devel/gcc-4.2
	>=dev-libs/nspr-4.7
	>=dev-libs/nss-3.12.3
	sys-libs/zlib
	>=x11-libs/gtk+-2.14.7
	x11-libs/libXScrnSaver
	x11-misc/xdg-utils
	virtual/ttf-fonts
	|| (
		x11-themes/gnome-icon-theme
		x11-themes/tango-icon-theme
		x11-themes/xfce4-icon-theme
	)"

# Incompatible system plugins:
# www-plugins/gecko-mediaplayer, bug #309231.
RDEPEND+="
	plugins-symlink? (
		!www-plugins/gecko-mediaplayer[gnome]
	)"

S=${WORKDIR}

QA_EXECSTACK="opt/chromium.org/chrome-linux/chrome"

# Ogg/Theora/Vorbis-only FFmpeg binaries
QA_TEXTRELS="opt/chromium.org/chrome-linux/libffmpegsumo.so"
QA_PRESTRIPPED="opt/chromium.org/chrome-linux/libffmpegsumo.so"

pkg_setup() {
	if [[ "${ROOT}" == "/" ]]; then
		# Built with SSE2 enabled, so will fail on older processors
		if ! grep -q sse2 /proc/cpuinfo; then
			die "This binary requires SSE2 support, it will not work on older processors"
		fi

		# Prevent user problems like bug 299777.
		if ! grep -q /dev/shm <<< $(get_mounts); then
			eerror "You don't have tmpfs mounted at /dev/shm."
			eerror "${PN} isn't going to work in that configuration."
			eerror "Please uncomment the /dev/shm entry in /etc/fstab,"
			eerror "run 'mount /dev/shm' and try again."
			die "/dev/shm is not mounted"
		fi
		if [ `stat -c %a /dev/shm` -ne 1777 ]; then
			eerror "/dev/shm does not have correct permissions."
			eerror "${PN} isn't going to work in that configuration."
			eerror "Please run chmod 1777 /dev/shm and try again."
			die "/dev/shm has incorrect permissions"
		fi
	fi
}

src_unpack() {
	if use amd64; then
		arch_path="-64"
	fi
	LV=`curl --silent http://build.chromium.org/buildbot/snapshots/chromium-rel-linux${arch_path}/LATEST`
	elog "Installing/updating to version ${LV}"
	wget -c "http://build.chromium.org/buildbot/snapshots/chromium-rel-linux${arch_path}/${LV}/chrome-linux.zip" -O "${T}"/${PN}-${LV}.zip
	unzip -qo "${T}"/${PN}-${LV}.zip || die "Unpack failed"
	chmod -fR a+rX,u+w,g-w,o-w chrome-linux/ || die "chmod failed"
}

src_install() {
	declare CHROMIUM_HOME=/opt/chromium.org

	dodir ${CHROMIUM_HOME}
	cp -R chrome-linux/ "${D}"${CHROMIUM_HOME} || die "Unable to install chrome-linux folder"

	# Man page (rename to prevent collision with chromium)
	newman chrome-linux/chrome.1 chromium-bin.1
	rm "${D}"${CHROMIUM_HOME}/chrome-linux/chrome.1

	# Plugins symlink, optional wrt bug #301911
	if use plugins-symlink; then
		dosym /usr/$(get_libdir)/nsbrowser/plugins ${CHROMIUM_HOME}/chrome-linux/plugins
	fi

	# Create symlinks for needed libraries
	dodir ${CHROMIUM_HOME}/nss-nspr
	if has_version ">=dev-libs/nss-3.12.5-r1"; then
		NSS_DIR=/usr/$(get_libdir)
	else
		NSS_DIR=/usr/$(get_libdir)/nss
	fi
	if has_version ">=dev-libs/nspr-4.8.3-r2"; then
		NSPR_DIR=/usr/$(get_libdir)
	else
		NSPR_DIR=/usr/$(get_libdir)/nspr
	fi

	dosym ${NSPR_DIR}/libnspr4.so ${CHROMIUM_HOME}/nss-nspr/libnspr4.so.0d
	dosym ${NSPR_DIR}/libplc4.so ${CHROMIUM_HOME}/nss-nspr/libplc4.so.0d
	dosym ${NSPR_DIR}/libplds4.so ${CHROMIUM_HOME}/nss-nspr/libplds4.so.0d
	dosym ${NSS_DIR}/libnss3.so ${CHROMIUM_HOME}/nss-nspr/libnss3.so.1d
	dosym ${NSS_DIR}/libnssutil3.so ${CHROMIUM_HOME}/nss-nspr/libnssutil3.so.1d
	dosym ${NSS_DIR}/libsmime3.so ${CHROMIUM_HOME}/nss-nspr/libsmime3.so.1d
	dosym ${NSS_DIR}/libssl3.so ${CHROMIUM_HOME}/nss-nspr/libssl3.so.1d

	# Create chromium-bin wrapper
	make_wrapper chromium-bin ./chrome ${CHROMIUM_HOME}/chrome-linux ${CHROMIUM_HOME}/nss-nspr:${CHROMIUM_HOME}/chrome-linux
	newicon "${FILESDIR}"/chromium.png ${PN}.png
	make_desktop_entry chromium-bin "Chromium (bin)" ${PN} "Network;WebBrowser"
	sed -e "/^Exec/s/$/ %U/" -i "${D}"/usr/share/applications/*.desktop \
		|| die "desktop file sed failed"
}

pkg_postinst() {
	ewarn "This binary requires the C++ runtime from >=sys-devel/gcc-4.2"
	ewarn "If you get the \"version \`GLIBCXX_3.4.9' not found\" error message,"
	ewarn "switch your active gcc to a version >=4.2 with gcc-config"
	if [[ ${ROOT} != "/" ]]; then
		ewarn "This package will not work on processors without SSE2 instruction"
		ewarn "set support (Intel Pentium III/AMD Athlon or older)."
	fi
}