gtk/chromium/PKGBUILD
2017-02-10 20:59:12 +00:00

193 lines
7.2 KiB
Bash

# Contributions from Arch:
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Pierre Schmitz <pierre@archlinux.de>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
# Keys are the names in the above script; values are the dependencies in Chakra
declare -rgA _system_libs=(
[flac]=flac
[libjpeg]=libjpeg
[libpng]=libpng
[libvpx]=libvpx
[libwebp]=libwebp
#[libxml]=libxml2 # https://bugs.archlinux.org/task/29939
[libxslt]=libxslt
[snappy]=snappy
[yasm]=
)
pkgname=chromium
pkgver=56.0.2924.87
pkgrel=5
pkgdesc="The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser"
arch=('x86_64')
url="https://www.chromium.org/Home"
license=('BSD')
depends=('gtk2' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libexif' 'libgcrypt'
'ttf-font' 'systemd' 'dbus' 'libpulse' 'pciutils' 'desktop-file-utils' 'hicolor-icon-theme')
depends+=(${_system_libs[@]})
makedepends=('python2' 'gperf' 'yasm' 'mesa' 'ninja' 'git' 'gtk3' 'clang')
optdepends=('kwallet: for storing passwords in KWallet'
'kdialog: needed for file dialogs in KDE')
#install=chromium.install # We should drop it now.
source=(https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
chromium.desktop
chromium.sh
chromium-glibc-2.24.patch
chromium-system-ffmpeg-r4.patch
chromium-widevine.patch
template_url_prepopulate_data.diff
search_engine_type.diff
prepopulated_engines_json.diff)
sha256sums=('9aac081ffccaae6497068100477a4e6ac7086bd15ad3c3cd009b9a760b7a53e0'
'1a748951cd48c549f64740b2568158a60f8675002ceb2635d98059abadc5b8d1'
'3fd1c3fe7a3a5c5504f40aed4371071f4f482dc1ced640f6ce0eff5a03808584'
'6953651c002efe7fca8cda3143e963037ed38a0a4bc7ccb79304637c45340047'
'e3c474dbf3822a0be50695683bd8a2c9dfc82d41c1524a20b4581883c0c88986'
'd6fdcb922e5a7fbe15759d39ccc8ea4225821c44d98054ce0f23f9d1f00c9808'
'a62135bb6aa8269a1b7e9ce2afe6ca9c24d6b85e9880e3694370efa21e4739d6'
'7783404b2123a1c3c301ba9ba84d48294f7658efe71c10ab3e254e2da5220dbf'
'2b78e36cf1c45c2d5256f47af44cc00e67eeac1e7673a95f02d9468516ef7757')
# 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
# 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
# libwidevinecdm.so is not included, but can be copied over from Chrome
# (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
# Build fixes from Gentoo
patch -Np1 -i ../chromium-system-ffmpeg-r4.patch
patch -Np1 -i ../chromium-glibc-2.24.patch
# Work around bug in blink in which GCC 6 optimizes away null pointer checks
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833524
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68853#c2
sed -i '/config("compiler")/ a cflags_cc = [ "-fno-delete-null-pointer-checks" ]' \
build/config/linux/BUILD.gn
# Use Python 2
find . -name '*.py' -exec sed -i -r 's|/usr/bin/python$|&2|g' {} +
# There are still a lot of relative calls which need a workaround
mkdir -p "$srcdir/python2-path"
ln -sf /usr/bin/python2 "$srcdir/python2-path/python"
# Remove bundled libraries for which we will use the system copies; this
# *should* do what the remove_bundled_libraries.py script does, with the
# added benefit of not having to list all the remaining libraries
local _lib
for _lib in ${!_system_libs[@]} ${_system_libs[libjpeg]+libjpeg_turbo}; do
find -type f -path "*third_party/$_lib/*" \
\! -path "*third_party/$_lib/chromium/*" \
\! -path "*third_party/$_lib/google/*" \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete
done
python2 build/linux/unbundle/replace_gn_files.py \
--system-libraries "${!_system_libs[@]}"
python2 third_party/libaddressinput/chromium/tools/update-strings.py
}
build() {
cd "$srcdir/$pkgname-$pkgver"
export PATH="$srcdir/python2-path:$PATH"
export TMPDIR="$srcdir/temp"
export CC='/usr/bin/clang'
export CXX='/usr/bin/clang++'
mkdir -p "$TMPDIR"
local _flags=(
'is_clang=true'
'clang_base_path="/usr/"'
'symbol_level=1'
'clang_use_chrome_plugins=false'
'is_debug=false'
'fatal_linker_warnings=false'
'treat_warnings_as_errors=false'
'fieldtrial_testing_like_official_build=true'
'remove_webcore_debug_symbols=true'
'ffmpeg_branding="Chrome"'
'proprietary_codecs=true'
'link_pulseaudio=true'
'linux_use_bundled_binutils=false'
'use_allocator="none"'
'use_cups=true'
'use_gconf=false'
'use_gnome_keyring=false'
'use_gold=false'
'use_gtk3=false'
'use_kerberos=true'
'use_pulseaudio=true'
'use_sysroot=false'
'enable_hangout_services_extension=true'
'enable_widevine=true'
'enable_nacl=false'
'enable_nacl_nonsfi=false'
"google_api_key=\"${_google_api_key}\""
"google_default_client_id=\"${_google_default_client_id}\""
"google_default_client_secret=\"${_google_default_client_secret}\""
)
python2 tools/gn/bootstrap/bootstrap.py --gn-gen-args "${_flags[*]}"
out/Release/gn gen out/Release --args="${_flags[*]}" \
--script-executable=/usr/bin/python2
ninja -C out/Release chrome chrome_sandbox chromedriver widevinecdmadapter
}
package() {
cd "$srcdir/$pkgname-$pkgver"
install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
install -Dm644 out/Release/chrome.1 "$pkgdir/usr/share/man/man1/chromium.1"
install -Dm644 "$srcdir/chromium.desktop" \
"$pkgdir/usr/share/applications/chromium.desktop"
install -Dm4755 out/Release/chrome_sandbox \
"$pkgdir/usr/lib/chromium/chrome-sandbox"
cp -a out/Release/{*.pak,*.bin,chromedriver,libwidevinecdmadapter.so,icudtl.dat} \
out/Release/locales \
out/Release/gen/content/content_resources.pak \
"$pkgdir/usr/lib/chromium/"
install -D "$srcdir/chromium.sh" "$pkgdir/usr/bin/chromium"
ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver"
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 -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
}