From ec9674ddde15610e2c2e9f9960121990dff110c2 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 10 Apr 2014 20:31:56 +0200
Subject: [PATCH] chromium: make this work again; install chromedriver.

---
 srcpkgs/chromium/template | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 6c9f30131c..a8dd40ed73 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 #See http://www.chromium.org/developers/calendar for the latest version
 version=34.0.1847.116
-revision=1
+revision=2
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Juan RP <xtraeme@gmail.com>"
 homepage="http://www.chromium.org/"
@@ -84,13 +84,16 @@ do_configure() {
 	# TODO: use_system_libusb (http://crbug.com/266149).
 	# TODO: use_system_ssl (http://crbug.com/58087).
 	# TODO: use_system_sqlite (http://crbug.com/22208).
+	#
+	# XXX xtraeme: broken currently
+	# -Duse_system_icu=1
+	# -Duse_system_protobuf=1
 	conf+="
 		-Dpython_ver=2.7
 		-Duse_system_v8=1
 		-Duse_system_bzip2=1
 		-Duse_system_flac=1
 		-Duse_system_harfbuzz=1
-		-Duse_system_icu=1
 		-Duse_system_jsoncpp=1
 		-Duse_system_libevent=1
 		-Duse_system_libjpeg=1
@@ -101,7 +104,6 @@ do_configure() {
 		-Duse_system_minizip=1
 		-Duse_system_nspr=1
 		-Duse_system_opus=1
-		-Duse_system_protobuf=1
 		-Duse_system_re2=1
 		-Duse_system_snappy=1
 		-Duse_system_speex=1
@@ -144,23 +146,35 @@ do_configure() {
 	# Save space by removing DLOG and DCHECK messages (about 6% reduction).
 	conf+=" -Dlogging_like_official_build=1"
 
+	if [ "$CROSS_BUILD" ]; then
+		case "${XBPS_TARGET_MACHINE}" in
+			arm*) arch="arm";;
+		esac
+		conf+=" -Dtarget_arch=${arch}"
+		export AR_host=ar
+		export CC_host=cc
+		export CXX_host=g++
+		export LD_host=ld
+	fi
+
 	build/linux/unbundle/replace_gyp_files.py ${conf}
 	build/gyp_chromium --depth=. -f make ${conf} -Drelease_extra_cflags="$CFLAGS"
 }
 
 do_build() {
-	make BUILDTYPE=Release ${makejobs} chrome chrome_sandbox
+	make BUILDTYPE=Release ${makejobs} chrome chrome_sandbox chromedriver
 }
 
 do_install() {
 	vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
+	vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
 	vinstall out/Release/chrome_sandbox 4755 usr/lib/${pkgname} chrome-sandbox
 
 	cp out/Release/{*.pak,libffmpegsumo.so,nacl_helper{,_bootstrap}} \
 		out/Release/{libppGoogleNaClPluginChrome.so,nacl_irt_*.nexe} \
 		${DESTDIR}/usr/lib/chromium
 
-	cp -a out/Release/locales ${DESTDIR}/usr/lib/chromium
+	cp -a out/Release/locales out/Release/icudtl.dat ${DESTDIR}/usr/lib/chromium
 
 	vinstall out/Release/chrome.1 644 usr/share/man/man1 chromium.1
 	vinstall ${FILESDIR}/chromium.desktop 644 usr/share/applications
@@ -176,4 +190,5 @@ do_install() {
 
 	vinstall ${FILESDIR}/chromium.sh 755 usr/bin chromium
 	vinstall LICENSE 644 usr/share/licenses/${pkgname}
+	ln -s /usr/lib/chromium/chromedriver ${DESTDIR}/usr/bin/chromedriver
 }