aports/unstable/ungoogled-chromium/APKBUILD

447 lines
17 KiB
Plaintext

# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=ungoogled-chromium
pkgver=87.0.4280.88
pkgrel=0
_patchrel=1
pkgdesc="Chromium web browser with ungoogled-chromium patches"
url="https://github.com/Eloston/ungoogled-chromium"
arch="x86_64 aarch64" # x86: ./v8_context_snapshot_generator segfaults
# armv7: /usr/bin/ld: final link failed: memory exhausted when linking chrome
license="BSD-3-Clause"
depends="xdg-utils"
makedepends="
alsa-lib-dev
pulseaudio-dev
bash
binutils-gold
bison flex
bsd-compat-headers
bzip2-dev
cairo-dev
clang-dev
cups-dev
dbus-glib-dev
elfutils-dev
eudev-dev
ffmpeg-dev
findutils
flac-dev
freetype-dev
gnutls-dev
gperf
gtk+3.0-dev
gzip
harfbuzz-dev
hunspell-dev
hwids-usb
jpeg-dev
jsoncpp-dev
krb5-dev
libbsd-dev
libcap-dev
libevent-dev
libexif-dev
libgcrypt-dev
libgnome-keyring-dev
libjpeg-turbo-dev
libpng-dev
libusb-dev
libva-dev
libwebp-dev
libxcomposite-dev
libxcursor-dev
libxinerama-dev
libxml2-dev
libxrandr-dev
libxscrnsaver-dev
libxslt-dev
linux-headers
mesa-dev
minizip-dev
ninja
nodejs
nss-dev
openjdk8
opus-dev
pciutils-dev
perl
python2
re2-dev
snappy-dev
speex-dev
sqlite-dev
xcb-proto
xdg-utils
zlib-dev
py2-setuptools
"
# explicit depends for --headless
depends="eudev-libs ttf-opensans"
options="suid"
subpackages="$pkgname-chromedriver"
builddir="$srcdir"/"chromium-$pkgver"
source="https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
https://github.com/Eloston/ungoogled-chromium/archive/$pkgver-$_patchrel.tar.gz
pstables-2.8.h::https://git.savannah.gnu.org/cgit/freetype/freetype2.git/plain/src/psnames/pstables.h?h=VER-2-8
chromium-launcher.sh
chromium.conf
chromium.desktop
google-api.keys
default-pthread-stacksize.patch
musl-fixes.patch
musl-fixes-breakpad.patch
musl-hacks.patch
musl-libc++.patch
musl-sandbox.patch
no-execinfo.patch
no-mallinfo.patch
resolver.patch
swiftshader.patch
create-extra-view-redefinition.patch
chromium-use-alpine-target.patch
media-base.patch
musl-crashpad.patch
musl-v8-monotonic-pthread-cont_timedwait.patch
nasm.patch
gcc-fno-delete-null-pointer-checks.patch
gcc-arm.patch
aarch64-fixes.patch
elf-arm.patch
chromium-size_t-defined.patch
check-for-enable-accelerated-video-decode-on-Linux.patch
fix-invalid-end-iterator-usage-in-CookieMonster.patch
only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
xproto-fix-underflow-in-Fp1616ToDouble.patch
ungoogled-chromium-patches/core/bromite/disable-fetching-field-trials.patch
ungoogled-chromium-patches/core/chromium-upstream/remove-dead-reloc-in-nonalloc-LD-flags.patch
ungoogled-chromium-patches/core/debian/disable/unrar.patch
ungoogled-chromium-patches/core/inox-patchset/0001-fix-building-without-safebrowsing.patch
ungoogled-chromium-patches/core/inox-patchset/0003-disable-autofill-download-manager.patch
ungoogled-chromium-patches/core/inox-patchset/0005-disable-default-extensions.patch
ungoogled-chromium-patches/core/inox-patchset/0007-disable-web-resource-service.patch
ungoogled-chromium-patches/core/inox-patchset/0009-disable-google-ipv6-probes.patch
ungoogled-chromium-patches/core/inox-patchset/0015-disable-update-pings.patch
ungoogled-chromium-patches/core/inox-patchset/0017-disable-new-avatar-menu.patch
ungoogled-chromium-patches/core/inox-patchset/0021-disable-rlz.patch
ungoogled-chromium-patches/core/iridium-browser/all-add-trk-prefixes-to-possibly-evil-connections.patch
ungoogled-chromium-patches/core/iridium-browser/safe_browsing-disable-incident-reporting.patch
ungoogled-chromium-patches/core/iridium-browser/safe_browsing-disable-reporting-of-safebrowsing-over.patch
ungoogled-chromium-patches/core/ungoogled-chromium/block-requests.patch
ungoogled-chromium-patches/core/ungoogled-chromium/block-trk-and-subdomains.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-crash-reporter.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-domain-reliability.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-fonts-googleapis-references.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-gaia.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-gcm.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-google-host-detection.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-mei-preload.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-network-time-tracker.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-profile-avatar-downloading.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-signin.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-untraceable-urls.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-webrtc-log-uploader.patch
ungoogled-chromium-patches/core/ungoogled-chromium/disable-webstore-urls.patch
ungoogled-chromium-patches/core/ungoogled-chromium/fix-building-without-enabling-reporting.patch
ungoogled-chromium-patches/core/ungoogled-chromium/fix-building-without-one-click-signin.patch
ungoogled-chromium-patches/core/ungoogled-chromium/fix-building-without-safebrowsing.patch
ungoogled-chromium-patches/core/ungoogled-chromium/fix-learn-doubleclick-hsts.patch
ungoogled-chromium-patches/core/ungoogled-chromium/remove-unused-preferences-fields.patch
ungoogled-chromium-patches/core/ungoogled-chromium/replace-google-search-engine-with-nosearch.patch
ungoogled-chromium-patches/core/ungoogled-chromium/toggle-translation-via-switch.patch
ungoogled-chromium-patches/core/ungoogled-chromium/use-local-devtools-files.patch
ungoogled-chromium-patches/extra/debian/disable/android.patch
ungoogled-chromium-patches/extra/debian/disable/device-notifications.patch
ungoogled-chromium-patches/extra/debian/disable/fuzzers.patch
ungoogled-chromium-patches/extra/debian/disable/google-api-warning.patch
ungoogled-chromium-patches/extra/debian/disable/welcome-page.patch
ungoogled-chromium-patches/extra/debian/fixes/connection-message.patch
ungoogled-chromium-patches/extra/debian/gn/parallel.patch
ungoogled-chromium-patches/extra/inox-patchset/0006-modify-default-prefs.patch
ungoogled-chromium-patches/extra/inox-patchset/0008-restore-classic-ntp.patch
ungoogled-chromium-patches/extra/inox-patchset/0011-add-duckduckgo-search-engine.patch
ungoogled-chromium-patches/extra/inox-patchset/0013-disable-missing-key-warning.patch
ungoogled-chromium-patches/extra/inox-patchset/0016-chromium-sandbox-pie.patch
ungoogled-chromium-patches/extra/inox-patchset/0018-disable-first-run-behaviour.patch
ungoogled-chromium-patches/extra/inox-patchset/0019-disable-battery-status-service.patch
ungoogled-chromium-patches/extra/iridium-browser/Remove-EV-certificates.patch
ungoogled-chromium-patches/extra/iridium-browser/browser-disable-profile-auto-import-on-first-run.patch
ungoogled-chromium-patches/extra/iridium-browser/mime_util-force-text-x-suse-ymp-to-be-downloaded.patch
ungoogled-chromium-patches/extra/iridium-browser/net-cert-increase-default-key-length-for-newly-gener.patch
ungoogled-chromium-patches/extra/iridium-browser/prefs-always-prompt-for-download-directory-by-defaul.patch
ungoogled-chromium-patches/extra/iridium-browser/prefs-only-keep-cookies-until-exit.patch
ungoogled-chromium-patches/extra/iridium-browser/updater-disable-auto-update.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-components-ungoogled.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-for-bookmark-bar-ntp.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-stack-tabs.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-for-search-engine-collection.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-force-punycode-hostnames.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-for-pdf-plugin-name.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-for-omnibox-autocomplete-filtering.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-close-window-with-last-tab.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-configure-extension-downloading.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-disable-beforeunload.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-hide-crashed-bubble.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-scroll-tabs.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-flag-to-show-avatar-button.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-ipv6-probing-option.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/add-suggestions-url-field.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/disable-dial-repeating-discovery.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/disable-download-quarantine.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/disable-formatting-in-omnibox.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/disable-intranet-redirect-detector.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/disable-webgl-renderer-info.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/enable-default-prefetch-privacy-changes.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/enable-menu-on-reload-button.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/enable-page-saving-on-more-pages.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/enable-paste-and-go-new-tab-button.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/fix-building-without-mdns-and-service-discovery.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/popups-to-tabs.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/remove-disable-setuid-sandbox-as-bad-flag.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/remove-uneeded-ui.patch
ungoogled-chromium-patches/extra/ungoogled-chromium/searx.patch
ungoogled-chromium-patches/extra/bromite/fingerprinting-flags-client-rects-and-measuretext.patch
ungoogled-chromium-patches/extra/bromite/flag-fingerprinting-canvas-image-data-noise.patch
ungoogled-chromium-patches/extra/bromite/flag-max-connections-per-host.patch
ungoogled-chromium-patches/0001-fix-var-undefined.patch
ungoogled-chromium-patches/0002-dont-use-zip-analyzer.patch
"
# secfixes:
# 83.0.4103.116-r0:
# - CVE-2020-6505
# - CVE-2020-6506
# - CVE-2020-6507
# - CVE-2020-6509
# 72.0.3626.121-r0:
# - CVE-2019-5786
if [ -n "$DEBUG" ]; then
_buildtype=Debug
_is_debug=true
else
_buildtype=Release
_is_debug=false
fi
prepare() {
patch_args="-p0"
default_prepare
msg "Pruning binaries"
"$srcdir"/"ungoogled-chromium-$pkgver-$_patchrel"/utils/prune_binaries.py ./ "$srcdir"/"ungoogled-chromium-$pkgver-$_patchrel"/pruning.list
msg "Apply domain substitution"
"$srcdir"/"ungoogled-chromium-$pkgver-$_patchrel"/utils/domain_substitution.py apply -r "$srcdir"/"ungoogled-chromium-$pkgver-$_patchrel"/domain_regex.list -f "$srcdir"/"ungoogled-chromium-$pkgver-$_patchrel"/domain_substitution.list -c domainsubcache.tar.gz ./
# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
touch chrome/test/data/webui/i18n_process_css_test.html
# Use the file at run time instead of effectively compiling it in
sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' \
-i services/device/public/cpp/usb/BUILD.gn
mkdir -p third_party/node/linux/node-linux-x64/bin
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
# reusable system library settings
local use_system="
ffmpeg
flac
fontconfig
freetype
harfbuzz-ng
libdrm
libevent
libjpeg
libpng
libwebp
libxml
libxslt
opus
re2
snappy
"
for _lib in $use_system libjpeg_turbo; do
msg "Removing buildscripts for system provided $_lib"
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/libxml/*' \
\! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
\! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete
done
msg "Replacing gn files"
python2 build/linux/unbundle/replace_gn_files.py --system-libraries \
$use_system
third_party/libaddressinput/chromium/tools/update-strings.py
}
_gn_flags() {
echo $*
}
build() {
##############################################################
# Please dont use these keys outside of Alpine Linux project #
# You can create your own at: #
# http://www.chromium.org/developers/how-tos/api-keys #
##############################################################
msg "Bootstrapping GN"
local _c=$(_gn_flags is_clang=true \
use_sysroot=false \
treat_warnings_as_errors=false \
fatal_linker_warnings=false \
use_custom_libcxx=false \
use_gold=false \
use_allocator=\"none\" \
use_allocator_shim=false \
use_vaapi=true \
)
# AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \
python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "$_c"
msg "Configuring build"
_c=$(_gn_flags \
blink_symbol_level=0 \
clang_use_chrome_plugins=false \
enable_js_type_check=false \
custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \
enable_nacl_nonsfi=false \
enable_nacl=false \
enable_precompiled_headers=false \
fatal_linker_warnings=false \
ffmpeg_branding=\"Chrome\" \
fieldtrial_testing_like_official_build=true \
gold_path=\"/usr/bin/ld.gold\" \
host_toolchain=\"//build/toolchain/linux/unbundle:default\" \
icu_use_data_file=true \
is_clang=true \
is_component_build=false \
is_debug=$_is_debug \
is_desktop_linux=true \
safe_browsing_mode=0 \
enable_one_click_signin=false \
enable_reading_list=false \
enable_remoting=false \
enable_reporting=false \
use_official_google_api_keys=false \
proprietary_codecs=true \
symbol_level=0 \
treat_warnings_as_errors=false \
use_allocator_shim=false \
use_allocator=\"none\" \
use_cups=true \
use_custom_libcxx=false \
use_gnome_keyring=false \
use_gold=false \
use_lld=false \
use_pulseaudio=true \
use_sysroot=false \
use_system_harfbuzz=true \
)
AR="ar" CC="clang" CXX="clang++" LD="clang++" NM=/usr/bin/nm \
out/Release/gn gen out/$_buildtype --args="$_c $_ca"
# Make xcbgen available to ui/gfx/x/gen_xproto.py running under Python 2
ln -sf /usr/lib/python3.*/site-packages/xcbgen .
export PYTHONPATH="$PWD"
msg "Ninja turtles GO!"
# build mksnapshot
ninja -j ${JOBS} -C out/$_buildtype mksnapshot
ninja -j ${JOBS} -C out/$_buildtype v8_context_snapshot_generator
if [ "$CARCH" = "x86" ]; then
# x86 only - dependency issues compiling obj/chrome/browser/devtools/devtools/cast_handler.o
ninja -j ${JOBS} -C out/$_buildtype obj/chrome/common/media_router/mojom/media_router__generator.stamp
fi
# final link needs lots of file descriptors
ulimit -n 2048
# finish rest of the build
ninja -j ${JOBS} -C out/$_buildtype chrome chrome_sandbox chromedriver
}
package() {
cd out/$_buildtype
local bin pak
for bin in chrome chromedriver *.bin; do
install -Dm755 $bin "$pkgdir"/usr/lib/$pkgname/$bin
done
install -Dm755 swiftshader/libEGL.so "$pkgdir"/usr/lib/$pkgname/swiftshader/libEGL.so
install -Dm755 swiftshader/libGLESv2.so "$pkgdir"/usr/lib/$pkgname/swiftshader/libGLESv2.so
install -Dm4755 chrome_sandbox "$pkgdir"/usr/lib/$pkgname/chrome-sandbox
install -m644 icudtl.dat "$pkgdir"/usr/lib/$pkgname/icudtl.dat
install -Dm755 xdg-mime "$pkgdir"/usr/lib/$pkgname/xdg-mime
install -Dm755 xdg-settings "$pkgdir"/usr/lib/$pkgname/xdg-settings
for pak in *.pak; do
install -Dm644 $pak "$pkgdir"/usr/lib/$pkgname/$pak
done
install -Dm755 "$srcdir"/chromium-launcher.sh \
"$pkgdir"/usr/lib/$pkgname/chromium-launcher.sh
cp -a locales "$pkgdir"/usr/lib/$pkgname/
# It is important that we name the target "chromium-browser",
# xdg-utils expect it; bug #355517.
mkdir -p "$pkgdir"/usr/bin
cd "$pkgdir"/usr/bin
ln -sf /usr/lib/$pkgname/chromium-launcher.sh chromium-browser
ln -sf /usr/lib/$pkgname/chromedriver "$pkgdir"/usr/bin/
install -Dm644 "$srcdir"/chromium.conf \
"$pkgdir"/etc/chromium/chromium.conf
install -Dm644 "$srcdir"/chromium.desktop \
"$pkgdir"/usr/share/applications/chromium.desktop
cd "$builddir"
for size in 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
}
chromedriver() {
pkgdesc="WebDriver driver for the Chromium Browser"
mkdir -p "$subpkgdir"/usr/lib/$pkgname "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/lib/$pkgname/chromedriver \
"$subpkgdir"/usr/lib/$pkgname/
mv "$pkgdir"/usr/bin/chromedriver "$subpkgdir"/usr/bin
}