chromium-browser-stable-test/chromium-browser-stable.spec
2022-05-30 00:00:07 +03:00

653 lines
23 KiB
RPMSpec

# 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
# [8] https://github.com/saiarcot895/chromium-ubuntu-build
# 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
%ifarch %{x86_64} %ix86
%bcond_without gost
%else
%bcond_with gost
%endif
# Gold linker
# http://a3f.at/lists/linkers
%bcond_with gold
# Linker is out of memory on 32 bit with -g2
# XXX debugsource package is empty, probably there are odd compiler flags
# TODO: fix building with debuginfo
%bcond_with debug
%if %{without debug}
%define debug_package %{nil}
%endif
# eol 'fix' corrupts some .bin
%define dont_fix_eol 1
%define _disable_lto 1
%define crname chromium-browser
%define _crdir %{_libdir}/%{crname}
# Yandex Browser, Opera and other proprietary forks of Chromium look for libffmpeg.so in /usr/lib/chromium-browser,
# while we use /usr/lib64/chromium-browser on x86_64
%define _crdir_compat %{_prefix}/lib/%{crname}
# 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
# Using commit hashes because upstream often puts tags long after making changes
# (they wait for builds to finish to make a new "release" with binary packages)
%define chromium_gost_commit b8bb24daca333ce67c0bb8f9d0c7103038020dbe
%define msspi_commit afe02c38f9b29883a033c652f548b09876e2f9b9
%define _gostsourcedir %{_builddir}/chromium-gost
%define xcb_version 1.14.1
%define llvm_prefix /opt/llvm15
%bcond_with bundled_llvm
# Verbose logging during build
%bcond_with verbose
%global __requires_exclude (^devel\\(|.*\\.so\\()
# alternative syntax for rpm5
%define __noautoreq '^libffmpeg'
# Do not provide libEGL.so, libGLESv2.so
%global __provides_exclude_from ^%{_crdir}/.*\\.so$
%if %{mdvver} >= 202110
%define __python %{__python3}
%else
%define __python %{__python38}
%endif
# workaround rpmlint bugs (?)
%global _build_pkgcheck_set /bin/sh %{_sourcedir}/rpmlint-wrapper.sh %{_build_pkgcheck_set}
%define _default_patch_fuzz 12
Summary: A fast web browser based on the Blink engine
Name: chromium-browser-stable
Version: 102.0.5005.61
Release: 2
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
Source11: rpmlint-wrapper.sh
# 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
# From https://github.com/systemd/systemd/blob/main/src/basic/missing_fcntl.h
# to fix building on rosa2016.1 where glibc does not have /usr/include/bits/fcntl-linux.h
Source21: missing_fcntl.h
Source30: master_preferences.json
Source31: default_bookmarks.html
Source32: chromium.default
Source33: chromium-default-config.json
# by Dmitry Petrov
Source34: rosa-logo-for-new-tab-page.svg
Source100: icons.tar.bz2
Source997: depot_tools.tar.xz
Source999: new-system-icons.tar.xz
# segfaults on x86_32, but building with debuginfo is not possible, x86_32 has near to no users
ExclusiveArch: %{x86_64} aarch64
# GOST
Source1101: https://github.com/deemru/chromium-gost/archive/%{chromium_gost_commit}.tar.gz?/chromium-gost-%{chromium_gost_commit}.tar.gz
Source1102: https://github.com/deemru/msspi/archive/%{msspi_commit}.tar.gz?/msspi-%{msspi_commit}.tar.gz
Patch4: chromium-30.0.1599.66-master-prefs-path.patch
# (cjw) fix gn bootstrapping with gcc
Patch190: chromium-69-gn-bootstrap.patch
# Patch to fix build
Patch601: chromium-62-include-cstdlib.patch
# Add "ROSA" to the user agent string
Patch627: chromium-68.0.3440.106-rosa-user-agent.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
Patch647: ALT-allow-to-override-clang-through-env-variables.patch
# XXX This patch is not enough to fully fix debuginfo and debugsource subpackages
Patch648: fix-debugsource.patch
# chrome://new-tab-page-third-party -> chrome://new-tab-page
Patch649: 0001-Functional-new-tab-page-with-non-Google-search-engin.patch
Patch650: 0002-Yandex-as-default-search-engine.patch
# Block odd interaction with Google servers, probably including loading promo Google logos
# (e.g. an LGBT-colored one, https://clck.ru/niFdJ)
# https://github.com/Eloston/ungoogled-chromium/blob/master/patches/core/ungoogled-chromium/block-requests.patch
Patch651: block-requests.patch
BuildRequires: bison
BuildRequires: llvm15
# 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
# nodejs 10 in rosa2016.1 is too old
%if %{mdvver} >= 201905
BuildRequires: nodejs
%else
BuildRequires: nodejs14
%endif
BuildRequires: util-linux
BuildRequires: jq
BuildRequires: yasm
BuildRequires: atomic-devel
BuildRequires: bzip2-devel
BuildRequires: cap-devel
BuildRequires: cups-devel
# %{_bindir}/eu-strip
BuildRequires: elfutils
BuildRequires: elfutils-devel
BuildRequires: multiarch-utils
BuildRequires: jpeg-devel
BuildRequires: pam-devel
%if %{mdvver} >= 202110
BuildRequires: python3
%else
BuildRequires: python38
%endif
BuildRequires: snappy-devel
BuildRequires: speech-dispatcher-devel
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(atk)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(dbus-glib-1)
%if %rpm4
BuildRequires: pkgconfig(dri)
BuildRequires: pkgconfig(krb5)
BuildRequires: pkgconfig(krb5-gssapi)
%endif
BuildRequires: pkgconfig(expat)
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(gstreamer-plugins-base-1.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(harfbuzz)
BuildRequires: pkgconfig(libgcrypt)
BuildRequires: pkgconfig(libmtp)
BuildRequires: pkgconfig(libopenjp2)
BuildRequires: pkgconfig(libpci)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libusb-1.0)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libxslt)
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(glesv2)
BuildRequires: pkgconfig(nspr)
BuildRequires: pkgconfig(nss)
%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)
# https://bugs.chromium.org/p/dawn/issues/detail?id=1441
BuildRequires: git-core
Requires: chromium-codecs = %{EVRD}
Provides: chromium-browser = %{EVRD}
Provides: chromium = %{EVRD}
%if %{mdvver} <= 201610
Conflicts: chromium-widevinecdm-plugin < 54
Obsoletes: chromium-widevinecdm-plugin < 54
# 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
%endif
%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.
%if %{with gost}
chromium-gost patches are integrated, this Chromium supports GOST TLS
if proprietary CryptoPro is installed.
%endif
%files
%config %{_sysconfdir}/%{crname}
%config %{_sysconfdir}/default/%{crname}
%{_bindir}/%{crname}
%dir %{_crdir}
%{_crdir}/chromium-wrapper
%{_crdir}/chromium-default-config.json
%{_crdir}/chrome
%{_crdir}/chrome-sandbox
%{_crdir}/chrome_crashpad_handler
%{_crdir}/icudtl.dat
%{_crdir}/locales
%{_crdir}/*.pak
%{_crdir}/resources
%{_crdir}/themes
%{_crdir}/libEGL.so
%{_crdir}/libGLESv2.so
%{_crdir}/libvk_swiftshader.so
%{_crdir}/vk_swiftshader_icd.json
%{_datadir}/applications/*.desktop
%{_iconsdir}/hicolor/*/apps/chromium*
# This crap does not work with rpm4 because it uses good locking of RPM DB
%if %rpm5
%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
%endif
#----------------------------------------------------------------------------
%package -n chromium-codecs
Summary: FFmpeg library for supporting media codecs in Chromium-based browsers
# alike Ubuntu
Provides: chromium-codecs-ffmpeg-extra = %{EVRD}
Provides: chromium-codecs-ffmpeg = %{EVRD}
%description -n chromium-codecs
FFmpeg (libffmpeg.so) for Chromium-based browsers.
This package is built from Chromium's bundled FFmpeg
with proprietary codecs turned on.
%files -n chromium-codecs
%{_crdir}/libffmpeg.so
%if "%{_lib}" != "lib"
%{_crdir_compat}/libffmpeg.so
%endif
#----------------------------------------------------------------------------
%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'' %{_gostsourcedir}/patch/chromium.patch \
-e 's/ (Chromium GOST)//g' \
-e 's/Chromium GOST/Chromium/g' \
-e 's/Chromium-Gost/Chromium/g' \
-e 's/"chromium-gost"/"chromium-browser"/g' \
-e 's/"chromium-gost.desktop"/"chromium-browser.desktop"/g' \
--
patch -p1 < %{_gostsourcedir}/patch/chromium.patch
( 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
%autopatch -p1
# We patch Chromium to open chrome://new-tab-page even with non-Google search engines
# and to use Yandex by default instead of Google for most of our users,
# but that page contains a Google logo and a search bar which utilises the chosen
# search engine, e.g. Yandex. That is why Google logo is irrelevant there.
# Replace file to avoid patching, but check that it exists:
# something has changed if it does not.
# TODO: allow to switch this image via alternatives(8):
# XXX Chromium does not allow to load "local files" due to security reasons.
test -f ./chrome/browser/resources/new_tab_page/icons/google_logo.svg
install -m0644 %{SOURCE34} ./chrome/browser/resources/new_tab_page/icons/google_logo.svg
# 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")/"%{vendor} %{rosa_release}, RPM %{name} %{EVRD}%{?with_gost: + GOST TLS via CryptoPro}"/' $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 -e 's,#!/usr/bin/env python$,#!%{__python},g' -e 's,#!/usr/bin/env python3$,#!%{__python},g' {} \;
mkdir -p local_bin
ln -s %{__python} local_bin/python
ln -s %{__python} local_bin/python3
export PATH="$PWD/local_bin:$PATH"
# setup node
mkdir -p third_party/node/linux/node-linux-x64/bin
%if %{mdvver} >= 201905
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/node
%else
ln -s /opt/nodejs14/bin/node third_party/node/linux/node-linux-x64/bin/node
%endif
# (From Fedora) 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
ln -s %{_bindir}/eu-strip buildtools/third_party/eu-strip/bin/eu-strip
%build
# unpack a local copy of the xcb-proto bits
tar xf %{SOURCE20}
export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}"
# 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
%if %{with gold}
%define linker_params use_gold=true use_lld=false
%else
%define linker_params use_gold=false use_lld=true
%endif
%if %{with debug}
%define symbol_level 2
%else
%define symbol_level 0
%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
%define wayland_enablement %{nil}
%else
%define pipewire_enablement rtc_use_pipewire=false
# Wayland parts regularly require adjusting for old glibc in rosa2016.1,
# but wayland is generally not widely used there
%define wayland_enablement enable_wayland_server=false ozone_platform_wayland=false
%endif
%ifarch aarch64
%define target_cpu target_cpu="arm64"
%else
%define target_cpu %{nil}
%endif
# Linking on 32 bit does not have enough memory for LTO
%ifarch %{ix86}
%define use_thin_lto false
%else
%define use_thin_lto true
%endif
# v NO TABS IN HERE!
%define gn_config use_sysroot=false \
%{target_cpu} \
is_official_build=true \
symbol_level=%{symbol_level} \
use_thin_lto=%{use_thin_lto} \
strip_debug_info=false \
is_cfi=false \
system_libdir="%{_lib}" \
icu_use_data_file=true \
enable_nacl=false \
is_nacl_glibc=false \
%{linker_params} \
ffmpeg_branding="ChromeOS" \
proprietary_codecs=true \
is_component_ffmpeg=true \
is_component_build=false \
use_system_libjpeg=true \
use_libjpeg_turbo=false \
enable_widevine=%{is_widevine} \
enable_vulkan=true \
enable_js_type_check=false \
use_pulseaudio=true \
link_pulseaudio=true \
%{pipewire_enablement} \
%{wayland_enablement} \
use_gnome_keyring=false \
use_allocator="none" \
treat_warnings_as_errors=false \
fatal_linker_warnings=false \
use_libpci=true \
is_debug=false \
is_clang=true \
%{?clang_use_chrome_plugins} \
use_vaapi=true \
%{?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 \
%if %{mdvver} >= 202110
freetype \
%endif
fontconfig \
libdrm
%{__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
# is_official_build triggers PGO with bundled profiles, but those profiles are for a specific
# version of clang/LLVM which does not match system one
%if %{without bundled_llvm}
sed -i -e 's,chrome_pgo_phase = 2,chrome_pgo_phase = 0,' build/config/compiler/pgo/pgo.gni
%endif
%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
# Reduce memory usage by linker
%ifarch %{ix86}
%if %{with gold}
# https://lwn.net/Articles/797303/
export LDFLAGS="-Wl,--no-map-whole-files -Wl,--no-keep-memory -Wl,--no-keep-files-mapped -Wl,--no-mmap-output-file"
sed -i -e 's/--threads/--no-threads/' -e '/--thread-count=4/d' build/config/compiler/BUILD.gn
%else
# Try to reduce memory usage by ld.lld. Multi threads are enabled by default.
# XXX Will it reduce it? It is not really needed, lld does not get out of memory without it, at least without debuginfo.
export LDFLAGS="-Wl,--threads=1"
%endif
%endif
%if %{mdvver} < 201900
grep -IrlE '#include([[:space:]])*<fcntl.h>' | xargs sed -i'' -E -e 's,#include([[:space:]])*<fcntl.h>,#include "%{SOURCE21}",'
%endif
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 libffmpeg.so
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
install -m 755 out/Release/chrome_crashpad_handler %{buildroot}%{_crdir}/chrome_crashpad_handler
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/vk_swiftshader_icd.json %{buildroot}%{_crdir}/
install -m 0755 out/Release/libffmpeg.so %{buildroot}%{_crdir}/
%if "%{_lib}" != "lib"
mkdir -p %{buildroot}%{_crdir_compat}
ln -sr %{buildroot}%{_crdir}/libffmpeg.so %{buildroot}%{_crdir_compat}/libffmpeg.so
%endif
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
# 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}/
install -m 644 out/Release/libvk_swiftshader.so %{buildroot}%{_crdir}/
# create global config file
mkdir -p %{buildroot}%{_sysconfdir}/default
install -m644 %{SOURCE32} %{buildroot}%{_sysconfdir}/default/%{crname}
find out/Release/resources/ -name "*.d" -exec rm {} \;
cp -r out/Release/resources %{buildroot}%{_crdir}
install -m 0644 %{SOURCE33} %{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 {} \;
%check
# ensure JSON validity
[ "$(jq .browser.custom_chrome_frame %{buildroot}%{_crdir}/chromium-default-config.json)" = "true" ]