diff options
author | CoprDistGit <infra@openeuler.org> | 2024-09-25 09:55:25 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2024-09-25 09:55:25 +0000 |
commit | 8fe37c454512853c40108c2c0d19c2d39d15af19 (patch) | |
tree | aefee73b38da5be91c6d7b3a2e1ba13848f41938 /chromium.spec | |
parent | 0dc651d979e28d3c6b3e380b056741946893de1d (diff) |
automatic import of chromiumopeneuler20.03
Diffstat (limited to 'chromium.spec')
-rw-r--r-- | chromium.spec | 942 |
1 files changed, 942 insertions, 0 deletions
diff --git a/chromium.spec b/chromium.spec new file mode 100644 index 0000000..751c2a0 --- /dev/null +++ b/chromium.spec @@ -0,0 +1,942 @@ +# No API key! +%global api_key %nil + +%define outputdir out +%define __provides_exclude ^lib.*\\.so.*$ + +%bcond_without clang +%bcond_with lto +%bcond_with gtk4 +%bcond_without qt +%ifarch x86_64 +%bcond_without swiftshader +%endif +%bcond_with system_harfbuzz +%bcond_with system_freetype +%bcond_with arm_bti +%bcond_with system_icu +%bcond_without pipewire +%bcond_without system_ffmpeg +%bcond_with system_zlib +%bcond_with system_vpx +%bcond_with system_avif +%bcond_with system_re2 +%bcond_with system_webp +%bcond_with system_zstd + +# Enable esbuild +%global esbuild 1 +# When will gn fix this? +# https://bugs.chromium.org/p/gn/issues/detail?id=360 +%global bootstrap 0 + +Name: chromium +Version: 125.0.6422.141 +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 + +# 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 +Source1: master_preferences +Source2: chrome-wrapper +Source3: chromium-symbolic.svg +Source4: INSTALL.sh + +# esbuild binary +%if 0%{?esbuild} +Source101: esbuild.tar.gz +%endif + +Patch0: chromium-libusb_interrupt_event_handler.patch +Patch2: chromium-master-prefs-path.patch +Patch3: fix_building_widevinecdm_with_chromium.patch +Patch6: gcc-enable-lto.patch +# Do not use unrar code, it is non-free +Patch7: chromium-norar.patch +Patch9: system-libdrm.patch +Patch10: chromium-disable-parallel-gold.patch +# other distro patchset +Patch15: chromium-125-compiler.patch +Patch40: chromium-91-java-only-allowed-in-android-builds.patch +Patch62: chromium-93-ffmpeg-4.4.patch +#Patch68: chromium-94-ffmpeg-roll.patch +Patch98: chromium-102-regex_pattern-array.patch +Patch202: chromium-prop-codecs.patch +Patch203: chromium-106-ffmpeg-duration.patch +Patch205: chromium-disable-GlobalMediaControlsCastStartStop.patch +Patch224: chromium-115-compiler-SkColor4f.patch +Patch240: chromium-117-string-convert.patch +Patch244: chromium-117-system-zstd.patch +Patch248: chromium-119-assert.patch +Patch250: chromium-120-emplace.patch +Patch254: chromium-125-emplace-struct.patch +Patch256: chromium-120-make_unique-struct.patch +Patch258: chromium-121-nullptr_t-without-namespace-std.patch +Patch261: chromium-121-rust-clang_lib.patch +Patch311: chromium-125-disable-FFmpegAllowLists.patch +Patch316: chromium-125-missing-header-files.patch +Patch317: chromium-125-no_matching_constructor.patch +Patch322: chromium-125-lp155-typename.patch +Patch324: chromium-122-workaround_clang_bug-structured_binding.patch +Patch326: chromium-123-stats-collector.patch +# error: no matching constructor for initialization of 'XMLDocumentParserScope' +# Please enable this patch if you build on openEuler version smaller than 24.03 +#Patch336: chromium-124-system-libxml.patch +Patch337: chromium-123-missing-QtGui.patch +Patch340: chromium-125-appservice-include.patch +Patch341: chromium-125-lens-include.patch +Patch342: chromium-125-mojo-bindings-include.patch +Patch343: chromium-125-no-vector-consts.patch +Patch345: chromium-125-vulkan-include.patch +Patch346: chromium-125-tabstrip-include.patch +Patch347: chromium-125-ninja.patch +Patch350: chromium-125-debian-bad-font-gc0000.patch +Patch351: chromium-125-debian-bad-font-gc000.patch +Patch352: chromium-125-debian-bad-font-gc00.patch +Patch353: chromium-125-debian-bad-font-gc0.patch +Patch354: chromium-125-debian-bad-font-gc11.patch +Patch355: chromium-125-debian-bad-font-gc1.patch +Patch356: chromium-125-debian-bad-font-gc2.patch +Patch357: chromium-125-debian-bad-font-gc3.patch + +# error: unknown type name 'size_t' +Patch358: chromium-124-size_t.patch +# webui_contents_wrapper.h:189:9: error: static assertion expression is not an integral constant expression +Patch359: chromium-125-assert.patch + +# Disable swiftshader on aarch64 +# ld.lld: error: undefined symbol: llvm::MCSymbolizer::~MCSymbolizer() +# >>> referenced by AArch64ExternalSymbolizer.cpp +# >>> obj/third_party/swiftshader/third_party/llvm-16.0/swiftshader_llvm_aarch64/AArch64ExternalSymbolizer.o:(llvm::AArch64ExternalSymbolizer::~AArch64ExternalSymbolizer()) +# >>> referenced by AArch64ExternalSymbolizer.cpp +# >>> obj/third_party/swiftshader/third_party/llvm-16.0/swiftshader_llvm_aarch64/AArch64ExternalSymbolizer.o:(vtable for llvm::AArch64ExternalSymbolizer) +# +# ld.lld: error: undefined symbol: llvm::MCExternalSymbolizer::tryAddingPcLoadReferenceComment(llvm::raw_ostream&, long, unsigned long) +# >>> referenced by AArch64ExternalSymbolizer.cpp +# >>> obj/third_party/swiftshader/third_party/llvm-16.0/swiftshader_llvm_aarch64/AArch64ExternalSymbolizer.o:(vtable for llvm::AArch64ExternalSymbolizer) +%ifarch aarch64 +Patch360: swiftshader.patch +Patch361: swiftshader-2.patch +%endif + +# RISC-V Support +Patch1000: riscv-build.patch +Patch1001: riscv-sandbox.patch +Patch1002: riscv-dav1d.patch +Patch1003: riscv-swiftshader.patch +Patch1005: riscv-cpuinfo.patch + +BuildRequires: SDL-devel +BuildRequires: bison +BuildRequires: cups-devel +BuildRequires: desktop-file-utils +BuildRequires: elfutils +BuildRequires: flex +BuildRequires: git +%if ! %{bootstrap} +BuildRequires: gn +%else +BuildRequires: libstdc++-static +%endif +BuildRequires: gperf +BuildRequires: hicolor-icon-theme +BuildRequires: golang +# Java used during build +BuildRequires: java-17-openjdk-headless +BuildRequires: libcap-devel +BuildRequires: libgcrypt-devel +BuildRequires: gsm-devel +BuildRequires: libjpeg-turbo-devel +BuildRequires: libpng-devel +BuildRequires: nasm +BuildRequires: ncurses-devel +BuildRequires: ninja-build >= 1.7.2 +BuildRequires: nodejs >= 8.0 +BuildRequires: pam-devel +BuildRequires: pkgconfig +BuildRequires: python3 +BuildRequires: python3-setuptools +BuildRequires: python3-six +BuildRequires: snappy-devel +BuildRequires: util-linux +BuildRequires: perl(Switch) +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(bzip2) +BuildRequires: pkgconfig(cairo) >= 1.6 +BuildRequires: pkgconfig(dbus-1) +BuildRequires: pkgconfig(dri) +BuildRequires: pkgconfig(expat) +BuildRequires: pkgconfig(flac++) +BuildRequires: pkgconfig(gbm) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(hunspell) +BuildRequires: pkgconfig(imlib2) +BuildRequires: pkgconfig(jack) +BuildRequires: pkgconfig(kadm-client) +BuildRequires: pkgconfig(kdb) +BuildRequires: pkgconfig(krb5) +BuildRequires: pkgconfig(libcrypto) +BuildRequires: pkgconfig(libcurl) +BuildRequires: pkgconfig(libdrm) +BuildRequires: pkgconfig(libelf) +BuildRequires: pkgconfig(libevdev) +BuildRequires: pkgconfig(libevent) +BuildRequires: pkgconfig(libexif) +BuildRequires: pkgconfig(libffi) +BuildRequires: pkgconfig(libpci) +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(libssl) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(libusb-1.0) +BuildRequires: pkgconfig(libva) +%if %{with system_webp} +BuildRequires: pkgconfig(libwebp) >= 0.4.0 +%endif +%if %{with system_zstd} +BuildRequires: pkgconfig(libzstd) +%endif +BuildRequires: pkgconfig(libxml-2.0) >= 2.9.5 +BuildRequires: pkgconfig(libxslt) +BuildRequires: pkgconfig(minizip) +BuildRequires: pkgconfig(nspr) >= 4.9.5 +BuildRequires: pkgconfig(nss) >= 3.26 +BuildRequires: pkgconfig(ogg) +BuildRequires: pkgconfig(openssl) +BuildRequires: pkgconfig(opus) >= 1.3.1 +BuildRequires: pkgconfig(python3) +BuildRequires: pkgconfig(slang) +BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(theora) >= 1.1 +BuildRequires: pkgconfig(vdpau) +BuildRequires: pkgconfig(vorbis) +BuildRequires: pkgconfig(wayland-client) +BuildRequires: pkgconfig(wayland-cursor) +BuildRequires: pkgconfig(wayland-scanner) +BuildRequires: pkgconfig(wayland-server) +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xcb-dri3) +BuildRequires: pkgconfig(xcb-proto) +BuildRequires: pkgconfig(xcomposite) +BuildRequires: pkgconfig(xcursor) +BuildRequires: pkgconfig(xdamage) +BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xfixes) +BuildRequires: pkgconfig(xi) +BuildRequires: pkgconfig(xkbcommon) >= 1.0.0 +BuildRequires: pkgconfig(xrandr) +BuildRequires: pkgconfig(xrender) +BuildRequires: pkgconfig(xscrnsaver) +BuildRequires: pkgconfig(xshmfence) +BuildRequires: pkgconfig(xt) +BuildRequires: pkgconfig(xtst) +BuildRequires: cargo +BuildRequires: rust +Requires: xdg-utils +Recommends: google-noto-emoji-fonts + +Conflicts: chromium-browser +Provides: %{name}-suid-helper = %{version} +Provides: chromium-browser = %{version} +Obsoletes: %{name}-suid-helper < %{version} +Obsoletes: chromium-browser < %{version} + +ExclusiveArch: x86_64 aarch64 riscv64 + +%if %{with pipewire} +BuildRequires: pkgconfig(libpipewire-0.3) +BuildRequires: pkgconfig(libspa-0.2) +%endif +%if %{with system_harfbuzz} +BuildRequires: pkgconfig(harfbuzz) > 2.3.0 +%endif +%if %{with system_icu} +BuildRequires: pkgconfig(icu-i18n) >= 67.0 +%endif +%if %{with system_vpx} +BuildRequires: pkgconfig(vpx) +%endif +%if %{with system_freetype} +BuildRequires: pkgconfig(freetype2) +%endif +%if %{with system_zlib} +BuildRequires: pkgconfig(zlib) +%endif +%if %{with gtk4} +BuildRequires: pkgconfig(atk-bridge-2.0) +BuildRequires: pkgconfig(gtk4) +%else +BuildRequires: pkgconfig(gtk+-3.0) +%endif +%if %{with qt} +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Widgets) +%endif +%if %{with system_ffmpeg} +BuildRequires: pkgconfig(libavcodec) +BuildRequires: pkgconfig(libavfilter) +BuildRequires: pkgconfig(libavformat) >= 58 +BuildRequires: pkgconfig(libavutil) +%endif +%if %{with system_avif} +#BuildRequires: pkgconfig(libavif) +#BuildRequires: pkgconfig(libyuv) +%endif +%if %{with system_re2} +BuildRequires: pkgconfig(re2) >= 11 +%endif +%if %{with clang} +BuildRequires: clang llvm lld +BuildRequires: libstdc++-devel libstdc++-static +BuildRequires: compiler-rt +%endif +%if %{without clang} +BuildRequires: gcc +BuildRequires: gcc-c++ +%endif + +%description +Chromium is an open-source web browser, powered by WebKit (Blink). + +%package -n chromedriver +Summary: WebDriver for Google Chrome/Chromium +Requires: %{name} = %{version} + +%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. + +%prep +# download source0 +cd %{_sourcedir} +rm -f %{SOURCE0} +wget -q 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} + +%autopatch -p1 + +# 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}=' {} + + +# Hard code extra version +sed -i 's/getenv("CHROME_VERSION_EXTRA")/"openEuler Project"/' chrome/common/channel_info_posix.cc + +%build +rm third_party/devtools-frontend/src/third_party/esbuild/esbuild +tar -xf %{SOURCE101} +pushd esbuild +gflags="-mod=vendor -gcflags=all='-N -l'" +GO_FLAGS="${gflags}" make +cp -a esbuild ../third_party/devtools-frontend/src/third_party/esbuild/esbuild +popd + +#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 + +# need for error: the option `Z` is only accepted on the nightly compiler +export RUSTC_BOOTSTRAP=1 + +# set rustc version +rustc_version="$(rustc --version | cut -d' ' -f2)" + +export RUSTFLAGS + +# python3 +mkdir -p $HOME/bin +export PYTHON=python3 +ln -sfn %{_bindir}/$PYTHON $HOME/bin/python +export PATH="$HOME/bin/:$PATH" + +# use alternative wrapper +rm chrome/installer/linux/common/wrapper +cp %{SOURCE2} chrome/installer/linux/common/wrapper + +# set clang version +#global clang_maj_ver %%(clang --version | sed -n 's/clang version //p' | cut -d. -f1) +#if %{?clang_maj_ver} >= 17 +# This is for >= 24.03 LTS, return example: 17 +clang_version="$(clang --version | sed -n 's/clang version //p' | cut -d. -f1)" +#else +# This is for < 24.03 LTS, return example: 17.0.6 +#clang_version="$(clang --version | awk '/clang version/{print $3}')" +#endif +clang_base_path="$(clang --version | grep InstalledDir | cut -d' ' -f2 | sed 's#/bin##')" + +# Remove bundled libs +keeplibs=( + base/third_party/cityhash + base/third_party/double_conversion + base/third_party/dynamic_annotations + base/third_party/icu + base/third_party/nspr + base/third_party/superfasthash + base/third_party/symbolize + base/third_party/valgrind + base/third_party/xdg_user_dirs + buildtools/third_party/eu-strip + buildtools/third_party/libc++ + buildtools/third_party/libc++abi + buildtools/third_party/libunwind + chrome/third_party/mozilla_security_manager + courgette/third_party + net/third_party/mozilla_security_manager + net/third_party/nss + net/third_party/quic + net/third_party/uri_template + third_party/abseil-cpp + third_party/angle + third_party/angle/src/common/third_party/xxhash + third_party/angle/src/third_party/ceval + third_party/angle/src/third_party/libXNVCtrl + third_party/angle/src/third_party/volk + third_party/anonymous_tokens + third_party/apple_apsl + third_party/axe-core + third_party/bidimapper + third_party/blink + third_party/boringssl + third_party/boringssl/src/third_party/fiat + third_party/breakpad + third_party/breakpad/breakpad/src/third_party/curl + third_party/brotli + third_party/catapult + third_party/catapult/common/py_vulcanize/third_party/rcssmin + third_party/catapult/common/py_vulcanize/third_party/rjsmin + third_party/catapult/third_party/beautifulsoup4 + third_party/catapult/third_party/html5lib-1.1/ + third_party/catapult/third_party/html5lib-python + third_party/catapult/third_party/polymer + third_party/catapult/third_party/six + third_party/catapult/tracing/third_party/d3 + third_party/catapult/tracing/third_party/gl-matrix + third_party/catapult/tracing/third_party/jpeg-js + third_party/catapult/tracing/third_party/jszip + third_party/catapult/tracing/third_party/mannwhitneyu + third_party/catapult/tracing/third_party/oboe + third_party/catapult/tracing/third_party/pako + third_party/ced + third_party/cld_3 + third_party/closure_compiler + third_party/content_analysis_sdk + third_party/cpuinfo + third_party/crashpad + third_party/crashpad/crashpad/third_party/lss + third_party/crashpad/crashpad/third_party/zlib + third_party/crc32c + third_party/cros_system_api + third_party/d3 + third_party/dav1d + third_party/dawn + third_party/dawn/third_party + third_party/depot_tools + third_party/devscripts + third_party/devtools-frontend + third_party/devtools-frontend/src/front_end/third_party + third_party/devtools-frontend/src/front_end/third_party/acorn + third_party/devtools-frontend/src/front_end/third_party/axe-core + third_party/devtools-frontend/src/front_end/third_party/chromium + third_party/devtools-frontend/src/front_end/third_party/codemirror + third_party/devtools-frontend/src/front_end/third_party/diff + third_party/devtools-frontend/src/front_end/third_party/i18n + third_party/devtools-frontend/src/front_end/third_party/intl-messageformat + third_party/devtools-frontend/src/front_end/third_party/lighthouse + third_party/devtools-frontend/src/front_end/third_party/lodash-isequal + third_party/devtools-frontend/src/front_end/third_party/marked + third_party/devtools-frontend/src/front_end/third_party/puppeteer + third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt + third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/rxjs + third_party/devtools-frontend/src/front_end/third_party/wasmparser + third_party/devtools-frontend/src/third_party + third_party/distributed_point_functions + third_party/dom_distiller_js + third_party/eigen3 + third_party/emoji-segmenter + third_party/farmhash + third_party/fdlibm + third_party/fft2d + third_party/flatbuffers + third_party/fp16 + third_party/fusejs/dist + third_party/fxdiv + third_party/gemmlowp + third_party/google_input_tools + third_party/google_input_tools/third_party/closure_library + third_party/google_input_tools/third_party/closure_library/third_party/closure + third_party/googletest + third_party/highway + third_party/hunspell + third_party/iccjpeg + third_party/inspector_protocol + third_party/ipcz + third_party/jinja2 + third_party/jsoncpp + third_party/jstemplate + third_party/khronos + third_party/lens_server_proto + third_party/leveldatabase + third_party/libaddressinput + third_party/libaom + third_party/libaom/source/libaom/third_party/fastfeat + third_party/libaom/source/libaom/third_party/SVT-AV1 + third_party/libaom/source/libaom/third_party/vector + third_party/libaom/source/libaom/third_party/x86inc + third_party/libgav1 + third_party/libjingle + third_party/libphonenumber + third_party/libsecret + third_party/libsrtp + third_party/libsync + third_party/libudev + third_party/liburlpattern + third_party/libva_protected_content + third_party/libwebm + third_party/libx11/src + third_party/libxcb-keysyms/keysyms + third_party/libxml/chromium + third_party/libzip + third_party/lit + third_party/lottie + third_party/lss + third_party/lzma_sdk + third_party/mako + third_party/maldoca + third_party/maldoca/src/third_party + third_party/markupsafe + third_party/material_color_utilities + third_party/mesa + third_party/metrics_proto + third_party/minigbm + third_party/modp_b64 + third_party/nasm + third_party/nearby + third_party/node + third_party/omnibox_proto + third_party/one_euro_filter + third_party/openscreen + third_party/openscreen/src/third_party/tinycbor/src/src + third_party/ots + third_party/pdfium + third_party/pdfium/third_party/agg23 + third_party/pdfium/third_party/bigint + third_party/pdfium/third_party/freetype + third_party/pdfium/third_party/lcms + third_party/pdfium/third_party/libopenjpeg + third_party/pdfium/third_party/libtiff + third_party/perfetto + third_party/perfetto/protos/third_party/chromium + third_party/pffft + third_party/ply + third_party/polymer + third_party/private-join-and-compute + third_party/private_membership + third_party/protobuf + third_party/pthreadpool + third_party/puffin + third_party/pyjson5 + third_party/pyyaml + third_party/qcms + third_party/rnnoise + third_party/rust + third_party/ruy + third_party/s2cellid + third_party/securemessage + third_party/selenium-atoms + third_party/shell-encryption + third_party/simplejson + third_party/skia + third_party/skia/include/third_party/vulkan/ + third_party/skia/third_party/vulkan + third_party/smhasher + third_party/sqlite + third_party/swiftshader + third_party/swiftshader/third_party/astc-encoder + third_party/swiftshader/third_party/llvm-10.0 + third_party/swiftshader/third_party/llvm-16.0 + third_party/swiftshader/third_party/llvm-subzero + third_party/swiftshader/third_party/marl + third_party/swiftshader/third_party/SPIRV-Headers + third_party/swiftshader/third_party/SPIRV-Tools + third_party/swiftshader/third_party/subzero + third_party/tensorflow_models + third_party/tensorflow-text + third_party/tflite + third_party/tflite/src/third_party/eigen3 + third_party/tflite/src/third_party/fft2d + third_party/tflite/src/third_party/xla/third_party/tsl + third_party/tflite/src/third_party/xla/xla/tsl/util + third_party/ukey2 + third_party/utf + third_party/vulkan + third_party/wayland + third_party/webdriver + third_party/webgpu-cts + third_party/webrtc + third_party/webrtc/common_audio/third_party/ooura + third_party/webrtc/common_audio/third_party/spl_sqrt_floor + third_party/webrtc/modules/third_party/fft + third_party/webrtc/modules/third_party/g711 + third_party/webrtc/modules/third_party/g722 + third_party/webrtc/rtc_base/third_party/base64 + third_party/webrtc/rtc_base/third_party/sigslot + third_party/widevine + third_party/woff2 + third_party/wuffs + third_party/x11proto + third_party/xcbproto + third_party/xnnpack + third_party/zlib/google + third_party/zxcvbn-cpp + url/third_party/mozilla + v8/src/third_party/siphash + v8/src/third_party/utf8-decoder + v8/src/third_party/valgrind + v8/third_party/glibc + v8/third_party/inspector_protocol + v8/third_party/v8/builtins + v8/third_party/v8/codegen +) + +%if ! %{with system_harfbuzz} +keeplibs+=( third_party/harfbuzz-ng ) +%endif +%if ! %{with system_freetype} +keeplibs+=( third_party/freetype ) +%endif +%if ! %{with system_icu} +keeplibs+=( third_party/icu ) +%endif +%if ! %{with system_ffmpeg} +keeplibs+=( third_party/ffmpeg ) +%endif +%if ! %{with system_zlib} +keeplibs+=( third_party/zlib ) +%endif +%if ! %{with system_vpx} +keeplibs+=( + third_party/libvpx + third_party/libvpx/source/libvpx/third_party/x86inc +) +%endif +%if !%{with system_avif} +keeplibs+=( third_party/libyuv ) +keeplibs+=( third_party/libavif ) +%endif +%if !%{with system_webp} || !%{with system_avif} +keeplibs+=( third_party/libwebp ) +%endif +keeplibs+=( + third_party/speech-dispatcher + third_party/usb_ids + third_party/xdg-utils +) +%if ! %{with system_re2} +keeplibs+=( third_party/re2 ) +%endif +%if ! %{with system_zlib} +keeplibs+=( third_party/zlib ) +%endif +keeplibs+=( third_party/lit ) +keeplibs+=( third_party/rust/chromium_crates_io ) +keeplibs+=( third_party/rust/cxx ) +%if ! %{with system_zstd} +keeplibs+=( third_party/zstd ) +%endif +build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove + +# GN sets lto on its own and we need just ldflag options, not cflags +%define _lto_cflags %{nil} +%undefine _debugsource_packages +%if %{with clang} +export CC=clang +export CXX=clang++ +export AR=llvm-ar +export NM=llvm-nm +export RANLIB=llvm-ranlib +%else +export CC=gcc +export CXX=g++ +export AR=ar +export NM=nm +export RANLIB=ranlib +%endif + +# 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 +# ignore warnings due to gcc bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84055) +export CXXFLAGS="${CXXFLAGS} -Wno-attributes -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" +export CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS} +# for wayland +export CXXFLAGS="${CXXFLAGS} -I/usr/include/wayland -I/usr/include/libxkbcommon -I/usr/include/opus" +%if %{with clang} +export LDFLAGS="${LDFLAGS} -Wl,--build-id=sha1" +export CXXFLAGS="${CXXFLAGS} -Wno-unused-command-line-argument -Wno-unknown-warning-option" +%endif +%ifarch aarch64 +%if %{without clang} +export CXXFLAGS="${CXXFLAGS} -flax-vector-conversions -fno-omit-frame-pointer" +%else +export CXXFLAGS="${CXXFLAGS} -flax-vector-conversions=all" +%endif +%endif +%if %{without clang} +export CXXFLAGS="${CXXFLAGS} -Wno-unused-but-set-variable -Wno-packed-not-aligned" +%endif +export CFLAGS="${CXXFLAGS}" +%if %{without clang} +export CXXFLAGS="${CXXFLAGS} -Wno-subobject-linkage -Wno-class-memaccess" +%endif +export CXXFLAGS="${CXXFLAGS} -Wno-invalid-offsetof -fpermissive" +%if %{with lto} && %{without clang} +# 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 + +# Set system libraries to be used +gn_system_libraries=( + flac + fontconfig + libdrm + libevent + libjpeg + libpng + libxslt + libusb + libxml + opus + snappy +) +%if %{with system_harfbuzz} +gn_system_libraries+=( harfbuzz-ng ) +%endif +%if %{with system_freetype} +gn_system_libraries+=( freetype ) +%endif +%if %{with system_icu} +gn_system_libraries+=( icu ) +%endif +%if %{with system_vpx} +gn_system_libraries+=( libvpx ) +%endif +%if %{with system_ffmpeg} +gn_system_libraries+=( ffmpeg ) +%endif +%if %{with system_re2} +gn_system_libraries+=( re2 ) +%endif +%if %{with system_webp} +gn_system_libraries+=( libwebp ) +%endif +%if %{with system_zlib} +gn_system_libraries+=( zlib ) +%endif +%if %{with system_zstd} +gn_system_libraries+=( zstd ) +%endif +build/linux/unbundle/replace_gn_files.py --system-libraries ${gn_system_libraries[@]} + +# Configuration for GN +# Available options: out/Release/gn args --list out/Release/ +gn_conf="" +gn_conf+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\"" +gn_conf+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\"" +gn_conf+=" use_custom_libcxx=false" +%ifarch x86_64 +gn_conf+=" host_cpu=\"x64\"" +%endif +%ifarch riscv64 +gn_conf+=" host_cpu=\"riscv64\"" +%endif +gn_conf+=" is_debug=false" +gn_conf+=" dcheck_always_on=false" +gn_conf+=" enable_nacl=false" +%if %{with swiftshader} +gn_conf+=" use_swiftshader_with_subzero=true" +%endif +%ifarch aarch64 +gn_conf+=" enable_swiftshader=false" +gn_conf+=" dawn_use_swiftshader=false" +%endif +gn_conf+=" is_component_ffmpeg=true" +gn_conf+=" use_cups=true" +gn_conf+=" use_aura=true" +gn_conf+=" symbol_level=1" +gn_conf+=" blink_symbol_level=0" +gn_conf+=" use_kerberos=true" +gn_conf+=" enable_vr=false" +gn_conf+=" optimize_webui=false" +gn_conf+=" enable_reading_list=false" +gn_conf+=" use_pulseaudio=true link_pulseaudio=true" +gn_conf+=" is_component_build=false" +gn_conf+=" use_sysroot=false" +gn_conf+=" fatal_linker_warnings=false" +gn_conf+=" use_allocator_shim=true" +gn_conf+=" use_partition_alloc=true" +gn_conf+=" disable_fieldtrial_testing_config=true" +gn_conf+=" use_gnome_keyring=false" +gn_conf+=" use_unofficial_version_number=false" +%ifnarch riscv64 +gn_conf+=" use_vaapi=true" +%endif +gn_conf+=" use_sysroot=false" +gn_conf+=" treat_warnings_as_errors=false" +gn_conf+=" enable_widevine=false" +gn_conf+=" use_dbus=true" +gn_conf+=" media_use_openh264=false" +gn_conf+=" rtc_use_h264=false" +gn_conf+=" use_v8_context_snapshot=true" +gn_conf+=" v8_use_external_startup_data=true" +%if %{with gtk4} +gn_conf+=" gtk_version=4" +%endif +%if %{without qt} +gn_conf+=" use_qt=false" +%else +gn_conf+=" moc_qt5_path=\"%{_libdir}/qt5/bin\"" +%endif +# See dependency logic in third_party/BUILD.gn +%if %{with system_harfbuzz} +gn_conf+=" use_system_harfbuzz=true" +%endif +%if %{with system_freetype} +gn_conf+=" use_system_freetype=true" +%endif +gn_conf+=" enable_hangout_services_extension=true" +gn_conf+=" enable_vulkan=true" +%if %{with pipewire} +gn_conf+=" rtc_use_pipewire=true rtc_link_pipewire=true" +%endif +%if %{with clang} +gn_conf+=" is_clang=true clang_version=\"$clang_version\" clang_base_path=\"$clang_base_path\" clang_use_chrome_plugins=false" +%if %{with lto} && %{with clang} +gn_conf+=" use_thin_lto=true" +%endif +gn_conf+=" use_lld=true" +%else +gn_conf+=" is_clang=false" +%ifnarch riscv64 aarch64 +gn_conf+=" use_gold=true" +%endif +%endif +%if %{with lto} && %{without clang} +gn_conf+=" gcc_lto=true" +%endif +%if %{with system_icu} +gn_conf+=" icu_use_data_file=false" +%endif +gn_conf+=" rust_sysroot_absolute=\"%{_prefix}\"" +gn_conf+=" rustc_version=\"$rustc_version\"" + +# The proprietary codecs just force the chromium to say they can use it and +# offload the actual computation to the ffmpeg, otherwise the chromium +# won't be able to load the codec even if the library can handle it +gn_conf+=" proprietary_codecs=true" +gn_conf+=" ffmpeg_branding=\"Chrome\"" + +%ifarch aarch64 +gn_conf+=" host_cpu=\"arm64\"" +%if %{with arm_bti} +gn_conf+=" arm_control_flow_integrity=\"standard\"" +%else +gn_conf+=" arm_control_flow_integrity=\"none\"" +%endif +%endif + +gn_conf+=" google_api_key=\"%{api_key}\"" + +gn_conf+=" use_system_libffi=true" + + +%if %{bootstrap} +tools/gn/bootstrap/bootstrap.py --gn-gen-args="${gn_conf}" +%else +mkdir -p %{outputdir} && cp -a %{_bindir}/gn %{outputdir}/ +%endif + +# GN does not support passing cflags: +# https://bugs.chromium.org/p/chromium/issues/detail?id=642016 +%{outputdir}/gn gen --args="${gn_conf}" %{outputdir} + +%{!?njobs:%global njobs %{_smp_build_ncpus}} +ninja -v -j%njobs -C %{outputdir} chrome chromedriver + +%install +bash %{SOURCE4} -s %{buildroot} -l %{_libdir} %{!?with_system_icu:-i true} -o %{outputdir} +# chromedriver +cp -a %{outputdir}/chromedriver.unstripped %{buildroot}%{_libdir}/chromium/chromedriver +ln -s %{_libdir}/chromium/chromedriver %{buildroot}%{_bindir}/chromedriver +# link to browser plugin path. +mkdir -p %{buildroot}%{_libdir}/browser-plugins +ln -s %{_libdir}/browser-plugins %{buildroot}%{_libdir}/chromium/plugins +# Install the master_preferences file +mkdir -p %{buildroot}%{_sysconfdir}/chromium +install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/chromium +# Compat link +ln -s %{_bindir}/chromium-browser %{buildroot}%{_bindir}/chromium +# Policy dirs +mkdir -p %{buildroot}%{_sysconfdir}/chromium/policies +mkdir %{buildroot}%{_sysconfdir}/chromium/policies/managed +mkdir %{buildroot}%{_sysconfdir}/chromium/policies/recommended +chmod -w %{buildroot}%{_sysconfdir}/chromium/policies/managed +mkdir -p %{buildroot}%{_datadir}/chromium/extensions +mkdir -p %{buildroot}%{_sysconfdir}/chromium/native-messaging-hosts +# SVG +install -Dm 0644 %{SOURCE3} %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps/chromium-browser.svg + +%files +%license LICENSE +%doc AUTHORS +%{_datadir}/chromium +%dir %{_sysconfdir}/chromium +%dir %{_sysconfdir}/chromium/policies +%dir %{_sysconfdir}/chromium/policies/managed +%dir %{_sysconfdir}/chromium/policies/recommended +%dir %{_sysconfdir}/chromium/native-messaging-hosts +%config %{_sysconfdir}/chromium/master_preferences +%{_libdir}/chromium +%{_datadir}/applications/*.desktop +%{_datadir}/metainfo/chromium-browser.appdata.xml +%{_datadir}/icons/hicolor +%exclude %{_libdir}/chromium/chromedriver +%{_bindir}/chromium-browser +%{_bindir}/chromium +%{_mandir}/man1/chromium-browser.1* + +%files -n chromedriver +%{_libdir}/chromium/chromedriver +%{_bindir}/chromedriver + +%changelog +* Tue Jul 02 2024 misaka0251 <liuxin@iscas.ac.cn> - 125.0.6422.141-1 +- Upgrade to version 125 + +* 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 |