gtk/chromium/PKGBUILD
2015-12-21 22:28:39 +00:00

196 lines
7.1 KiB
Bash

pkgname=chromium
pkgver=47.0.2526.106
pkgrel=1
pkgdesc="The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser. Include PepperFlash and libpdf plugins"
arch=('x86_64')
url="http://www.chromium.org/"
license=('BSD')
depends=('gtk2' 'dbus-glib' 'nss' 'alsa-lib' 'xdg-utils' 'bzip2' 'libevent' 'libxss' 'libgcrypt'
'ttf-dejavu' 'dbus' 'desktop-file-utils' 'hicolor-icon-theme' 'systemd' 'speech-dispatcher'
'flac' 'opus' 'libxml2' 'libpulse' 'icu' 'zlib' 'harfbuzz' 'glib2' 'libexif' 'libxslt')
makedepends=('python2' 'perl' 'gperf' 'yasm' 'mesa' 'libgnome-keyring' 'elfutils' 'lib32-gcc-libs'
'subversion' 'ninja' 'clang')
optdepends=('pepperflashplugin: Pepper Flash plugin')
install=chromium.install
#backup=('etc/chromium/default') #not really needed beacuse we want to provide on chromium.default the pepperflash plugin, I keep it here as comment
source=(http://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${pkgver}.tar.xz
license.html::http://www.google.com/chrome/intl/en/eula_text.html
chromium.desktop
chromium.sh
chromium.default
template_url_prepopulate_data.diff
search_engine_type.diff
prepopulated_engines_json.diff
chromium-widevine.patch
0001-Add-FPDFAPIJPEG_-prefix-to-more-libjpeg-functions.patch)
sha1sums=('b646acc18bb7e0fea05aae0108abea5660dfde14'
'1ffba5152cb749300a016efec909b828eba9a64a'
'3ab45403f3e8ddfeeba6a5aee9f683d57883fb90'
'19eff765ec1316f4ae057d48919b2fdd6b3a5bea'
'51f172122f83825b64c58365620450865bbb879b'
'76e9844dd1357f75abf617114cc432009d7c6372'
'abeb1e424b35bbca954a5afea39418a5e198ac64'
'79fc829d740183d85fb147a3a44e572a8f304dbe'
'6e9f007005dabd1f254304abccfa39f3b8275eea'
'8327cf96c653af4c9a2e53d6b0ba17530389c970')
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for Chakra Linux use ONLY. For your own distribution, please
# get your own set of keys.
_google_api_key=AIzaSyA33sdKPff0x3KBByOhpzc1i7RS2A1mEpY
_google_default_client_id=3502044743.apps.googleusercontent.com
_google_default_client_secret=TPvjII_2SwZn_9Ic0kRKqjtG
prepare() {
cd "$srcdir/$pkgname-$pkgver"
# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
touch chrome/test/data/webui/i18n_process_css_test.html
# https://code.google.com/p/chromium/issues/detail?id=505226
patch -d third_party/pdfium -Np1 <../0001-Add-FPDFAPIJPEG_-prefix-to-more-libjpeg-functions.patch
# Set DDG as default search
patch -p1 -i "$srcdir/template_url_prepopulate_data.diff"
patch -p1 -i "$srcdir/search_engine_type.diff"
patch -p1 -i "$srcdir/prepopulated_engines_json.diff"
# Enable support for the Widevine CDM plugin
# The actual libraries are not included, but can be copied over from Chrome:
# libwidevinecdmadapter.so
# libwidevinecdm.so
# (Version string doesn't seem to matter so let's go with "Pinkie Pie")
sed "s/@WIDEVINE_VERSION@/Pinkie Pie/" ../chromium-widevine.patch |
patch -Np1
# Download NaCL toolchains
python2 build/download_nacl_toolchains.py \
--packages nacl_x86_newlib,pnacl_newlib,pnacl_translator \
sync --extract
}
build() {
cd "$srcdir/$pkgname-$pkgver"
# activate ninja compile method
export GYP_GENERATORS='ninja'
# CFLAGS are passed through release_extra_cflags below
export -n CFLAGS CXXFLAGS
# Build with clang as a temporary solution to startup crash with GCC 4.9
# https://code.google.com/p/chromium/issues/detail?id=412967
export CC=clang
export CXX=clang++
# NOTE
# -Dremove_webcore_debug_symbols=1 speed up the build by removing debug symbols for webkit
local _chromium_conf=(
-Dgoogle_api_key=$_google_api_key
-Dgoogle_default_client_id=$_google_default_client_id
-Dgoogle_default_client_secret=$_google_default_client_secret
-Dwerror=
-Dclang=1
-Dclang_use_chrome_plugins=0
-Dpython_ver=2.7
-Dlinux_link_libpci=1
-Dlinux_link_libspeechd=1
-Dlinux_link_pulseaudio=1
-Dlinux_strip_binary=1
-Dlinux_use_bundled_binutils=0
-Dlinux_use_bundled_gold=0
-Dlinux_use_gold_flags=0
-Dlogging_like_official_build=1
-Dtracing_like_official_build=1
-Dfieldtrial_testing_like_official_build=1
-Drelease_extra_cflags="$CFLAGS"
-Dlibspeechd_h_prefix=speech-dispatcher/
-Dffmpeg_branding=Chrome
-Dproprietary_codecs=1
-Dremove_webcore_debug_symbols=1
-Duse_system_bzip2=1
-Duse_system_flac=1
-Duse_system_ffmpeg=0
-Duse_system_harfbuzz=1
-Duse_system_icu=0
-Duse_system_libevent=1
-Duse_system_libjpeg=1
-Duse_system_libpng=1
-Duse_system_libvpx=0
-Duse_system_libxml=1
-Duse_system_opus=1
-Duse_system_snappy=0
-Duse_system_ssl=0
-Duse_system_xdg_utils=1
-Duse_system_yasm=1
-Duse_system_zlib=0
-Duse_system_v8=0
-Duse_mojo=0
-Duse_gconf=0
-Dtarget_arch=x64
-Dffmpeg_target_arch=x64
-Ddisable_nacl=0
-Ddisable_glibc=1
-Ddisable_pnacl=0
-Ddisable_newlib_untar=0
-Ddisable_fatal_linker_warnings=1
-Ddisable_sse2=1)
build/linux/unbundle/replace_gyp_files.py "${_chromium_conf[@]}"
#build/gyp_chromium -f make --depth=. "${_chromium_conf[@]}"
build/gyp_chromium build/all.gyp --depth=. "${_chromium_conf[@]}"
#make BUILDTYPE=Release chrome chrome_sandbox
# Build chrome base
ninja -C out/Release chrome
# Build the required SUID_SANDBOX helper
ninja -C out/Release chrome_sandbox
}
package() {
cd "$srcdir/$pkgname-$pkgver"
install -D out/Release/chrome ${pkgdir}/usr/lib/chromium/chromium
install -Dm4755 -o root -g root out/Release/chrome_sandbox \
"$pkgdir/usr/lib/chromium/chrome-sandbox"
cp out/Release/{*.pak,*.bin,nacl_helper{,_bootstrap}} \
out/Release/nacl_irt_*.nexe \
"$pkgdir/usr/lib/chromium/"
# Manually strip binaries so that 'nacl_irt_*.nexe' is left intact
strip $STRIP_BINARIES "$pkgdir/usr/lib/chromium/"{chromium,chrome-sandbox} \
"$pkgdir/usr/lib/chromium/"nacl_helper{,_bootstrap}
# strip $STRIP_SHARED "$pkgdir/usr/lib/chromium/libffmpegsumo.so"
# override command-line options
install -Dm644 "$srcdir/chromium.default" "$pkgdir/etc/chromium/default"
cp -a out/Release/locales out/Release/icudtl.dat "$pkgdir/usr/lib/chromium/"
find "$pkgdir/usr/lib/chromium/" -name '*.d' -type f -delete
install -Dm644 out/Release/chrome.1 "$pkgdir/usr/share/man/man1/chromium.1"
install -Dm644 "$srcdir/chromium.desktop" \
"$pkgdir/usr/share/applications/chromium.desktop"
for size in 22 24 48 64 128 256; do
install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
done
for size in 16 32; do
install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
done
install -D "$srcdir/chromium.sh" "$pkgdir/usr/bin/chromium"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
}