# This spec file is based on other spec files, ebuilds, PKGBUILDs available from # [1] https://build.opensuse.org/package/show/openSUSE:Factory/chromium # [2] https://copr.fedoraproject.org/coprs/churchyard/chromium-russianfedora-tested/ # [3] https://www.archlinux.org/packages/extra/x86_64/chromium/ # [4] https://src.fedoraproject.org/rpms/chromium/ # [5] https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/chromium/ # [6] https://packages.altlinux.org/ru/sisyphus/srpms/chromium # [7] https://packages.altlinux.org/ru/sisyphus/specfiles/chromium-gost # Get the version number of latest stable version # $ curl -s 'https://omahaproxy.appspot.com/all?os=linux&channel=stable' | sed 1d | cut -d , -f 3 %define debug_package %{nil} %ifarch %{x86_64} %ix86 %bcond_without gost %else %bcond_with gost %endif # eol 'fix' corrupts some .bin %define dont_fix_eol 1 %define _disable_lto 1 %define crname chromium-browser %define _crdir %{_libdir}/%{crname} %define _src %{_topdir}/SOURCES %define ffmpeg 1 %define icu 0 %define jsoncpp 0 # Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys # Note: these are for Mageia use ONLY. # For your own builds, please get your own set of keys. %define google_api_key AIzaSyDhhIHB_kQZodiWr8yDAm8E3GwEyiXmuDU %define google_default_client_id 1039996407057-q599ngv7i6ni4sbkd2fsns30246r9s9v.apps.googleusercontent.com %define google_default_client_secret mRHXPjlS4cLpp1beCiXoYbLZ # GOST patches and sources %define chromium_gost_ver 88.0.4324.182 %define msspi_ver 0.1.42 %define _gostsourcedir %{_builddir}/chromium-gost %define xcb_version 1.14.1 %if %{mdvver} <= 201410 %bcond_without bundled_llvm %else %bcond_with bundled_llvm %define llvm_prefix /opt/llvm11 %endif # Verbose logging during build %bcond_with verbose %global __requires_exclude (^devel\\(|.*\\.so\\() # Do not provide libEGL.so, libGLESv2.so %global __provides_exclude_from ^%{_crdir}/.*\\.so$ # Chromium build scripts are not compatible with Python 3 yet %define __python %{__python2} Summary: A fast web browser based on the Blink engine Name: chromium-browser-stable Version: 89.0.4389.90 Release: 1 License: BSD, LGPL Group: Networking/WWW Url: https://www.chromium.org/Home Source0: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%{version}.tar.xz Source1: chromium-wrapper Source2: %{crname}.desktop Source10: %{name}.rpmlintrc # Bring xcb-proto with us (might need more than python on EPEL?) Source20: https://www.x.org/releases/individual/proto/xcb-proto-%{xcb_version}.tar.xz Source30: master_preferences Source31: default_bookmarks.html Source32: chromium.default Source100: icons.tar.bz2 Source997: depot_tools.tar.xz Source999: new-system-icons.tar.xz # GOST Source1101: https://github.com/deemru/chromium-gost/archive/%{chromium_gost_ver}.tar.gz?/chromium-gost-%{chromium_gost_ver}.tar.gz Source1102: https://github.com/deemru/msspi/archive/%{msspi_ver}.tar.gz?/msspi-%{msspi_ver}.tar.gz Source1103: gost-88-89.diff # needs with gost # https://github.com/deemru/chromium-gost/blob/master/patch/chromium.patch Patch1: chromium-79.0.3945.88-deleted-chromium-gost-info.patch Patch4: chromium-30.0.1599.66-master-prefs-path.patch # (cjw) Recognize mimetypes for matroska (.mkv) and AVI (.avi) formats (video/x-matroska and audio/x-matroska, video/x-msvideo) + handle A52 "AC3" and DTS compressed audio. Patch6: chromium-55-extra-media.patch # (cjw) [1/2] Recognize mimetypes for WMV (.wmv), FLV (.flv) and MPEG (.mpg) videos Patch7: chromium-40-wmvflvmpg.patch # (cjw) [2/2] Handle more video codecs. Patch8: chromium-40-sorenson-spark.patch Patch22: chromium-54-proprietary-codecs-assert.patch %if 0%{jsoncpp} # (cjw) add missing unbundle gn files (1) Patch28: chromium-53-gn-system-icu-jsoncpp.patch %endif # (cjw) fix webrtc build with system ffmpeg Patch35: chromium-50-system-ffmpeg-3.patch # (cjw) fix gn bootstrapping with gcc Patch190: chromium-69-gn-bootstrap.patch # Google patched their bundled copy of icu 54 to include API functionality that wasn't added until 55. # :P Patch502: chromium-45.0.2454.101-system-icu-54-does-not-have-detectHostTimeZone.patch # Patch to fix build with use_system_libvpx # Chromium bug #541273 # fix build with icu other than 54 Patch504: chromium-system-icu-r0.patch # ROSA Build Patch600: chromium-buildname-60.0.3112.90.patch # Patch to fix build Patch601: chromium-62-include-cstdlib.patch # https://mirror.yandex.ru/gentoo-portage/www-client/chromium/files/ Patch604: chromium-compiler-r4.patch # Add "ROSA" to the user agent string Patch627: chromium-68.0.3440.106-rosa-user-agent.patch # Fix building third_party/wayland on rosa2016.1 Patch639: wayland-strndup.patch # Fix sandbox code to properly handle the new way that glibc handles fstat in rosa2019.1+ # Thanks to Kevin Kofler for the fix (from Fedora) Patch640: chromium-88.0.4324.96-fstatfix.patch # Fix building with current glib2.0 # Hunks from https://build.opensuse.org/package/view_file/openSUSE:Factory/chromium/chromium-gcc11.patch Patch643: glib2.0.patch # Enable hw mjpeg decoding, Nvidia etc. # https://github.com/saiarcot895/chromium-ubuntu-build/blob/master/debian/patches/enable-vaapi-on-linux.diff Patch644: enable-vaapi-on-linux.diff # Enable VA-API with VDPAU backend on Nvidia GPUs # https://github.com/saiarcot895/chromium-ubuntu-build/blob/master/debian/patches/vdpau-support.patch Patch645: vdpau-support.patch Patch646: ALT-allow-to-override-clang-through-env-variables.patch BuildRequires: bison BuildRequires: llvm11 # for gn, not chromium itself BuildRequires: stdc++-gcc10-devel # gn needs these BuildRequires: flex %if %{with bundled_llvm} BuildRequires: cmake BuildRequires: git %endif BuildRequires: gperf BuildRequires: gyp BuildRequires: ninja BuildRequires: nodejs BuildRequires: util-linux BuildRequires: yasm BuildRequires: atomic-devel BuildRequires: bzip2-devel BuildRequires: cap-devel BuildRequires: cups-devel BuildRequires: elfutils-devel BuildRequires: multiarch-utils BuildRequires: java-devel BuildRequires: jpeg-devel %if 0%{jsoncpp} BuildRequires: jsoncpp-devel %endif BuildRequires: pam-devel BuildRequires: %{python2} BuildRequires: snappy-devel BuildRequires: speech-dispatcher-devel BuildRequires: pkgconfig(alsa) BuildRequires: pkgconfig(atk) BuildRequires: pkgconfig(dbus-glib-1) %if %rpm4 BuildRequires: pkgconfig(dri) BuildRequires: pkgconfig(krb5) BuildRequires: pkgconfig(krb5-gssapi) %endif BuildRequires: pkgconfig(expat) %if 0%{?ffmpeg} BuildRequires: pkgconfig(libavcodec) >= 4.0.2 %endif BuildRequires: pkgconfig(flac) BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(gbm) BuildRequires: pkgconfig(gconf-2.0) BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(glu) BuildRequires: pkgconfig(gnome-keyring-1) BuildRequires: pkgconfig(gstreamer-plugins-base-1.0) BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(harfbuzz) %if 0%{icu} BuildRequires: pkgconfig(icu-i18n) %endif BuildRequires: pkgconfig(libexif) BuildRequires: pkgconfig(libgcrypt) BuildRequires: pkgconfig(libmtp) BuildRequires: pkgconfig(libopenjp2) BuildRequires: pkgconfig(libpci) %if %{without native_libpng} BuildRequires: pkgconfig(libpng) %endif BuildRequires: pkgconfig(libpulse) BuildRequires: pkgconfig(libtiff-4) BuildRequires: pkgconfig(libusb-1.0) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libxslt) BuildRequires: pkgconfig(libva) BuildRequires: pkgconfig(glesv2) BuildRequires: pkgconfig(minizip) BuildRequires: pkgconfig(nspr) BuildRequires: pkgconfig(nss) BuildRequires: pkgconfig(opus) %if %{mdvver} >= 201910 # Upstream Chromium is comatible with 0.2, we patch for 0.3 BuildRequires: pkgconfig(libpipewire-0.3) BuildRequires: pkgconfig(libspa-0.2) %endif BuildRequires: pkgconfig(speex) BuildRequires: pkgconfig(udev) BuildRequires: pkgconfig(xscrnsaver) BuildRequires: pkgconfig(xt) BuildRequires: pkgconfig(xtst) BuildRequires: pkgconfig(zlib) BuildRequires: pythonegg(setuptools) %if %{with gost} BuildRequires: chrpath %endif Conflicts: chromium-widevinecdm-plugin < 54 Obsoletes: chromium-widevinecdm-plugin < 54 Conflicts: %{crname}-beta Conflicts: %{crname}-unstable # There was a dummy empty package chromium-browser # which depended from chromium-browser-stable and nothing more. # We decided to remove that package. # chromium-browser SUBpackage had Epoch=1 Obsoletes: %{crname} < 1:%{version}-%{release} Provides: %{crname} = 1:%{version}-%{release} Obsoletes: chromium-gost-lib < 78.0.3904.70 %if %{with gost} Provides: chromium-gost-lib = %{EVRD} %endif %description Chromium is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier. This is the stable channel Chromium browser. It offers a rock solid browser which is updated with features and fixes once they have been thoroughly tested. Note: If you are reverting from unstable to stable or beta channel, you may experience tab crashes on startup. This crash only affects tabs restored during the first launch due to a change in how tab state is stored. See http://bugs.chromium.org/34688. It's always a good idea to back up your profile before changing channels. %files %config %{_sysconfdir}/%{crname} %config %{_sysconfdir}/default/%{crname} %{_bindir}/%{crname} %{_crdir}/chromium-wrapper %{_crdir}/chrome %{_crdir}/chrome-sandbox %{_crdir}/icudtl.dat %{_crdir}/locales %{_crdir}/*.pak %{_crdir}/resources %{_crdir}/themes %{_crdir}/swiftshader %{_crdir}/libEGL.so* %{_crdir}/libGLESv2.so* %dir %{_crdir}/pepper %{_datadir}/applications/*.desktop %{_iconsdir}/hicolor/*/apps/chromium* %post # Remove chromium-browser-install package if we have it installed if [ "$(rpm -q %{crname}-install | wc -w)" = 1 ] then rpm -e %{crname}-install fi #---------------------------------------------------------------------------- %package -n chromedriver Summary: WebDriver for Google Chrome/Chromium Group: Development/Other Requires: %{name} = %{EVRD} %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. %files -n chromedriver %doc LICENSE AUTHORS %{_bindir}/chromedriver %{_crdir}/chromedriver #---------------------------------------------------------------------------- %prep %setup -qn chromium-%{version} -a 997 -a 999 %if %{with gost} rm -rf %{_gostsourcedir} mkdir -p %{_gostsourcedir} tar -C %{_gostsourcedir} --strip 1 -xf %{SOURCE1101} sed -i \ -e "s,^#include <../ssl/internal.h>,#include \"${PWD}/third_party/boringssl/src/ssl/internal.h\",g" \ %{_gostsourcedir}/src/gostssl.cpp tar -C %{_gostsourcedir}/src/msspi --strip 1 -xf %{SOURCE1102} sed -i 's/ (Chromium GOST)//g' %{_gostsourcedir}/patch/chromium.patch sed -i 's/Chromium GOST/Chromium/g' %{_gostsourcedir}/patch/chromium.patch # adapt patch from v88 to v89 ( cd %{_gostsourcedir}/patch patch -p0 < %{SOURCE1103} ) patch -p1 < %{_gostsourcedir}/patch/chromium.patch %patch1 -p1 -R ( cd ./third_party/boringssl/src patch -p1 < %{_gostsourcedir}/patch/boringssl.patch ) cp -f %{_gostsourcedir}/src/gostssl.cpp third_party/boringssl/gostssl.cpp cp -f %{_gostsourcedir}/src/msspi/src/* third_party/boringssl cp -f %{_gostsourcedir}/src/msspi/third_party/cprocsp/include/* third_party/boringssl/src/include %endif %patch4 -p1 -b .prefs %patch6 -p1 %patch7 -p1 %patch8 -p1 %patch22 -p1 %if 0%{jsoncpp} %patch28 -p1 %endif %if 0%{?ffmpeg} %patch35 -p1 %endif %patch190 -p1 %if 0%{icu} %patch502 -p1 -b .system-icu %patch504 -p0 -b .icu-ver %endif %patch600 -p1 %patch601 -p1 #patch604 -p1 %patch627 -p1 %patch639 -p1 %patch640 -p1 %patch643 -p1 %patch644 -p1 %patch645 -p1 %patch646 -p1 # fatal error: 'fuzzer/FuzzedDataProvider.h' file not found # (Available in Clang10) %if %{without bundled_llvm} mkdir -p third_party/llvm-build/Release+Asserts/bin pushd third_party/llvm-build/Release+Asserts/bin ln -sf %{llvm_prefix}/bin/clang clang ln -sf %{llvm_prefix}/bin/clang++ clang++ popd %endif # Hard code extra version FILE=chrome/common/channel_info_posix.cc sed -i.orig -e 's/getenv("CHROME_VERSION_EXTRA")/"%{product_vendor} %{product_version}"/' $FILE cmp $FILE $FILE.orig && exit 1 # Use native page size on aarch64 ("if (current_cpu == "arm64")"), otherwise: # /lib64/ld-linux-aarch64.so.1 ./bytecode_builtins_list_generator # ./bytecode_builtins_list_generator: error while loading shared libraries: # ./bytecode_builtins_list_generator: ELF load command alignment not page-aligned sed -i \ -e 's!-Wl,-z,max-page-size=4096!!g' \ build/config/compiler/BUILD.gn # base/rand_util_posix.cc:27:10: fatal error: 'sys/random.h' file not found sed -i "s|sys/random.h|/usr/include/linux/random.h|g" base/rand_util_posix.cc find . -type f -name '*.py' -exec sed -i 's,#!/usr/bin/env python$,#!%{__python},g' {} \; mkdir -p local_bin ln -s %{__python} local_bin/python export PATH="$PWD/local_bin:$PATH" # setup node mkdir -p third_party/node/linux/node-linux-x64/bin ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/node %build # unpack a local copy of the xcb-proto bits tar xf %{SOURCE20} export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}" %if 0%{?ffmpeg} %define system_gn_list ffmpeg %endif # flac libxslt snappy yasm zlib # opus # icu # libevent # libvpx # libwebp # System libxml must be built with icu support to be used in Chromium # libxml # handled by upstream regular build scripts? : freetype harfbuzz-ng # jsoncpp # widevinecdmadapter # Build error with widevinecdmadapter in 67.0.3396.62 (fixed) %define widevine 1 %if 0%{widevine} %define is_widevine true %else %define is_widevine false %endif %define lld 1 %if 0%{lld} %define linker_params use_gold=false use_lld=true %else %define linker_params use_gold=true use_lld=false %endif %if %{without bundled_llvm} %define clang_use_chrome_plugins clang_use_chrome_plugins=false %else %define clang_use_chrome_plugins clang_use_chrome_plugins=true %endif %if %{mdvver} == 201905 %define enable_remoting enable_remoting=false %else %define enable_remoting enable_remoting=true %endif %if %{mdvver} >= 201910 %define pipewire_enablement rtc_use_pipewire=true rtc_link_pipewire=true rtc_pipewire_version="0.3" %else %define pipewire_enablement rtc_use_pipewire=false %endif %ifarch aarch64 %define target_cpu target_cpu="arm64" %else %define target_cpu %{nil} %endif # v NO TABS IN HERE! %define gn_config use_sysroot=false \ %{target_cpu} \ system_libdir="%{_lib}" \ icu_use_data_file=true \ enable_nacl=false \ is_nacl_glibc=false \ %{linker_params} \ ffmpeg_branding="Chromium" \ proprietary_codecs=true \ enable_platform_ac3_eac3_audio = true \ enable_mse_mpeg2ts_stream_parser=true \ enable_platform_hevc=true \ use_system_libjpeg=true \ use_libjpeg_turbo=false \ enable_widevine=%{is_widevine} \ use_pulseaudio=true \ link_pulseaudio=true \ %{pipewire_enablement} \ use_allocator="none" \ treat_warnings_as_errors=false \ fatal_linker_warnings=false \ use_aura=true \ use_libpci = true \ is_debug=false \ gtk_version=3 \ is_clang=true \ %{?clang_use_chrome_plugins} \ use_system_freetype=false \ use_system_harfbuzz=false \ use_system_libpng=false \ use_vaapi=true \ enable_dav1d_decoder=true enable_libaom_decoder=false \ %{?enable_remoting} \ v8_use_external_startup_data=false \ google_api_key="%{google_api_key}" \ google_default_client_id="%{google_default_client_id}" \ google_default_client_secret="%{google_default_client_secret}" #clang_base_path="//third_party/llvm-build/Release+Asserts" \ %{__python} build/linux/unbundle/replace_gn_files.py --system-libraries %{system_gn_list} %{__python} third_party/libaddressinput/chromium/tools/update-strings.py # (From Fedora) # We don't need to cross compile while building on an aarch64 system. sed -i 's|aarch64-linux-gnu-||g' build/toolchain/linux/BUILD.gn %if %{with bundled_llvm} # Build clang from Google # python2 tools/clang/scripts/build.py \ # --without-android \ # --without-fuchsia \ # --use-system-cmake \ # --gcc-toolchain=%{_prefix} %{__python} tools/clang/scripts/update.py %endif # ALT-allow-to-override-clang-through-env-variables.patch makes gn read these variables %if %{without bundled_llvm} export CC=%{llvm_prefix}/bin/clang export CXX=%{llvm_prefix}/bin/clang++ export AR=%{llvm_prefix}/bin/llvm-ar export NM=%{llvm_prefix}/bin/llvm-nm sed -i -e 's,//third_party/llvm-build/Release+Asserts,%{llvm_prefix},g' build/config/clang/clang.gni %else %define clang_path "%{_builddir}/chromium-%{version}/third_party/llvm-build/Release+Asserts/bin/" export CC="%{clang_path}clang" export CXX="%{clang_path}clang++" export AR="%{clang_path}llvm-ar" export NM=nm %endif export READELF=readelf export PYTHON=%{__python} # libstdc++ in rosa2016.1 is too old to build gn, there are 2 ways to solve this: # 1) run bootstrap.py with --use-custom-libcxx, it will build and use bundled libc++ # 2) use libstdc++-gcc10 (https://forum.rosalinux.ru/viewtopic.php?t=10047&p=104560) # Let's choose option 2. LDFLAGS="-lstdc++-gcc10" \ CXXFLAGS="-nostdinc++ \ -Wno-unused-command-line-argument \ -I%{_includedir}/libstdc++-gcc10 \ -I%{_includedir}/libstdc++-gcc10/%{_host} \ " \ %{__python} tools/gn/bootstrap/bootstrap.py --gn-gen-args='%{gn_config}' unset LDFLAGS CXXFLAGS out/Release/gn gen --script-executable=%{__python} --args='%{gn_config}' out/Release pushd out/Release # widevinecdmadapter ninja %{_smp_mflags} %{?_with_verbose:--verbose} chrome chrome_sandbox chromedriver popd %install mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_crdir}/locales mkdir -p %{buildroot}%{_crdir}/themes install -m 755 %{SOURCE1} %{buildroot}%{_crdir}/chromium-wrapper install -m 755 out/Release/chrome %{buildroot}%{_crdir}/ install -m 4755 out/Release/chrome_sandbox %{buildroot}%{_crdir}/chrome-sandbox cp -a out/Release/chromedriver %{buildroot}%{_crdir}/chromedriver install -m 644 out/Release/*.pak %{buildroot}%{_crdir}/ install -m 644 out/Release/icudtl.dat %{buildroot}%{_crdir}/ install -m 644 out/Release/locales/*.pak %{buildroot}%{_crdir}/locales/ install -m 644 out/Release/resources.pak %{buildroot}%{_crdir}/ ln -s %{_crdir}/chromium-wrapper %{buildroot}%{_bindir}/%{crname} sed -i "s!@LIBDIR@!%{_libdir}!g" %{buildroot}%{_crdir}/chromium-wrapper ln -s %{_crdir}/chromedriver %{buildroot}%{_bindir}/chromedriver cp -r out/Release/swiftshader %{buildroot}%{_crdir} # This is ANGLE, not to be confused with the similarly named files under swiftshader/ install -m 644 out/Release/libEGL.so* %{buildroot}%{_crdir}/ install -m 644 out/Release/libGLESv2.so* %{buildroot}%{_crdir}/ # create global config file mkdir -p %{buildroot}%{_sysconfdir}/default install -m644 %{SOURCE32} %{buildroot}%{_sysconfdir}/default/%{crname} # create pepper dir. talkplugin works fine only if sylinks in pepper mkdir -p %{buildroot}%{_crdir}/pepper find out/Release/resources/ -name "*.d" -exec rm {} \; cp -r out/Release/resources %{buildroot}%{_crdir} # desktop file mkdir -p %{buildroot}%{_datadir}/applications install -m 644 %{SOURCE2} %{buildroot}%{_datadir}/applications/ # icon mkdir -p %{buildroot}%{_iconsdir}/hicolor/ tar xjf %{SOURCE100} -C %{buildroot}%{_iconsdir}/hicolor/ mkdir -p %{buildroot}%{_sysconfdir}/%{crname} install -m 0644 %{SOURCE30} %{buildroot}%{_sysconfdir}/%{crname}/ install -m 0644 %{SOURCE31} %{buildroot}%{_sysconfdir}/%{crname}/ find %{buildroot} -name "*.nexe" -exec strip {} \;