mirror of
https://gitdl.cn/https://github.com/chakralinux/gtk.git
synced 2025-02-03 08:47:14 +08:00
257 lines
9.4 KiB
Bash
257 lines
9.4 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=(
|
|
#[ffmpeg]=ffmpeg # https://crbug.com/731766
|
|
[flac]=flac
|
|
[fontconfig]=fontconfig
|
|
[freetype]=freetype2
|
|
[harfbuzz-ng]=harfbuzz-icu
|
|
[icu]=icu
|
|
[libdrm]=
|
|
[libjpeg]=libjpeg
|
|
#[libpng]=libpng # https://crbug.com/752403#c10
|
|
#[libvpx]=libvpx # https://bugs.gentoo.org/611394
|
|
[libwebp]=libwebp
|
|
#[libxml]=libxml2 # https://crbug.com/736026
|
|
[libxslt]=libxslt
|
|
[opus]=opus
|
|
[re2]=re2
|
|
[snappy]=snappy
|
|
[yasm]=
|
|
[zlib]=minizip
|
|
)
|
|
|
|
readonly _unwanted_bundled_libs=(
|
|
${!_system_libs[@]}
|
|
${_system_libs[libjpeg]+libjpeg_turbo}
|
|
)
|
|
|
|
pkgname=chromium
|
|
pkgver=66.0.3359.117
|
|
pkgrel=2
|
|
_launcher_ver=6
|
|
pkgdesc="A web browser built for speed, simplicity, and security"
|
|
arch=('x86_64')
|
|
url="https://www.chromium.org/Home"
|
|
license=('BSD')
|
|
depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
|
|
'ttf-font' 'systemd' 'dbus' 'libpulse' 'pciutils' 'json-glib'
|
|
'desktop-file-utils' 'hicolor-icon-theme')
|
|
depends+=(${_system_libs[@]})
|
|
makedepends=('python3' 'python2' 'gperf' 'yasm' 'mesa' 'ninja' 'nodejs' 'git' 'clang' 'lld')
|
|
optdepends=('pepperflashplugin: support for Flash content'
|
|
'kwallet: for storing passwords in KWallet'
|
|
'kdialog: needed for file dialogs in KDE')
|
|
install=chromium.install
|
|
source=(https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
|
|
chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
|
|
chromium-$pkgver.txt::https://chromium.googlesource.com/chromium/src/+/$pkgver?format=TEXT
|
|
https://pkgbuild.com/~foutrelis/sources/$pkgname/blink-tools-$pkgver.tar.gz
|
|
fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch
|
|
fix-frame-buttons-rendering-too-large-when-using-OSX.patch
|
|
chromium-skia-harmony.patch
|
|
chromium-widevine.patch)
|
|
noextract=(blink-tools-$pkgver.tar.gz)
|
|
sha256sums=('77c5a334644fdc303697b3864c9a6b709cee23ee384f4134308e820af4568ed6'
|
|
'04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
|
|
'bf9600489198c5a873ef7b12e8ba42e04c667a59b898592ad1b416f66df13d7e'
|
|
'922db9d6a69a22003caa72c507e1ccbf0c4ee2c254f00e243c97ca572bf1ec56'
|
|
'e3fb73b43bb8c69ff517e66b2cac73d6e759fd240003eb35598df9af442422fe'
|
|
'bd5e0e61df3f89172590801aea7c8ac75162c10c7fe83e262e96a14388d1633a'
|
|
'feca54ab09ac0fc9d0626770a6b899a6ac5a12173c7d0c1005bc3964ec83e7b3'
|
|
'd6fdcb922e5a7fbe15759d39ccc8ea4225821c44d98054ce0f23f9d1f00c9808')
|
|
|
|
# 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://crbug.com/832283
|
|
tar xfC ../blink-tools-$pkgver.tar.gz third_party/blink/tools/
|
|
|
|
# https://crbug.com/710701
|
|
local _chrome_build_hash=$(base64 -d ../chromium-$pkgver.txt |
|
|
grep -Po '^parent \K[0-9a-f]{40}$')
|
|
if [[ -z $_chrome_build_hash ]]; then
|
|
error "Unable to fetch Chrome build hash."
|
|
return 1
|
|
fi
|
|
echo "LASTCHANGE=$_chrome_build_hash-" >build/util/LASTCHANGE
|
|
|
|
# Allow building against system libraries in official builds
|
|
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
|
|
tools/generate_shim_headers/generate_shim_headers.py
|
|
|
|
# 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
|
|
|
|
# Work around broken screen sharing in Google Meet
|
|
# https://crbug.com/829916#c16
|
|
sed -i 's/"Chromium/"Chrome/' chrome/common/chrome_content_client_constants.cc
|
|
|
|
# https://crbug.com/822820
|
|
patch -Np1 -i ../fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch
|
|
|
|
# https://crbug.com/821881
|
|
patch -Np1 -i ../fix-frame-buttons-rendering-too-large-when-using-OSX.patch
|
|
|
|
# https://crbug.com/skia/6663#c10
|
|
patch -Np4 -i ../chromium-skia-harmony.patch
|
|
|
|
# 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 "$srcdir/python2-path"
|
|
ln -s /usr/bin/python2 "$srcdir/python2-path/python"
|
|
|
|
mkdir -p third_party/node/linux/node-linux-x64/bin
|
|
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
|
|
|
|
# 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 ${_unwanted_bundled_libs[@]}; do
|
|
find -type f -path "*third_party/$_lib/*" \
|
|
\! -path "*third_party/$_lib/chromium/*" \
|
|
\! -path "*third_party/$_lib/google/*" \
|
|
\! -path "*base/third_party/icu/*" \
|
|
\! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
|
|
\! -path './third_party/yasm/run_yasm.py' \
|
|
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
|
|
-delete
|
|
done
|
|
|
|
python2 build/linux/unbundle/replace_gn_files.py \
|
|
--system-libraries "${!_system_libs[@]}"
|
|
}
|
|
|
|
build() {
|
|
make -C chromium-launcher-$_launcher_ver
|
|
|
|
cd "$srcdir/$pkgname-$pkgver"
|
|
|
|
if check_buildoption ccache y; then
|
|
# Avoid falling back to preprocessor mode when sources contain time macros
|
|
export CCACHE_SLOPPINESS=time_macros
|
|
fi
|
|
|
|
export PATH="$srcdir/python2-path:$PATH"
|
|
export TMPDIR="$srcdir/temp"
|
|
mkdir -p "$TMPDIR"
|
|
|
|
export CC=clang
|
|
export CXX=clang++
|
|
export AR=ar
|
|
export NM=nm
|
|
|
|
local _flags=(
|
|
'custom_toolchain="//build/toolchain/linux/unbundle:default"'
|
|
'host_toolchain="//build/toolchain/linux/unbundle:default"'
|
|
'clang_use_chrome_plugins=false'
|
|
'is_official_build=true'
|
|
'is_debug=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'
|
|
'use_gnome_keyring=false'
|
|
'use_sysroot=false'
|
|
'linux_use_bundled_binutils=false'
|
|
'use_custom_libcxx=false'
|
|
'enable_hangout_services_extension=true'
|
|
'enable_widevine=true'
|
|
'enable_nacl=false'
|
|
'enable_swiftshader=false'
|
|
"google_api_key=\"${_google_api_key}\""
|
|
"google_default_client_id=\"${_google_default_client_id}\""
|
|
"google_default_client_secret=\"${_google_default_client_secret}\""
|
|
)
|
|
|
|
# Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
|
|
CFLAGS+=' -Wno-builtin-macro-redefined'
|
|
CXXFLAGS+=' -Wno-builtin-macro-redefined'
|
|
CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
|
|
|
|
if check_option strip y; then
|
|
_flags+=('symbol_level=0')
|
|
|
|
# Mimic exclude_unwind_tables=true
|
|
CFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables'
|
|
CXXFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables'
|
|
CPPFLAGS+=' -DNO_UNWIND_TABLES'
|
|
fi
|
|
|
|
python2 tools/gn/bootstrap/bootstrap.py -s --no-clean
|
|
out/Release/gn gen out/Release --args="${_flags[*]}" \
|
|
--script-executable=/usr/bin/python2
|
|
|
|
ninja -C out/Release chrome chrome_sandbox chromedriver widevinecdmadapter
|
|
}
|
|
|
|
package() {
|
|
cd chromium-launcher-$_launcher_ver
|
|
make PREFIX=/usr DESTDIR="$pkgdir" install
|
|
install -Dm644 LICENSE \
|
|
"$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
|
|
|
|
cd "$srcdir/$pkgname-$pkgver"
|
|
|
|
install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
|
|
install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
|
|
ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver"
|
|
|
|
install -Dm644 chrome/installer/linux/common/desktop.template \
|
|
"$pkgdir/usr/share/applications/chromium.desktop"
|
|
install -Dm644 chrome/app/resources/manpage.1.in \
|
|
"$pkgdir/usr/share/man/man1/chromium.1"
|
|
sed -i \
|
|
-e "s/@@MENUNAME@@/Chromium/g" \
|
|
-e "s/@@PACKAGE@@/chromium/g" \
|
|
-e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
|
|
"$pkgdir/usr/share/applications/chromium.desktop" \
|
|
"$pkgdir/usr/share/man/man1/chromium.1"
|
|
|
|
cp \
|
|
out/Release/{chrome_{100,200}_percent,resources}.pak \
|
|
out/Release/{*.bin,chromedriver,libwidevinecdmadapter.so} \
|
|
"$pkgdir/usr/lib/chromium/"
|
|
install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
|
|
|
|
if [[ -z ${_system_libs[icu]+set} ]]; then
|
|
cp out/Release/icudtl.dat "$pkgdir/usr/lib/chromium/"
|
|
fi
|
|
|
|
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"
|
|
}
|
|
|
|
|
|
# vim:set ts=2 sw=2 et:
|