Clean up and more preparation for aarch64

(still not buildable on aarch64)
+ some clean up of odd conditions
+ python-beautifulsoup4 dropped python2 in rosa2019.1,
  but build scripts of Chromium work only with python 2,
  bundled python 2 modules must be used
This commit is contained in:
Mikhail Novosyolov 2021-01-08 15:48:07 +03:00
parent 213760b35a
commit 66d61226f7

View file

@ -60,10 +60,13 @@
# 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: 87.0.4280.141
Release: 1
Release: 2
License: BSD, LGPL
Group: Networking/WWW
Url: https://www.chromium.org/Home
@ -178,6 +181,7 @@ BuildRequires: jpeg-devel
BuildRequires: jsoncpp-devel
%endif
BuildRequires: pam-devel
BuildRequires: python2
BuildRequires: snappy-devel
BuildRequires: speech-dispatcher-devel
BuildRequires: pkgconfig(alsa)
@ -234,14 +238,6 @@ BuildRequires: pkgconfig(xscrnsaver)
BuildRequires: pkgconfig(xt)
BuildRequires: pkgconfig(xtst)
BuildRequires: pkgconfig(zlib)
%if %{mdvver} >= 201910
# no support python2
#BuildRequires: python2dist(beautifulsoup4)
BuildRequires: python2dist(html5lib)
%else
BuildRequires: pythonegg(beautifulsoup4)
BuildRequires: pythonegg(html5lib)
%endif
BuildRequires: pythonegg(setuptools)
%if %{with gost}
BuildRequires: chrpath
@ -415,17 +411,11 @@ sed -i \
# 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
%if %{mdvver} >= 201910
# gn is rather convoluted and not python3 friendly -- let's make
# sure it sees python2 when it calls python
ln -s %{_bindir}/python2 python
find . -type f -name '*.py' -exec sed -i 's,#!/usr/bin/env python,#!/usr/bin/env python2,g' {} \;
find . -type f -name '*.py' -exec sed -i 's,#!/usr/bin/env python$,#!%{__python},g' {} \;
mkdir -p local_bin
ln -s %{__python2} local_bin/python
ln -s %{__python} local_bin/python
export PATH="$PWD/local_bin:$PATH"
%endif
# setup node
mkdir -p third_party/node/linux/node-linux-x64/bin
@ -498,8 +488,15 @@ export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}"
%define enable_remoting enable_remoting=true
%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 \
@ -538,8 +535,12 @@ export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}"
#clang_base_path="//third_party/llvm-build/Release+Asserts" \
python2 build/linux/unbundle/replace_gn_files.py --system-libraries %{system_gn_list}
python2 third_party/libaddressinput/chromium/tools/update-strings.py
%{__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 native_clang}
# Build clang from Google
@ -548,7 +549,7 @@ python2 third_party/libaddressinput/chromium/tools/update-strings.py
# --without-fuchsia \
# --use-system-cmake \
# --gcc-toolchain=%{_prefix}
python2 tools/clang/scripts/update.py
%{__python} tools/clang/scripts/update.py
%endif
%if %{with clang}
@ -584,14 +585,9 @@ CFLAGS="$CFLAGS -Wno-error=pointer-to-int-cast -Wno-error=int-to-pointer-cast -f
CXXFLAGS="$CXXFLAGS -Wno-error=attributes -Wno-error=comment -Wno-error=unused-variable -Wno-error=strict-overflow -Wno-error=deprecated-declarations -fno-strict-aliasing"
%endif
%if %{mdvver} >= 201910
export PYTHON=%{__python2}
python2 tools/gn/bootstrap/bootstrap.py --gn-gen-args='%{gn_config}'
out/Release/gn gen --script-executable=/usr/bin/python2 --args='%{gn_config}' out/Release
%else
python tools/gn/bootstrap/bootstrap.py --gn-gen-args='%{gn_config}'
out/Release/gn gen --args='%{gn_config}' out/Release
%endif
export PYTHON=%{__python}
%{__python} tools/gn/bootstrap/bootstrap.py --gn-gen-args='%{gn_config}'
out/Release/gn gen --script-executable=%{__python} --args='%{gn_config}' out/Release
pushd out/Release
# widevinecdmadapter