diff options
Diffstat (limited to 'chromium.spec')
-rw-r--r-- | chromium.spec | 1463 |
1 files changed, 1463 insertions, 0 deletions
diff --git a/chromium.spec b/chromium.spec new file mode 100644 index 0000000..abc3d6f --- /dev/null +++ b/chromium.spec @@ -0,0 +1,1463 @@ +%define _lto_cflags %{nil} +# enable | disable system build flags +# official builds have less debugging and go faster... but we have to shut some things off. +%global official_build 1 +%global enable_thin_lto 0 +# enable | disable bootstrap +# If this is 1, we enable bootstrap +%global bootstrap 0 +%global esbuild 1 +%global esbuild_version 0.19.11 + + +# set default numjobs for the koji build +%global numjobs %{_smp_build_ncpus} + +# Fancy build status, so we at least know, where we are.. +# %1 where +# %2 what +%global build_target() \ + export NINJA_STATUS="[%2:%f/%t] " ; \ + ninja -v -j %{numjobs} -C '%1' '%2' +# enable | disable headless client build +%global build_headless 1 +# enable|disable chrome-remote-desktop build +%global build_remoting 0 +%global system_nodejs 1 + +# enable | disable system brotli +# disable system brotli due to old system brotli +%global bundlebrotli 1 +# Chromium's fork of ICU is now something we can't unbundle. +# This is left here to ease the change if that ever switches. +%global bundleicu 1 +%global bundlere2 1 + +# The libxml_utils code depends on the specific bundled libxml checkout +# which is not compatible with the current code in the +# 2017-06-08. +%global bundlelibxml 0 +# openEuler's Python 2 stack is being removed, we use the bundled Python libraries +# This can be revisited once we upgrade to Python 3 +%global bundlepylibs 0 +%global bundlezlib 1 +%global use_qt 1 +# enable gtk3 by default +%global gtk3 1 + +%global bundleopus 1 +%global bundlelibusbx 1 +%global bundleharfbuzz 1 +%global bundlelibwebp 1 +%global bundlelibpng 1 +%global bundlelibjpeg 1 +%global bundlefreetype 1 +%global bundlelibdrm 1 +%global bundlefontconfig 1 +%global bundleffmpegfree 0 +%global bundlelibaom 1 +%global bundlevpx 1 +%global bundlezstd 0 + +%global use_vaapi 1 +%global use_v4l2_codec 0 +%global disable_bti 0 +%global enable_swiftshader 0 +# enable v4l2 and disable vaapi for aarch64 platform +%ifarch aarch64 +%global use_vaapi 0 +%global use_v4l2_codec 1 +%global optflags %(echo %{optflags} | sed 's/-mbranch-protection=standard /-mbranch-protection=pac-ret /') +# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=2239523 +# Disable BTI until this is fixed upstream. +%global disable_bti 1 +%endif + +%ifarch riscv64 +%global use_vaapi 0 +%global bundlevpx 0 +%endif + +%global python312 0 +# Seems like we might need this sometimes +# Practically, no. But it's here in case we do. +%global use_gold 0 +%global build_clear_key_cdm 0 +# Disabled because of Google, starting with Chromium 88. +%global userestrictedapikeys 0 +# openEuer does not currently provide an official Google API key. +%global useapikey 0 + +# Leave this alone, please. +%global builddir out/Release +%global headlessbuilddir out/Headless +%global remotingbuilddir out/Remoting + +# enable|disable debuginfo +%global enable_debug 0 +%if ! %{enable_debug} +%global debug_package %{nil} +%global debug_level 0 +%else +%global debug_level 1 +# workaround for the error empty file debugsource +%undefine _debugsource_packages +%endif + +# %%{nil} for Stable; -beta for Beta; -dev for Devel +# dash in -beta and -dev is intentional ! +%global chromium_channel %{nil} +%global chromium_menu_name Chromium +%global chromium_browser_channel chromium-browser%{chromium_channel} +%global chromium_path %{_libdir}/chromium-browser%{chromium_channel} +%global crd_path %{_libdir}/chrome-remote-desktop + +%global __provides_exclude_from ^(%{chromium_path}/.*\\.so|%{chromium_path}/.*\\.so.*)$ +%global __requires_exclude ^(%{chromium_path}/.*\\.so|%{chromium_path}/.*\\.so.*)$ + +# enable clang by default +%global clang 1 +# set correct toolchain +%if %{clang} +%global toolchain clang +%else +%global toolchain gcc +%endif + + + +### Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) +# Currently we do not provide API key unless somebody need this +%if %{useapikey} +%global api_key %nil +%else +%global api_key %nil +%endif +%global default_client_id %nil +%global default_client_secret %nil +%global chromoting_client_id %nil + +Name: chromium%{chromium_channel} +Version: 119.0.6045.159 +Release: 1 +Summary: A WebKit (Blink) powered web browser. +Url: http://www.chromium.org/Home +License: BSD-3-Clause AND LGPL-2.1-or-later AND Apache-2.0 AND IJG AND MIT AND GPL-2.0-or-later AND ISC AND OpenSSL AND (MPL-1.1 OR GPL-2.0-only OR LGPL-2.0-only) + +### Chromium Patches ### +Patch0: chromium-70.0.3538.67-sandbox-pie.patch +# Use /etc/chromium for initial_prefs +Patch1: chromium-115-initial_prefs-etc-path.patch +# system libusb +Patch2: chromium-119-system-libusb.patch +# Do not mangle zlib +Patch5: chromium-77.0.3865.75-no-zlib-mangle.patch +# Do not use unrar code, it is non-free +Patch6: chromium-119-norar.patch +# Try to load widevine from other places +Patch8: chromium-117-widevine-other-locations.patch +# Tell bootstrap.py to always use the version of Python we specify +Patch11: chromium-93.0.4577.63-py3-bootstrap.patch +# debian patch, disable font-test +Patch20: chromium-disable-font-tests.patch +# https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/chromium/files/chromium-unbundle-zlib.patch +Patch52: chromium-81.0.4044.92-unbundle-zlib.patch +# Fix headers to look for system paths when we are using system minizip +Patch61: chromium-119-system-minizip-header-fix.patch +# Fix issue where closure_compiler thinks java is only allowed in android builds +# https://bugs.chromium.org/p/chromium/issues/detail?id=1192875 +Patch65: chromium-91.0.4472.77-java-only-allowed-in-android-builds.patch +# Update rjsmin to 1.2.0 +Patch69: chromium-103.0.5060.53-update-rjsmin-to-1.2.0.patch +# Update six to 1.16.0 +Patch70: chromium-105.0.5195.52-python-six-1.16.0.patch +# Disable tests on remoting build +Patch82: chromium-98.0.4758.102-remoting-no-tests.patch +# patch for using system brotli +Patch89: chromium-116-system-brotli.patch +# disable GlobalMediaControlsCastStartStop to avoid crash +# when using the address bar media player button +Patch90: chromium-119-disable-GlobalMediaControlsCastStartStop.patch +# patch for using system opus +Patch91: chromium-108-system-opus.patch + +# need for old ffmpeg 5.x +Patch114: chromium-107-ffmpeg-5.x-duration.patch +# disable the check +Patch115: chromium-107-proprietary-codecs.patch +# drop av_stream_get_first_dts from internal ffmpeg +Patch116: chromium-119-ffmpeg-first_dts.patch +# fix tab crash with SIGTRAP error when using system ffmpeg +Patch117: chromium-118-sigtrap_system_ffmpeg.patch +# https://bugs.chromium.org/p/chromium/issues/detail?id=1325301 +# https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg121495.html + +# revert AV1 VAAPI video encode due to old libva on el9 +Patch130: chromium-119-revert-av1enc-el9.patch +# file conflict with old kernel on el8/el9 +Patch140: chromium-118-dma_buf_export_sync_file-conflict.patch + +Patch200: chromium-117-system-zstd.patch +# fixes for old clang version +# compiler build errors, no matching constructor for initialization +Patch300: chromium-119-no_matching_constructor.patch +Patch301: chromium-115-compiler-SkColor4f.patch +# workaround for clang bug, https://github.com/llvm/llvm-project/issues/57826 +Patch302: chromium-118-workaround_clang_bug-structured_binding.patch +# missing typename +Patch303: chromium-117-typename.patch +# error: invalid operands to binary expression +Patch304: chromium-117-string-convert.patch +# error: constexpr constructor's 3rd parameter type 'std::string' (aka 'basic_string<char>') is not a literal type +Patch305: chromium-119-constexpr.patch +Patch306: chromium-119-assert.patch +# not supported in old glibc < 2.30, error: fatal error: 'sys/ifunc.h' file not found +Patch307: chromium-118-arm64-memory_tagging.patch +# missing include header files +Patch310: chromium-119-missing-header-files.patch +# clang warnings +Patch311: chromium-115-clang-warnings.patch +# imp module is removed in python-3.12 +Patch312: chromium-118-python-3.12-deprecated.patch +# build error +Patch351: chromium-117-mnemonic-error.patch +# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=2239523 +# https://bugs.chromium.org/p/chromium/issues/detail?id=1145581#c60 +# Disable BTI until this is fixed upstream. +Patch352: chromium-117-workaround_for_crash_on_BTI_capable_system.patch +# upstream patches +Patch400: chromium-119-dont-redefine-ATSPI-version-macros.patch +# fix build error, nullptr_t without namespace std:: +Patch401: chromium-119-nullptr_t-without-namespace-std.patch +# workaround for buggy Nvidia drivers fail to return FDs for planes +# of a BO which had already an imported BO destroyed before. +Patch402: chromium-119-nvidia-use-separate-bo-to-verify-modifier.patch +# hide UseChromeOSDirectVideoDecoder flag on VA-API devices to avoid crashes +Patch403: chromium-119-hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices.patch + +Patch404: fix-headers-ldflags.patch + +Patch500: chromium-icu72-2.patch + +# RISC-V Support +Patch1001: riscv-base.patch +Patch1002: riscv-build.patch +Patch1003: riscv-sandbox.patch +Patch1004: riscv-angle.patch +Patch1005: riscv-dav1d.patch +Patch1006: riscv-swiftshader.patch + + +# Use chromium-latest.py to generate clean tarball from released build tarballs, found here: +# https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%%{version}.tar.xz +Source0: chromium-%{version}.tar.xz +Source2: chromium.conf +Source3: chromium-browser.sh +Source4: %{chromium_browser_channel}.desktop +Source5: chromium-browser.xml +Source6: chrome-remote-desktop@.service +Source7: master_preferences + +# esbuild binary +%if 0%{?esbuild} +Source101: https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-%{esbuild_version}.tgz +Source102: https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-%{esbuild_version}.tgz +Source103: https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-%{esbuild_version}.tgz +%endif + + +%if %{clang} +BuildRequires: clang +BuildRequires: clang-tools-extra +BuildRequires: llvm +BuildRequires: lld +%else +BuildRequires: gcc-c++ +BuildRequires: gcc +BuildRequires: binutils +%endif + +BuildRequires: libicu-devel +# build with system ffmpeg-free +%if ! %{bundleffmpegfree} +BuildRequires: pkgconfig(libavcodec) +BuildRequires: pkgconfig(libavfilter) +BuildRequires: pkgconfig(libavformat) +BuildRequires: pkgconfig(libavutil) +BuildRequires: ffmpeg-devel +%endif + +# build with system libaom +%if ! %{bundlelibaom} +BuildRequires: libaom-devel +%endif + +BuildRequires: alsa-lib-devel +BuildRequires: atk-devel +BuildRequires: bison +BuildRequires: cups-devel +BuildRequires: dbus-devel +BuildRequires: desktop-file-utils +BuildRequires: expat-devel +BuildRequires: flex +BuildRequires: fontconfig-devel +BuildRequires: glib2-devel +BuildRequires: glibc-devel +BuildRequires: gperf +BuildRequires: snappy-devel +BuildRequires: pkgconfig(dri) +BuildRequires: pkgconfig(epoxy) + +%if %{use_qt} +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Widgets) +%endif + +%if ! %{bundleharfbuzz} +BuildRequires: harfbuzz-devel >= 2.4.0 +%endif + +BuildRequires: libatomic +BuildRequires: libcap-devel +BuildRequires: libcurl-devel + +%if ! %{bundlelibdrm} +BuildRequires: libdrm-devel +%endif + +BuildRequires: libgcrypt-devel +BuildRequires: libudev-devel +BuildRequires: libuuid-devel +BuildRequires: libusb-devel +BuildRequires: libutempter-devel +BuildRequires: libXdamage-devel +BuildRequires: libXtst-devel +BuildRequires: xcb-proto +BuildRequires: mesa-libgbm-devel + +%if ! %{bundlezlib} +BuildRequires: pkgconfig(zlib) minizip-ng-devel +%endif + +%if %{system_nodejs} +BuildRequires: nodejs +%endif + +%if ! %{bootstrap} +BuildRequires: gn +%endif + +BuildRequires: nss-devel >= 3.26 +BuildRequires: pciutils-devel +BuildRequires: pulseaudio-libs-devel + +# For screen sharing on Wayland +BuildRequires: pkgconfig(libpipewire-0.3) +# for /usr/bin/appstream-util +BuildRequires: libappstream-glib + +%if %{bootstrap} +# gn needs these +BuildRequires: libstdc++-static +%endif + +# Tries to use system libs whenever it can. +BuildRequires: bzip2-devel +BuildRequires: dbus-glib-devel +# For eu-strip +BuildRequires: elfutils +BuildRequires: elfutils-libelf-devel +BuildRequires: flac-devel +BuildRequires: pkgconfig(libexif) + +BuildRequires: pkgconfig(flac++) +BuildRequires: pkgconfig(slang) +BuildRequires: pkgconfig(theora) +BuildRequires: pkgconfig(sqlite3) + +%if ! %{bundlefreetype} +BuildRequires: freetype-devel +%endif +BuildRequires: git +BuildRequires: hwdata +BuildRequires: kernel-headers +BuildRequires: libevent-devel +BuildRequires: libffi-devel +BuildRequires: fdupes + +%if ! %{bundlelibjpeg} +BuildRequires: libjpeg-devel +%endif + +%if ! %{bundlelibpng} +BuildRequires: libpng-devel +%endif + +BuildRequires: libudev-devel +%if ! %{bundlelibusbx} +Requires: libusbx >= 1.0.21-0.1.git448584a +BuildRequires: libusbx-devel >= 1.0.21-0.1.git448584a +%endif +%if %{use_vaapi} +BuildRequires: libva-devel +%endif + +%if ! %{bundlelibwebp} +BuildRequires: libwebp-devel +%endif + +%if ! %{bundlezstd} +BuildRequires: pkgconfig(libzstd) +%endif + +BuildRequires: libxslt-devel +BuildRequires: libxshmfence-devel + +BuildRequires: mesa-libGL-devel + +%if ! %{bundleopus} +BuildRequires: opus-devel +%endif + +BuildRequires: perl(Switch) +BuildRequires: python3 +BuildRequires: pkgconfig(gtk+-3.0) +BuildRequires: python3-devel +BuildRequires: python3-zipp +BuildRequires: python3-simplejson +BuildRequires: python3-importlib-metadata +BuildRequires: python3-six + +%if ! %{bundlepylibs} +BuildRequires: python3-beautifulsoup4 +BuildRequires: python3-html5lib +BuildRequires: python3-markupsafe +BuildRequires: python3-ply +BuildRequires: python3-jinja2 +%endif + +%if ! %{bundlere2} +Requires: re2 >= 20160401 +BuildRequires: re2-devel >= 20160401 +%endif + +%if ! %{bundlebrotli} +BuildRequires: brotli-devel +%endif + +BuildRequires: speech-dispatcher-devel +BuildRequires: yasm +BuildRequires: zlib-devel + +# remote desktop needs this +BuildRequires: pam-devel +BuildRequires: systemd + +# using the built from source version on aarch64 +BuildRequires: ninja-build + +# Yes, java is needed as well.. +%if %{build_headless} +BuildRequires: java-17-openjdk-headless +%endif + +BuildRequires: libevdev-devel + +BuildRequires: procps-ng + +# There is a hardcoded check for nss 3.26 in the chromium code (crypto/nss_util.cc) +Requires: nss%{_isa} >= 3.26 +Requires: nss-mdns%{_isa} + +# GTK modules it expects to find for some reason. +%if %{gtk3} +Requires: libcanberra-gtk3%{_isa} +%else +Requires: libcanberra-gtk2%{_isa} +%endif + +# This enables support for u2f tokens +Requires: u2f-hidraw-policy + +Requires: chromium-common%{_isa} = %{version}-%{release} + +ExclusiveArch: x86_64 aarch64 riscv64 + +# Bundled bits (I'm sure I've missed some) +Provides: bundled(angle) = 2422 +Provides: bundled(bintrees) = 1.0.1 +# This is a fork of openssl. +Provides: bundled(boringssl) + +%if %{bundlebrotli} +Provides: bundled(brotli) = 222564a95d9ab58865a096b8d9f7324ea5f2e03e +%endif + +Provides: bundled(bspatch) +Provides: bundled(cacheinvalidation) = 20150720 +Provides: bundled(colorama) = 799604a104 +Provides: bundled(crashpad) +Provides: bundled(dmg_fp) +Provides: bundled(expat) = 2.2.0 +Provides: bundled(fdmlibm) = 5.3 + +# Don't get too excited. MPEG and other legally problematic stuff is stripped out. +%if %{bundleffmpegfree} +Provides: bundled(ffmpeg) = 6.0 +%endif + +%if %{bundlelibaom} +Provides: bundled(libaom) +%endif + +Provides: bundled(fips181) = 2.2.3 + +%if %{bundlefontconfig} +Provides: bundled(fontconfig) = 2.12.6 +%endif + +%if %{bundlefreetype} +Provides: bundled(freetype) = 2.11.0git +%endif + +Provides: bundled(gperftools) = svn144 + +%if %{bundleharfbuzz} +Provides: bundled(harfbuzz) = 2.4.0 +%endif + +Provides: bundled(hunspell) = 1.6.0 +Provides: bundled(iccjpeg) + +%if %{bundleicu} +Provides: bundled(icu) +%endif + +Provides: bundled(kitchensink) = 1 +Provides: bundled(leveldb) = 1.20 +Provides: bundled(libaddressinput) = 0 + +%if %{bundlelibdrm} +Provides: bundled(libdrm) = 2.4.85 +%endif + +Provides: bundled(libevent) = 1.4.15 +Provides: bundled(libjingle) = 9564 + +%if %{bundlelibjpeg} +Provides: bundled(libjpeg-turbo) = 1.4.90 +%endif + +Provides: bundled(libphonenumber) = a4da30df63a097d67e3c429ead6790ad91d36cf4 + +%if %{bundlelibpng} +Provides: bundled(libpng) = 1.6.22 +%endif + +Provides: bundled(libsrtp) = 2cbd85085037dc7bf2eda48d4cf62e2829056e2d + +%if %{bundlelibusbx} +Provides: bundled(libusbx) = 1.0.17 +%endif + +Provides: bundled(libvpx) = 1.6.0 + +%if %{bundlelibwebp} +Provides: bundled(libwebp) = 0.6.0 +%endif + +%if %{bundlelibxml} +# Well, it's actually newer than 2.9.4 and has code in it that has been reverted upstream... but eh. +Provides: bundled(libxml) = 2.9.4 +%endif + +Provides: bundled(libXNVCtrl) = 302.17 +Provides: bundled(libyuv) = 1651 +Provides: bundled(lzma) = 15.14 +Provides: bundled(libudis86) = 1.7.1 +Provides: bundled(mesa) = 9.0.3 +Provides: bundled(NSBezierPath) = 1.0 +Provides: bundled(mozc) + +%if %{bundleopus} +Provides: bundled(opus) = 1.1.3 +%endif + +Provides: bundled(ots) = 8d70cffebbfa58f67a5c3ed0e9bc84dccdbc5bc0 +Provides: bundled(protobuf) = 3.0.0.beta.3 +Provides: bundled(qcms) = 4 + +%if %{bundlere2} +Provides: bundled(re2) +%endif + +Provides: bundled(sfntly) = 04740d2600193b14aa3ef24cd9fbb3d5996b9f77 +Provides: bundled(skia) +Provides: bundled(SMHasher) = 0 +Provides: bundled(snappy) = 1.1.4-head +Provides: bundled(speech-dispatcher) = 0.7.1 +Provides: bundled(sqlite) = 3.17patched +Provides: bundled(superfasthash) = 0 +Provides: bundled(talloc) = 2.0.1 +Provides: bundled(usrsctp) = 0 +Provides: bundled(v8) = 5.9.211.31 +Provides: bundled(webrtc) = 90usrsctp +Provides: bundled(woff2) = 445f541996fe8376f3976d35692fd2b9a6eedf2d +Provides: bundled(xdg-mime) +Provides: bundled(xdg-user-dirs) +%if %{bundlezlib} +Provides: bundled(zlib) +%endif + +# For selinux scriptlet +Requires(post): /usr/sbin/semanage +Requires(post): /usr/sbin/restorecon + +%description +Chromium is an open-source web browser, powered by WebKit (Blink). + +%package common +Summary: Files needed for both the headless_shell and full Chromium + +# -common doesn't have chrome-remote-desktop bits +# but we need to clean it up if it gets disabled again +# NOTE: Check obsoletes version to be sure it matches +%if ! %{build_remoting} +Provides: chrome-remote-desktop = %{version}-%{release} +Obsoletes: chrome-remote-desktop <= 81.0.4044.138 +%endif + +%description common +%{summary}. + +%if %{build_remoting} +%package -n chrome-remote-desktop +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +Requires: xorg-x11-server-Xvfb +Requires: python3-psutil +Requires: chromium-common%{_isa} = %{version}-%{release} +Summary: Remote desktop support for google-chrome & chromium + +%description -n chrome-remote-desktop +Remote desktop support for google-chrome & chromium. +%endif + +%package -n chromedriver +Summary: WebDriver for Google Chrome/Chromium +Requires: chromium-common%{_isa} = %{version}-%{release} + +%description -n chromedriver +WebDriver is an open source tool for automated testing of webapps across many +browsers. It provides capabilities for navigating to web pages, user input, +JavaScript execution, and more. ChromeDriver is a standalone server which +implements WebDriver's wire protocol for Chromium. It is being developed by +members of the Chromium and WebDriver teams. + +%package headless +Summary: A minimal headless shell built from Chromium +Requires: chromium-common%{_isa} = %{version}-%{release} + +%description headless +A minimal headless client built from Chromium. headless_shell is built +without support for alsa, cups, dbus, gconf, gio, kerberos, pulseaudio, or +udev. + +%prep +# download source0 +cd %{_sourcedir} +rm -f %{SOURCE0} +wget https://user-repo.openeuler.openatom.cn/lfs-tar/chromium/chromium-%{version}.tar.xz +cd - + +#%{__cat} %{SOURCE101} %{SOURCE102} %{SOURCE103} %{SOURCE104} %{SOURCE105} > %{SOURCE0} + +%setup -q -n chromium-%{version} + +### Chromium Patches ### +%patch -P0 -p1 -b .sandboxpie +%patch -P1 -p1 -b .etc +%patch -P2 -p1 -b .system-libusb +%patch -P5 -p1 -b .nozlibmangle +%patch -P6 -p1 -b .nounrar +%patch -P8 -p1 -b .widevine-other-locations +%patch -P11 -p1 -b .py3 +%patch -P20 -p1 -b .disable-font-test +%if ! %{bundlezlib} +%patch -P52 -p1 -b .unbundle-zlib +%patch -P61 -p1 -b .system-minizip +%endif +%patch -P65 -p1 -b .java-only-allowed +%patch -P69 -p1 -b .update-rjsmin-to-1.2.0 +%patch -P70 -p1 -b .update-six-to-1.16.0 +%patch -P82 -p1 -b .remoting-no-tests +%if ! %{bundlebrotli} +%patch -P89 -p1 -b .system-brotli +%endif +%patch -P90 -p1 -b .disable-GlobalMediaControlsCastStartStop +%if ! %{bundleopus} +%patch -P91 -p1 -b .system-opus +%endif +%if ! %{bundleffmpegfree} +%patch -P114 -p1 -b .ffmpeg-5.x-duration +%patch -P116 -p1 -b .first_dts +%patch -P115 -p1 -b .prop-codecs +%patch -P117 -p1 -b .sigtrap_system_ffmpeg +%endif +%patch -P140 -p1 -b .dma_buf_export_sync_file-conflict +%patch -P130 -p1 -b .revert-av1enc + +%if ! %{bundlezstd} +%patch -P200 -p1 -b .system-zstd +%endif + +%if %{clang} +%patch -P300 -p1 -b .no_matching_constructor +%patch -P301 -p1 -b .workaround_clang-SkColor4f +%patch -P302 -p1 -b .workaround_clang_bug-structured_binding +%patch -P303 -p1 -b .typename +%patch -P304 -p1 -b .string-convert +%patch -P305 -p1 -b .constexpr +%patch -P306 -p1 -b .assert +%endif + +%ifarch aarch64 +%patch -P307 -p1 -b .memory_tagging +%endif + +%patch -P310 -p1 -b .missing-header-files +%patch -P311 -p1 -b .clang-warnings + +%if 0%{?python312} +%patch -P312 -p1 -b .python-3.12-deprecated +%endif + +%patch -P351 -p1 -b .mnemonic-error + +%if %{disable_bti} +%patch -P352 -p1 -b .workaround_for_crash_on_BTI_capable_system +%endif + +%patch -P400 -p1 -R -b .revert-dont-redefine-ATSPI-version-macros +%patch -P401 -p1 -b .nullptr_t-without-namespace-std +%patch -P402 -p1 -b .nvidia-use-separate-bo-to-verify-modifiers +%patch -P403 -p1 -b .UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices +%patch -P404 -p1 -b .fix-headers-ldflags + +%patch -P500 -p1 -b .icu72-2 + +# riscv patch + +%patch -P1001 -p1 -b .riscv-base +%patch -P1002 -p1 -b .riscv-build +%patch -P1003 -p1 -b .riscv-sandbox +%patch -P1004 -p1 -b .riscv-angle +%patch -P1005 -p1 -b .riscv-dav1d +%patch -P1006 -p1 -b .riscv-swiftshader + +# Change shebang in all relevant files in this directory and all subdirectories +# See `man find` for how the `-exec command {} +` syntax works +find -type f \( -iname "*.py" \) -exec sed -i '1s=^#! */usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} + + +%if %{bundlelibusbx} +# no hackity hack hack +%else +# hackity hack hack +rm -rf third_party/libusb/src/libusb/libusb.h +# we _shouldn't need to do this, but it looks like we do. +cp -a %{_includedir}/libusb-1.0/libusb.h third_party/libusb/src/libusb/libusb.h +%endif + +# Hard code extra version +sed -i 's/getenv("CHROME_VERSION_EXTRA")/"openEuler Project"/' chrome/common/channel_info_posix.cc + +# Fix hardcoded path in remoting code +sed -i 's|/opt/google/chrome-remote-desktop|%{crd_path}|g' remoting/host/setup/daemon_controller_delegate_linux.cc + +# change moc to moc-qt5 for +sed -i 's|moc|moc-qt5|g' ui/qt/moc_wrapper.py + + +# Get rid of the bundled esbuild + + +%build +%if ! %{esbuild} + ln -sf %{_bindir}/esbuild third_party/devtools-frontend/src/third_party/esbuild/esbuild +%else + %ifarch x86_64 + tar -zxf %{SOURCE101} --directory %{_tmppath} + %endif + %ifarch aarch64 + tar -zxf %{SOURCE102} --directory %{_tmppath} + %endif + %ifarch riscv64 + tar -zxf %{SOURCE103} --directory %{_tmppath} + %endif + mv %{_tmppath}/package/bin/esbuild third_party/devtools-frontend/src/third_party/esbuild/esbuild +%endif + +#correct path for nodejs binary +mkdir -p third_party/node/linux/node-linux-x64/bin +ln -s %{_bindir}/node third_party/node/linux/node-linux-x64/bin/node + +# Get rid of the pre-built eu-strip binary, it is x86_64 and of mysterious origin +rm -rf buildtools/third_party/eu-strip/bin/eu-strip +# Replace it with a symlink to copy +ln -s %{_bindir}/eu-strip buildtools/third_party/eu-strip/bin/eu-strip + + +# python3 +mkdir -p $HOME/bin +export PYTHON=python3 +ln -sfn %{_bindir}/$PYTHON $HOME/bin/python +export PATH="$HOME/bin/:$PATH" + +# REDUCE DEBUG as it gets TOO large +ARCH_FLAGS="`echo %{optflags} | sed -e 's/^-g / /g' -e 's/ -g / /g' -e 's/ -g$//g'`" +export CXXFLAGS="${ARCH_FLAGS} -Wno-return-type" +# extra flags to reduce warnings that aren't very useful +export CXXFLAGS="${CXXFLAGS} -Wno-pedantic -Wno-unused-result -Wno-unused-function -Wno-unused-variable -Wno-deprecated-declarations" +# ignore warnings for minor mistakes that are too common +export CXXFLAGS="${CXXFLAGS} -Wno-return-type -Wno-parentheses -Wno-misleading-indentation" +# ignore warnings that are not supported well until gcc 8 +export CXXFLAGS="${CXXFLAGS} -Wno-attributes" +# ignore warnings due to gcc bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84055) +export CXXFLAGS="${CXXFLAGS} -Wno-ignored-attributes" +# ingore new gcc 8 warnings that aren't yet handled upstream +export CXXFLAGS="${CXXFLAGS} -Wno-address -Wno-dangling-else -D_GNU_SOURCE" +# for wayland +export CXXFLAGS="${CXXFLAGS} -I/usr/include/wayland -I/usr/include/libxkbcommon -I/usr/include/opus" + + +%if %{clang} +export CC=clang +export CXX=clang++ +export AR=llvm-ar +export NM=llvm-nm +export READELF=llvm-readelf +export LDFLAGS="${LDFLAGS} -Wl,--build-id=sha1" +export CXXFLAGS="${CXXFLAGS} -Wno-unused-command-line-argument -Wno-unknown-warning-option" +%define __strip /usr/bin/llvm-strip +%if 0%{?enable_thin_lto} +# reduce the threads for linking even more due to LTO eating ton of memory +_link_threads=$(((%{jobs} - 2))) +test "$_link_threads" -le 0 && _link_threads=1 +export LDFLAGS="-flto=$_link_threads --param lto-max-streaming-parallelism=1" +%endif +%else +export CC=gcc +export CXX=g++ +export AR=ar +export NM=nm +export READELF=readelf +%endif + +%ifarch aarch64 +%if %{clang} +export CXXFLAGS="${CXXFLAGS} -flax-vector-conversions=all" +%else +export CXXFLAGS="${CXXFLAGS} -flax-vector-conversions -fno-omit-frame-pointer" +%endif +%endif + +# Core defines are flags that are true for both the browser and headless. +CHROMIUM_CORE_GN_DEFINES="" +# using system toolchain +CHROMIUM_CORE_GN_DEFINES+=' custom_toolchain="//build/toolchain/linux/unbundle:default"' +CHROMIUM_CORE_GN_DEFINES+=' host_toolchain="//build/toolchain/linux/unbundle:default"' +CHROMIUM_CORE_GN_DEFINES+=' is_debug=false dcheck_always_on=false dcheck_is_configurable=false' +CHROMIUM_CORE_GN_DEFINES+=' use_goma=false' +CHROMIUM_CORE_GN_DEFINES+=' enable_nacl=false' +CHROMIUM_CORE_GN_DEFINES+=' system_libdir="%{_lib}"' + +%if %{official_build} +CHROMIUM_CORE_GN_DEFINES+=' is_official_build=true is_cfi=false chrome_pgo_phase=0 use_debug_fission=true' +sed -i 's|OFFICIAL_BUILD|GOOGLE_CHROME_BUILD|g' tools/generate_shim_headers/generate_shim_headers.py +%endif + +%if %{useapikey} +CHROMIUM_CORE_GN_DEFINES+=' google_api_key="%{api_key}"' +%endif + +%if %{clang} +CHROMIUM_CORE_GN_DEFINES+=' is_clang=true' +CHROMIUM_CORE_GN_DEFINES+=' clang_base_path="%{_prefix}"' +CHROMIUM_CORE_GN_DEFINES+=' clang_use_chrome_plugins=false' +CHROMIUM_CORE_GN_DEFINES+=' use_lld=true' +%if %{enable_thin_lto} +CHROMIUM_CORE_GN_DEFINES+=" use_thin_lto=true" +%else +CHROMIUM_CORE_GN_DEFINES+=" use_thin_lto=false" +%endif +%else +CHROMIUM_CORE_GN_DEFINES+=' is_clang=false' +CHROMIUM_CORE_GN_DEFINES+=' use_lld=false' +%endif + +# disable rust, it's only using for testing +CHROMIUM_CORE_GN_DEFINES+=' enable_rust=false' + +CHROMIUM_CORE_GN_DEFINES+=' use_sysroot=false disable_fieldtrial_testing_config=true rtc_enable_symbol_export=true' + +%if %{use_gold} +CHROMIUM_CORE_GN_DEFINES+=' use_gold=true' +%else +CHROMIUM_CORE_GN_DEFINES+=' use_gold=false' +%endif + +%ifarch x86_64 +CHROMIUM_CORE_GN_DEFINES+=' host_cpu="x64"' +%endif +%ifarch aarch64 +CHROMIUM_CORE_GN_DEFINES+=' host_cpu="arm64"' +%endif +%ifarch riscv64 +CHROMIUM_CORE_GN_DEFINES+=' host_cpu="riscv64"' +%endif + +%if ! %{bundleicu} +CHROMIUM_CORE_GN_DEFINES+=' icu_use_data_file=false' +%endif +CHROMIUM_CORE_GN_DEFINES+=' target_os="linux"' +CHROMIUM_CORE_GN_DEFINES+=' current_os="linux"' +CHROMIUM_CORE_GN_DEFINES+=' treat_warnings_as_errors=false' +CHROMIUM_CORE_GN_DEFINES+=' use_custom_libcxx=false' +CHROMIUM_CORE_GN_DEFINES+=' enable_iterator_debugging=false' +CHROMIUM_CORE_GN_DEFINES+=' enable_vr=false' +CHROMIUM_CORE_GN_DEFINES+=' build_dawn_tests=false enable_perfetto_unittests=false' +CHROMIUM_CORE_GN_DEFINES+=' disable_fieldtrial_testing_config=true' +CHROMIUM_CORE_GN_DEFINES+=' symbol_level=1' +CHROMIUM_CORE_GN_DEFINES+=' blink_symbol_level=%{debug_level} v8_symbol_level=%{debug_level}' +CHROMIUM_CORE_GN_DEFINES+=' blink_enable_generated_code_formatting=false' +CHROMIUM_CORE_GN_DEFINES+=' angle_has_histograms=false' +CHROMIUM_CORE_GN_DEFINES+=' optimize_webui=false' +CHROMIUM_CORE_GN_DEFINES+=' enable_reading_list=false' +CHROMIUM_CORE_GN_DEFINES+=' fatal_linker_warnings=false' +CHROMIUM_CORE_GN_DEFINES+=' use_allocator_shim=true' +CHROMIUM_CORE_GN_DEFINES+=' use_partition_alloc=true' +CHROMIUM_CORE_GN_DEFINES+=' use_unofficial_version_number=false' + +%if ! %{bundleharfbuzz} +CHROMIUM_CORE_GN_DEFINES+=" use_system_harfbuzz=true" +%endif + +%if ! %{bundlefreetype} +CHROMIUM_CORE_GN_DEFINES+=" use_system_freetype=true" +%endif + +%if 0%{?enable_swiftshader} +CHROMIUM_CORE_GN_DEFINES+=" use_swiftshader_with_subzero=true" +%endif + +export CHROMIUM_CORE_GN_DEFINES + +# browser gn defines +CHROMIUM_BROWSER_GN_DEFINES="" + +# if systemwide ffmpeg free is used, the proprietary codecs can be set to true to load the codecs from ffmpeg-free +# the codecs computation is passed to ffmpeg-free in this case +%if ! %{bundleffmpegfree} +CHROMIUM_BROWSER_GN_DEFINES+=' ffmpeg_branding="Chrome" proprietary_codecs=true is_component_ffmpeg=true enable_ffmpeg_video_decoders=true media_use_ffmpeg=true' +%else +CHROMIUM_BROWSER_GN_DEFINES+=' ffmpeg_branding="Chromium" proprietary_codecs=true is_component_ffmpeg=true enable_ffmpeg_video_decoders=true media_use_ffmpeg=true' +%endif +CHROMIUM_BROWSER_GN_DEFINES+=' media_use_openh264=false' +CHROMIUM_BROWSER_GN_DEFINES+=' rtc_use_h264=false' +CHROMIUM_BROWSER_GN_DEFINES+=' use_kerberos=true' + +%if %{use_qt} +CHROMIUM_BROWSER_GN_DEFINES+=' use_qt=true' +%else +CHROMIUM_BROWSER_GN_DEFINES+=' use_qt=false' +%endif + +CHROMIUM_BROWSER_GN_DEFINES+=' use_gio=true use_pulseaudio=true link_pulseaudio=true' +CHROMIUM_BROWSER_GN_DEFINES+=' enable_hangout_services_extension=true' +CHROMIUM_BROWSER_GN_DEFINES+=' use_aura=true' +CHROMIUM_BROWSER_GN_DEFINES+=' enable_widevine=true' + +%if %{use_vaapi} +CHROMIUM_BROWSER_GN_DEFINES+=' use_vaapi=true' +%else +CHROMIUM_BROWSER_GN_DEFINES+=' use_vaapi=false' +%endif + +%if %{use_v4l2_codec} +CHROMIUM_BROWSER_GN_DEFINES+=' use_v4l2_codec=true' +%endif + +CHROMIUM_BROWSER_GN_DEFINES+=' rtc_use_pipewire=true rtc_link_pipewire=true' +CHROMIUM_BROWSER_GN_DEFINES+=' use_system_libffi=true' +CHROMIUM_BROWSER_GN_DEFINES+=' use_cups=true' +CHROMIUM_BROWSER_GN_DEFINES+=' use_dbus=true' +export CHROMIUM_BROWSER_GN_DEFINES + +# headless gn defines +CHROMIUM_HEADLESS_GN_DEFINES="" +CHROMIUM_HEADLESS_GN_DEFINES+=' use_ozone=true ozone_auto_platforms=false ozone_platform="headless" ozone_platform_headless=true' +CHROMIUM_HEADLESS_GN_DEFINES+=' angle_enable_vulkan=true angle_enable_swiftshader=true headless_use_embedded_resources=false' +CHROMIUM_HEADLESS_GN_DEFINES+=' headless_use_prefs=false headless_use_policy=false' +CHROMIUM_HEADLESS_GN_DEFINES+=' v8_use_external_startup_data=false enable_print_preview=false enable_remoting=false' +CHROMIUM_HEADLESS_GN_DEFINES+=' use_alsa=false use_bluez=false use_cups=false use_dbus=false use_gio=false use_kerberos=false' +CHROMIUM_HEADLESS_GN_DEFINES+=' use_libpci=false use_pulseaudio=false use_udev=false rtc_use_pipewire=false' +CHROMIUM_HEADLESS_GN_DEFINES+=' v8_enable_lazy_source_positions=false use_glib=false use_gtk=false use_pangocairo=false' +CHROMIUM_HEADLESS_GN_DEFINES+=' use_qt=false is_component_build=false enable_ffmpeg_video_decoders=false media_use_ffmpeg=false' +CHROMIUM_HEADLESS_GN_DEFINES+=' media_use_libvpx=false proprietary_codecs=false' +export CHROMIUM_HEADLESS_GN_DEFINES + +build/linux/unbundle/replace_gn_files.py --system-libraries \ + libevent \ + snappy \ +%if ! %{bundlelibaom} + libaom \ +%endif +%if ! %{bundlezstd} + zstd \ +%endif +%if ! %{bundlebrotli} + brotli \ +%endif +%if ! %{bundlefontconfig} + fontconfig \ +%endif +%if ! %{bundleffmpegfree} + ffmpeg \ +%endif +%if ! %{bundlefreetype} + freetype \ +%endif +%if ! %{bundleharfbuzz} + harfbuzz-ng \ +%endif +%if ! %{bundleicu} + icu \ +%endif +%if ! %{bundlelibdrm} + libdrm \ +%endif +%if ! %{bundlelibjpeg} + libjpeg \ +%endif +%if ! %{bundlelibpng} + libpng \ +%endif +%if ! %{bundlelibusbx} + libusb \ +%endif +%if ! %{bundlelibwebp} + libwebp \ +%endif +%if ! %{bundlelibxml} + libxml \ +%endif + libxslt \ +%if ! %{bundleopus} + opus \ +%endif +%if ! %{bundlere2} + re2 \ +%endif +%if ! %{bundlezlib} + zlib \ +%endif + flac + +# Check that there is no system 'google' module, shadowing bundled ones: +if python3 -c 'import google ; print google.__path__' 2> /dev/null ; then \ + echo "Python 3 'google' module is defined, this will shadow modules of this build"; \ + exit 1 ; \ +fi + +%if %{bootstrap} +tools/gn/bootstrap/bootstrap.py --gn-gen-args="$CHROMIUM_CORE_GN_DEFINES $CHROMIUM_BROWSER_GN_DEFINES" +%else +mkdir -p %{builddir} && cp -a %{_bindir}/gn %{builddir}/ +%endif + +%{builddir}/gn --script-executable=python3 gen --args="$CHROMIUM_CORE_GN_DEFINES $CHROMIUM_BROWSER_GN_DEFINES" %{builddir} + +%if %{build_headless} +%{builddir}/gn --script-executable=python3 gen --args="$CHROMIUM_CORE_GN_DEFINES $CHROMIUM_HEADLESS_GN_DEFINES" %{headlessbuilddir} +%endif + +%if %{build_remoting} +%{builddir}/gn --script-executable=python3 gen --args="$CHROMIUM_CORE_GN_DEFINES $CHROMIUM_BROWSER_GN_DEFINES" %{remotingbuilddir} +%endif + +%if %{build_headless} +# Do headless first. +%build_target %{headlessbuilddir} headless_shell +%endif + +%build_target %{builddir} chrome +%build_target %{builddir} chrome_sandbox +%build_target %{builddir} chromedriver + +%if %{build_clear_key_cdm} +%build_target %{builddir} clear_key_cdm +%endif + +%build_target %{builddir} policy_templates + +%if %{build_remoting} +# remote client +# ninja -C ../%{builddir} -vvv remoting_me2me_host remoting_start_host remoting_it2me_native_messaging_host remoting_me2me_native_messaging_host remoting_native_messaging_manifests remoting_resources +%build_target %{remotingbuilddir} remoting_all +%endif + +%install +rm -rf %{buildroot} + +mkdir -p %{buildroot}%{_bindir} \ + %{buildroot}%{chromium_path}/locales \ + %{buildroot}%{_sysconfdir}/%{name} + +# install system wide chromium config +%ifnarch riscv64 +cp -a %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf +%endif +cp -a %{SOURCE3} %{buildroot}%{chromium_path}/%{chromium_browser_channel}.sh +chmod +x %{buildroot}%{chromium_path}/%{chromium_browser_channel}.sh + +%if ! %{use_vaapi} +# remove vaapi flags +echo "# system wide chromium flags" > %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf +%endif + +export BUILD_TARGET=`cat /etc/openEuler-release` +export CHROMIUM_PATH=%{chromium_path} +export CHROMIUM_BROWSER_CHANNEL=%{chromium_browser_channel} + +sed -i "s|@@BUILD_TARGET@@|$BUILD_TARGET|g" %{buildroot}%{chromium_path}/%{chromium_browser_channel}.sh +sed -i "s|@@CHROMIUM_PATH@@|$CHROMIUM_PATH|g" %{buildroot}%{chromium_path}/%{chromium_browser_channel}.sh +sed -i "s|@@CHROMIUM_BROWSER_CHANNEL@@|$CHROMIUM_BROWSER_CHANNEL|g" %{buildroot}%{chromium_path}/%{chromium_browser_channel}.sh + +%if "%{chromium_channel}" == "%{nil}" + sed -i "s|@@EXTRA_FLAGS@@||g" %{buildroot}%{chromium_path}/%{chromium_browser_channel}.sh +%else + # Enable debug outputs for beta and dev channels + export EXTRA_FLAGS="--enable-logging=stderr --v=2" + sed -i "s|@@EXTRA_FLAGS@@|$EXTRA_FLAGS|g" %{buildroot}%{chromium_path}/%{chromium_browser_channel}.sh +%endif + +ln -s ../..%{chromium_path}/%{chromium_browser_channel}.sh %{buildroot}%{_bindir}/%{chromium_browser_channel} +mkdir -p %{buildroot}%{_mandir}/man1/ + +pushd %{builddir} + cp -a chrom*.pak resources.pak icudtl.dat %{buildroot}%{chromium_path} + cp -a locales/*.pak %{buildroot}%{chromium_path}/locales/ + %ifarch x86_64 aarch64 riscv64 + cp -a libvk_swiftshader.so %{buildroot}%{chromium_path} + cp -a libvulkan.so.1 %{buildroot}%{chromium_path} + cp -a vk_swiftshader_icd.json %{buildroot}%{chromium_path} + %endif + cp -a chrome %{buildroot}%{chromium_path}/%{chromium_browser_channel} + cp -a chrome_sandbox %{buildroot}%{chromium_path}/chrome-sandbox + cp -a chrome_crashpad_handler %{buildroot}%{chromium_path}/chrome_crashpad_handler + cp -a ../../chrome/app/resources/manpage.1.in %{buildroot}%{_mandir}/man1/%{chromium_browser_channel}.1 + sed -i "s|@@PACKAGE@@|%{chromium_browser_channel}|g" %{buildroot}%{_mandir}/man1/%{chromium_browser_channel}.1 + sed -i "s|@@MENUNAME@@|%{chromium_menu_name}|g" %{buildroot}%{_mandir}/man1/%{chromium_browser_channel}.1 + + # V8 initial snapshots + # https://code.google.com/p/chromium/issues/detail?id=421063 + cp -a v8_context_snapshot.bin %{buildroot}%{chromium_path} + + # This is ANGLE, not to be confused with the similarly named files under swiftshader/ + cp -a libEGL.so libGLESv2.so %{buildroot}%{chromium_path} + + %if %{use_qt} + cp -a libqt5_shim.so %{buildroot}%{chromium_path} + %endif + + %if %{build_clear_key_cdm} + %ifarch x86_64 + cp -a ClearKeyCdm/_platform_specific/linux_x64/libclearkeycdm.so %{buildroot}%{chromium_path} + %endif + %ifarch aarch64 + cp -a ClearKeyCdm/_platform_specific/linux_arm64/libclearkeycdm.so %{buildroot}%{chromium_path} + %endif + %ifarch riscv64 + cp -a ClearKeyCdm/_platform_specific/linux_riscv64/libclearkeycdm.so %{buildroot}%{chromium_path} + %endif + %ifnarch x86_64 aarch64 riscv64 + cp -a libclearkeycdm.so %{buildroot}%{chromium_path} + %endif + %endif + + # chromedriver + cp -a chromedriver %{buildroot}%{chromium_path}/chromedriver + ln -s ../..%{chromium_path}/chromedriver %{buildroot}%{_bindir}/chromedriver + + %if %{build_remoting} + # Remote desktop bits + mkdir -p %{buildroot}%{crd_path} + %endif +popd + +%if %{build_remoting} + pushd %{remotingbuilddir} + # Hey, there is a library now. + cp -a libremoting_core.so %{buildroot}%{crd_path}/ + + # See remoting/host/installer/linux/Makefile for logic + mkdir -p %{buildroot}%{crd_path}/remoting_locales + cp -a remoting_native_messaging_host %{buildroot}%{crd_path}/native-messaging-host + cp -a remote_assistance_host %{buildroot}%{crd_path}/remote-assistance-host + cp -a remoting_locales/*.pak %{buildroot}%{crd_path}/remoting_locales/ + cp -a remoting_me2me_host %{buildroot}%{crd_path}/chrome-remote-desktop-host + cp -a remoting_start_host %{buildroot}%{crd_path}/start-host + cp -a remoting_user_session %{buildroot}%{crd_path}/user-session + chmod +s %{buildroot}%{crd_path}/user-session + + # chromium + mkdir -p %{buildroot}%{_sysconfdir}/chromium/native-messaging-hosts + # google-chrome + mkdir -p %{buildroot}%{_sysconfdir}/opt/chrome/ + cp -a remoting/* %{buildroot}%{_sysconfdir}/chromium/native-messaging-hosts/ + for i in %{buildroot}%{_sysconfdir}/chromium/native-messaging-hosts/*.json; do + sed -i 's|/opt/google/chrome-remote-desktop|%{crd_path}|g' $i + done + mkdir -p %{buildroot}%{_sysconfdir}/opt/chrome/native-messaging-hosts + pushd %{buildroot}%{_sysconfdir}/opt/chrome/native-messaging-hosts + for i in ../../../chromium/native-messaging-hosts/*; do + # rpm gets unhappy when we symlink here + cp -a $i . + done + popd + popd + + mkdir -p %{buildroot}/var/lib/chrome-remote-desktop + touch %{buildroot}/var/lib/chrome-remote-desktop/hashes + + mkdir -p %{buildroot}%{_sysconfdir}/pam.d/ + pushd %{buildroot}%{_sysconfdir}/pam.d/ + ln -s system-auth chrome-remote-desktop + popd + + cp -a remoting/host/linux/linux_me2me_host.py %{buildroot}%{crd_path}/chrome-remote-desktop + cp -a remoting/host/installer/linux/is-remoting-session %{buildroot}%{crd_path}/ + + mkdir -p %{buildroot}%{_unitdir} + cp -a %{SOURCE6} %{buildroot}%{_unitdir}/ + sed -i 's|@@CRD_PATH@@|%{crd_path}|g' %{buildroot}%{_unitdir}/chrome-remote-desktop@.service +%endif + +%if %{build_headless} + pushd %{headlessbuilddir} + cp -a headless_lib_data.pak headless_lib_strings.pak headless_shell %{buildroot}%{chromium_path} + popd +%endif + +# need to strip binaries explicitly when debug is disable +%if ! %{enable_debug} +pushd %{buildroot}%{chromium_path}/ +for f in *.so chrome_crashpad_handler chrome-sandbox chromium-browser headless_shell chromedriver chrome; do + [ -f $f ] && %{__strip} $f +done +popd +%endif + +# Add directories for policy management +mkdir -p %{buildroot}%{_sysconfdir}/chromium/policies/managed +mkdir -p %{buildroot}%{_sysconfdir}/chromium/policies/recommended + +cp -a out/Release/gen/chrome/app/policy/common/html/en-US/*.html . +cp -a out/Release/gen/chrome/app/policy/linux/examples/chrome.json . + +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/256x256/apps +cp -a chrome/app/theme/chromium/product_logo_256.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{chromium_browser_channel}.png +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/128x128/apps +cp -a chrome/app/theme/chromium/product_logo_128.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{chromium_browser_channel}.png +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/64x64/apps +cp -a chrome/app/theme/chromium/product_logo_64.png %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/%{chromium_browser_channel}.png +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/48x48/apps +cp -a chrome/app/theme/chromium/product_logo_48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{chromium_browser_channel}.png +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/24x24/apps +cp -a chrome/app/theme/chromium/product_logo_24.png %{buildroot}%{_datadir}/icons/hicolor/24x24/apps/%{chromium_browser_channel}.png + +# Install the master_preferences file +install -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/%{name}/ + +mkdir -p %{buildroot}%{_datadir}/applications/ +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE4} + +install -D -m0644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \ + ${RPM_BUILD_ROOT}%{_datadir}/metainfo/%{chromium_browser_channel}.appdata.xml +appstream-util validate-relax --nonet ${RPM_BUILD_ROOT}%{_datadir}/metainfo/%{chromium_browser_channel}.appdata.xml + +mkdir -p %{buildroot}%{_datadir}/gnome-control-center/default-apps/ +cp -a %{SOURCE5} %{buildroot}%{_datadir}/gnome-control-center/default-apps/ + + +%post +# Set SELinux labels - semanage itself will adjust the lib directory naming +# But only do it when selinux is enabled, otherwise, it gets noisy. +if selinuxenabled; then + semanage fcontext -a -t bin_t /usr/lib/%{chromium_browser_channel} &>/dev/null || : + semanage fcontext -a -t bin_t /usr/lib/%{chromium_browser_channel}/%{chromium_browser_channel}.sh &>/dev/null || : + semanage fcontext -a -t chrome_sandbox_exec_t /usr/lib/chrome-sandbox &>/dev/null || : + restorecon -R -v %{chromium_path}/%{chromium_browser_channel} &>/dev/null || : +fi + +%if %{build_remoting} +%pretrans -n chrome-remote-desktop -p <lua> +path = "/etc/opt/chrome/native-messaging-hosts" +st = posix.stat(path) +if st and st.type == "link" then + os.remove(path) +end +%endif + +%if %{build_remoting} +%pre -n chrome-remote-desktop +getent group chrome-remote-desktop >/dev/null || groupadd -r chrome-remote-desktop + +%post -n chrome-remote-desktop +%systemd_post chrome-remote-desktop@.service + +%preun -n chrome-remote-desktop +%systemd_preun chrome-remote-desktop@.service + +%postun -n chrome-remote-desktop +%systemd_postun_with_restart chrome-remote-desktop@.service +%endif + +%files +%doc chrome_policy_list.html *.json +%license LICENSE +%config(noreplace) %{_sysconfdir}/%{name}/chromium.conf +%config %{_sysconfdir}/%{name}/master_preferences +%config %{_sysconfdir}/%{name}/policies/ +%if %{build_remoting} +%exclude %{_sysconfdir}/%{name}/native-messaging-hosts/* +%endif +%{_bindir}/%{chromium_browser_channel} +%{chromium_path}/*.bin +%{chromium_path}/chrome_*.pak +%{chromium_path}/chrome_crashpad_handler +%{chromium_path}/resources.pak +%{chromium_path}/%{chromium_browser_channel} +%{chromium_path}/%{chromium_browser_channel}.sh +%attr(4755, root, root) %{chromium_path}/chrome-sandbox +%if %{use_qt} +%{chromium_path}/libqt5_shim.so +%endif +%{_mandir}/man1/%{chromium_browser_channel}.* +%{_datadir}/icons/hicolor/*/apps/%{chromium_browser_channel}.png +%{_datadir}/applications/*.desktop +%{_datadir}/metainfo/*.appdata.xml +%{_datadir}/gnome-control-center/default-apps/chromium-browser.xml + +%files common +%if %{build_clear_key_cdm} +%{chromium_path}/libclearkeycdm.so +%endif +%ifarch x86_64 aarch64 riscv64 +%{chromium_path}/libvk_swiftshader.so* +%{chromium_path}/libvulkan.so* +%{chromium_path}/vk_swiftshader_icd.json +%{chromium_path}/libEGL.so* +%{chromium_path}/libGLESv2.so* +%endif +%{chromium_path}/icudtl.dat +%dir %{chromium_path}/ +%dir %{chromium_path}/locales/ +%lang(af) %{chromium_path}/locales/af.pak +%lang(am) %{chromium_path}/locales/am.pak +%lang(ar) %{chromium_path}/locales/ar.pak +%lang(bg) %{chromium_path}/locales/bg.pak +%lang(bn) %{chromium_path}/locales/bn.pak +%lang(ca) %{chromium_path}/locales/ca.pak +%lang(cs) %{chromium_path}/locales/cs.pak +%lang(da) %{chromium_path}/locales/da.pak +%lang(de) %{chromium_path}/locales/de.pak +%lang(el) %{chromium_path}/locales/el.pak +%lang(en_GB) %{chromium_path}/locales/en-GB.pak +# Chromium _ALWAYS_ needs en-US.pak as a fallback +# This means we cannot apply the lang code here. +# Otherwise, it is filtered out on install. +%{chromium_path}/locales/en-US.pak +%lang(es) %{chromium_path}/locales/es.pak +%lang(es) %{chromium_path}/locales/es-419.pak +%lang(et) %{chromium_path}/locales/et.pak +%lang(fa) %{chromium_path}/locales/fa.pak +%lang(fi) %{chromium_path}/locales/fi.pak +%lang(fil) %{chromium_path}/locales/fil.pak +%lang(fr) %{chromium_path}/locales/fr.pak +%lang(gu) %{chromium_path}/locales/gu.pak +%lang(he) %{chromium_path}/locales/he.pak +%lang(hi) %{chromium_path}/locales/hi.pak +%lang(hr) %{chromium_path}/locales/hr.pak +%lang(hu) %{chromium_path}/locales/hu.pak +%lang(id) %{chromium_path}/locales/id.pak +%lang(it) %{chromium_path}/locales/it.pak +%lang(ja) %{chromium_path}/locales/ja.pak +%lang(kn) %{chromium_path}/locales/kn.pak +%lang(ko) %{chromium_path}/locales/ko.pak +%lang(lt) %{chromium_path}/locales/lt.pak +%lang(lv) %{chromium_path}/locales/lv.pak +%lang(ml) %{chromium_path}/locales/ml.pak +%lang(mr) %{chromium_path}/locales/mr.pak +%lang(ms) %{chromium_path}/locales/ms.pak +%lang(nb) %{chromium_path}/locales/nb.pak +%lang(nl) %{chromium_path}/locales/nl.pak +%lang(pl) %{chromium_path}/locales/pl.pak +%lang(pt_BR) %{chromium_path}/locales/pt-BR.pak +%lang(pt_PT) %{chromium_path}/locales/pt-PT.pak +%lang(ro) %{chromium_path}/locales/ro.pak +%lang(ru) %{chromium_path}/locales/ru.pak +%lang(sk) %{chromium_path}/locales/sk.pak +%lang(sl) %{chromium_path}/locales/sl.pak +%lang(sr) %{chromium_path}/locales/sr.pak +%lang(sv) %{chromium_path}/locales/sv.pak +%lang(sw) %{chromium_path}/locales/sw.pak +%lang(ta) %{chromium_path}/locales/ta.pak +%lang(te) %{chromium_path}/locales/te.pak +%lang(th) %{chromium_path}/locales/th.pak +%lang(tr) %{chromium_path}/locales/tr.pak +%lang(uk) %{chromium_path}/locales/uk.pak +%lang(ur) %{chromium_path}/locales/ur.pak +%lang(vi) %{chromium_path}/locales/vi.pak +%lang(zh_CN) %{chromium_path}/locales/zh-CN.pak +%lang(zh_TW) %{chromium_path}/locales/zh-TW.pak + +%if %{build_headless} +%files headless +%{chromium_path}/headless_shell +%{chromium_path}/headless_lib_data.pak +%{chromium_path}/headless_lib_strings.pak +%endif + +%if %{build_remoting} +%files -n chrome-remote-desktop +%{crd_path}/chrome-remote-desktop +%{crd_path}/chrome-remote-desktop-host +%{crd_path}/is-remoting-session +%{crd_path}/libremoting_core.so* +%{crd_path}/native-messaging-host +%{crd_path}/remote-assistance-host +%{_sysconfdir}/pam.d/chrome-remote-desktop +%{_sysconfdir}/chromium/native-messaging-hosts/* +%{_sysconfdir}/opt/chrome/ +%{crd_path}/remoting_locales/ +%{crd_path}/start-host +%{crd_path}/user-session +%{_unitdir}/chrome-remote-desktop@.service +/var/lib/chrome-remote-desktop/ +%endif + +%files -n chromedriver +%doc AUTHORS +%license LICENSE +%{_bindir}/chromedriver +%{chromium_path}/chromedriver + +%changelog +* Wed Mar 06 2024 misaka00251 <liuxin@iscas.ac.cn> - 119.0.6045.159-1 +- Upgrade to version 119 + +* Wed Dec 30 2020 Jeffery.Gao <gaojianxing@huawei.com> - 87.0.4280.88-1 +- Package init |