diff options
author | Eric Hameleers <alien@slackware.com> | 2021-09-02 21:23:05 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2021-09-02 21:23:05 +0000 |
commit | 25e0d48f7c3d36a0b8b2528b77eb95313ce44c0f (patch) | |
tree | fad6c603c750e3085878a1139e1d4697c9709b94 | |
parent | 975bef76f6723e4f0b50cb6938eba9a944d3020a (diff) | |
download | asb-25e0d48f7c3d36a0b8b2528b77eb95313ce44c0f.tar.gz asb-25e0d48f7c3d36a0b8b2528b77eb95313ce44c0f.tar.xz |
chromium: update to 93.0.4577.63
Allow for using system clang if it is new enough
Add modifications that should make it easier to compile on ARM platform. Thanks to Minime
-rwxr-xr-x | chromium/build/chromium.SlackBuild | 188 |
1 files changed, 121 insertions, 67 deletions
diff --git a/chromium/build/chromium.SlackBuild b/chromium/build/chromium.SlackBuild index 1435aa95..e2d79e07 100755 --- a/chromium/build/chromium.SlackBuild +++ b/chromium/build/chromium.SlackBuild @@ -404,11 +404,14 @@ # 91.0.4472.114-1: 19/jun/2021 by Eric Hameleers <alien@slackware.com> # * Update. # 92.0.4515.107-1: 22/jul/2021 by Eric Hameleers <alien@slackware.com> -# * Update to M992. +# * Update to M92. # 92.0.4515.131-1: 05/aug/2021 by Eric Hameleers <alien@slackware.com> # * Update. # 92.0.4515.159-1: 17/aug/2021 by Eric Hameleers <alien@slackware.com> # * Update. +# 93.0.4577.63-1: 01/sep/2021 by Eric Hameleers <alien@slackware.com> +# * Update to M93. Add some mods that hopefully make building +# on ARM platforms easier. # # ----------------------------------------------------------------------------- # @@ -433,7 +436,7 @@ USE_DEV=${USE_DEV:-0} SRCNAM=chromium PRGNAM=${SRCNAM}${SRCEXT} # chromium, chromium-dev, chromium-ungoogled, etc -VERSION=${VERSION:-92.0.4515.159} +VERSION=${VERSION:-93.0.4577.63} UNGOOGLED=${UNGOOGLED:-92.0.4515.159-1} BUILD=${BUILD:-1} TAG=${TAG:-alien} @@ -491,14 +494,28 @@ FFMPEG_HEVC=${FFMPEG_HEVC:-0} # Use the clang compiler. Results in faster build and smaller binaries. # This default to "1" (on) because gcc support is getting stale # and the gcc of Slackware 14.2 is already too old. -# This script will compile google's modified clang from source, so that 32bit -# can be supported (Google offers only 64bit pre-built clang for download0: +# You will have to download and apply lots of patches when using gcc anyway. +# This script can compile google's modified clang from source, so that 32bit +# can be supported on older Slackware (Google offers only 64bit pre-built +# clang for download0: USE_CLANG=${USE_CLANG:-1} +# Build a custom clang or use the system clang? +# CLANG_MIN is the minimal clang version needed to compile chromium: +CLANG_MIN=12 +if [ $(clang --version |grep '^clang' |cut -d' ' -f3 |cut -d. -f1) -ge ${CLANG_MIN} ]; then + BUILD_CLANG=${BUILD_CLANG:-0} +else + BUILD_CLANG=${BUILD_CLANG:-1} +fi + # If you don't want to enable support for Widevine CDM # (content decryption module) say "0" here. USE_CDM=${USE_CDM:-1} +# Chromium supports VAAPI (we disable it when the platform is not capable): +USE_VAAPI=${USE_VAAPI:-1} + # If you are OK with the "OK Google" hotwording feature which will # automatically download a binary blob with proprietary code, set this to "1". # Some people object to a download without consent so it is disabled by default: @@ -568,8 +585,7 @@ MARCH=$( uname -m ) if [ -z "$ARCH" ]; then case "$MARCH" in i?86) export ARCH=i586 ;; - armv7hl) export ARCH=$MARCH ;; - armv6hl) export ARCH=$MARCH ;; + armv7*) export ARCH=$MARCH ;; arm*) export ARCH=arm ;; # Unless $ARCH is already set, use uname -m for all other archs: *) export ARCH=$MARCH ;; @@ -583,7 +599,7 @@ case "$ARCH" in DSSE="1" FFMPEG_ARCH="ia32" SYSROOT_ARCH="i386" - SYSROOT_TARGET="i386" + SYSROOT_TARGET="i386-linux-gnu" PKGARCH="$ARCH" ;; x86_64) # Ensure that 32bit libraries are found first if we cross-compile: @@ -592,37 +608,29 @@ case "$ARCH" in SLKLDFLAGS="-L/usr/lib"; LIBDIRSUFFIX="" FFMPEG_ARCH="ia32" SYSROOT_ARCH="i386" - SYSROOT_TARGET="i386" + SYSROOT_TARGET="i386-linux-gnu" PKGARCH="i586" else SLKCFLAGS="-O2 -fPIC" SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64" FFMPEG_ARCH="x64" SYSROOT_ARCH="amd64" - SYSROOT_TARGET="x86_64" + SYSROOT_TARGET="x86_64-linux-gnu" PKGARCH="$ARCH" fi #DSSE="0" DSSE="1" ;; - armv7hl) SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - DSSE="1" - # Widevine not supported (no binary library available): - USE_CDM=0 - FFMPEG_ARCH="arm" - SYSROOT_ARCH="arm" - SYSROOT_TARGET="arm" - PKGARCH="$ARCH" - ;; - armv6hl) SLKCFLAGS="-O2 -march=armv6 -mfpu=vfp -mfloat-abi=hard" - SLKLDFLAGS=""; LIBDIRSUFFIX="" + armv7*) SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" + SLKLDFLAGS="-Wl,-z,notext"; LIBDIRSUFFIX="" DSSE="1" # Widevine not supported (no binary library available): USE_CDM=0 + # VAAPI not supported: + USE_VAAPI=0 FFMPEG_ARCH="arm" SYSROOT_ARCH="arm" - SYSROOT_TARGET="arm" + SYSROOT_TARGET="arm-linux-gnueabihf" PKGARCH="$ARCH" ;; *) SLKCFLAGS=${SLKCFLAGS:-"O2"} @@ -630,15 +638,18 @@ case "$ARCH" in DSSE="1" # Widevine not supported by default: USE_CDM=0 + # VAAPI not supported by default: + USE_VAAPI=0 FFMPEG_ARCH="$ARCH" SYSROOT_ARCH="$ARCH" - SYSROOT_TARGET="$ARCH" + SYSROOT_TARGET="$ARCH-linux-gnu" PKGARCH="$ARCH" ;; esac case "$ARCH" in - arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; + armv7*) TARGET=$ARCH-slackware-linux-gnueabi ;; + arm*) TARGET=${SYSROOT_ARCH}-slackware-linux-gnueabihf ;; *) TARGET=$ARCH-slackware-linux ;; esac @@ -738,15 +749,11 @@ sed -e 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ -i tools/generate_shim_headers/generate_shim_headers.py # Patches and bug fixes: touch $OUTPUT/patch-${PRGNAM}.log -# Fix 32bit builds on glibc >= 2.33 - thanks Matt Denton: +# Try to fix 32bit builds on glibc >= 2.33 - thanks Matt Denton: cat $SRCDIR/patches/linux-sandbox-syscall-broker-use-struct-kernel_stat.patch \ | patch -p1 --verbose 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log cat $SRCDIR/patches/linux-sandbox-fix-fstatat-crash.patch \ | patch -p1 --verbose 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log -# Don't retire 'enable-accelerated-video-decode' flag in Chromium 91 just yet, -# See https://crbug.com/1207478 : -cat $SRCDIR/patches/chromium_unexpire-accelerated-video-decode-flag.patch \ - | patch -p1 --verbose 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Be compatible with gcc 10: cat $SRCDIR/patches/chromium_gcc10.patch | patch -p1 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log @@ -758,10 +765,10 @@ sed -e '/ldflags /s/-m32/&", "-Wl,-z,notext/' \ #cat $SRCDIR/patches/chromium_hevc_non_chromeos.patch | patch -p1 --verbose \ # 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Slackware specific: -# When compiling google's clang on 32bit Slackware use 'i586' in the triplet. +# When compiling google's clang on 32bit Slackware or on ARM, add our triplets. # I am a python noob so this is clumsy, better implementation is welcome :-) -cp $SRCDIR/patches/clang.toolchains.i586.triple.diff . -cat $SRCDIR/patches/chromium_32bit_triplet.patch | patch -p1 --verbose \ +cp $SRCDIR/patches/clang.toolchains.slackware.triple.diff . +cat $SRCDIR/patches/chromium_slackware_triplet.patch | patch -p1 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Don't crap out when gzip does not support '--rsyncable' (Slackware < 14.2): if ! gzip --help |grep -q rsyncable ; then @@ -803,13 +810,21 @@ sed -i tools/clang/scripts/build.py -e "s/x86_64-unknown-linux-gnu/$TARGET/g" # And fix the 32bit compilation while we are at it: sed -i tools/clang/scripts/build.py -e "s/ldflags = \[\]/ldflags = \['-latomic'\]/" +# ARM platform specifics: +if [[ "$ARCH" =~ arm.* ]]; then + # Fix the hard-coded bootstrap target 'X86': + sed -i tools/clang/scripts/build.py \ + -e "s/bootstrap_targets = 'X86'/bootstrap_targets = 'ARM'/" + + # Compile only the relevant back-ends (ARM, AArch64 and X86): + sed -i tools/clang/scripts/build.py \ + -e "s/\(^ *targets = \).*$/&1'ARM;X86;AArch64'/" +fi + # When compiling google's clang, use the system cmake # (prebuilt binary from google is only available as 64bit): sed -i tools/clang/scripts/build.py -e 's/^ *AddCMakeToPath/#&/' -# Force script incompatible with Python 3 to use /usr/bin/python2: -sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py - # Prevent a build failure (yes, 'x64' even on 32bit Slackware): mkdir -p third_party/node/linux/node-linux-x64/bin ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ @@ -845,10 +860,12 @@ chmod -R u+w,go+r-w,a+X-s . echo Building ... [ ${USE_CLANG} -eq 1 ] && do_clang=true || do_clang=false +[ ${BUILD_CLANG} -eq 1 ] && do_custclang=true || do_custclang=false [ ${USE_CDM} -eq 1 ] && do_cdm=true || do_cdm=false [ ${USE_HOTWORD} -eq 1 ] && do_hotword=true || do_hotword=false [ ${USE_PA} -eq 1 ] && do_pa=true || do_pa=false [ ${USE_SYSROOT} -eq 1 ] && do_sysroot=true || do_sysroot=false +[ ${USE_VAAPI} -eq 1 ] && do_vaapi=true || do_vaapi=false [ ${USE_WAYLAND} -eq 1 ] && do_wayland=true || do_wayland=false [ ${FFMPEG_HEVC} -eq 1 ] && do_hevc=true || do_hevc=false @@ -900,7 +917,7 @@ _chromium_conf=( 'use_ozone=true' "use_pulseaudio=${do_pa}" "use_sysroot=${do_sysroot}" - 'use_vaapi=true' + "use_vaapi=${do_vaapi}" "use_xkbcommon=${do_wayland}" "extra_cxxflags=\"${CXXFLAGS}\"" "extra_ldflags=\"${LDFLAGS}\"" @@ -911,7 +928,7 @@ if [ ${USE_UNGOOGLED} -ne 0 ]; then else # Add remainder of standard chromium flags: _chromium_conf+=( - "clang_use_chrome_plugins=${do_clang}" + "clang_use_chrome_plugins=${do_custclang}" 'enable_hangout_services_extension=true' "enable_hotwording=${do_hotword}" 'enable_js_type_check=true' @@ -939,6 +956,9 @@ fi if [ "$ARCH" == "i586" ] || [ "${CROSS32}" = "YES" ]; then _chromium_conf=("${_chromium_conf[@]}" 'target_cpu="x86"') fi +if [[ "$ARCH" =~ arm.* ]]; then + _chromium_conf=("${_chromium_conf[@]}" 'target_cpu="arm"' 'target_os="linux"') +fi # Change this back when CRBUG 592268 is fixed (error during final link: # undefined reference to `base::i18n::GetRawIcuMemory()) @@ -1017,24 +1037,36 @@ if [ ${USE_SYSROOT} -eq 1 ]; then # Take care of Debian/Ubuntu related missing header issues: SYSROOTDIR=$(basename $(ls build/linux/ |grep ${SYSROOT_ARCH}-sysroot)) - ln -s ../../lib/${SYSROOT_TARGET}-linux-gnu/glib-2.0/include/glibconfig.h \ + ln -s ../../lib/${SYSROOT_TARGET}/glib-2.0/include/glibconfig.h \ build/linux/${SYSROOTDIR}/usr/include/glib-2.0/glibconfig.h - ln -s ../../../lib/${SYSROOT_TARGET}-linux-gnu/dbus-1.0/include/dbus/dbus-arch-deps.h \ + ln -s ../../../lib/${SYSROOT_TARGET}/dbus-1.0/include/dbus/dbus-arch-deps.h \ build/linux/${SYSROOTDIR}/usr/include/dbus-1.0/dbus/dbus-arch-deps.h - ln -s ../../lib/${SYSROOT_TARGET}-linux-gnu/graphene-1.0/include/graphene-config.h \ + ln -s ../../lib/${SYSROOT_TARGET}/graphene-1.0/include/graphene-config.h \ build/linux/${SYSROOTDIR}/usr/include/graphene-1.0/graphene-config.h # Take care of Debian/Ubuntu related linker issues: - echo "/usr/lib/${SYSROOT_TARGET}-linux-gnu/nss" >> \ - build/linux/${SYSROOTDIR}/etc/ld.so.conf.d/${SYSROOT_TARGET}-linux-gnu.conf + #echo "/usr/lib/${SYSROOT_TARGET}/nss" >> \ + # build/linux/${SYSROOTDIR}/etc/ld.so.conf.d/${SYSROOT_TARGET}.conf + for SOFILE in build/linux/${SYSROOTDIR}/usr/lib/${SYSROOT_TARGET}/nss/*.so ; + do + ln -sf nss/$(basename $SOFILE) \ + build/linux/${SYSROOTDIR}/usr/lib/${SYSROOT_TARGET}/ + done ln -s libsqlite3.so.0 \ - build/linux/${SYSROOTDIR}/usr/lib/${SYSROOT_TARGET}-linux-gnu/libsqlite3.so + build/linux/${SYSROOTDIR}/usr/lib/${SYSROOT_TARGET}/libsqlite3.so + + # The platform-specific alias for the ARM readelf binary is missing + # from the debian sysroot image: + if [ ! -f build/linux/${SYSROOTDIR}/usr/bin/${SYSROOT_TARGET}-readelf ]; then + ln -s /usr/bin/readelf \ + build/linux/${SYSROOTDIR}/usr/bin/${SYSROOT_TARGET}-readelf + fi fi # Do not make the build fail on stripping chromedriver, -# because Chromium installs a 64bit version of eu-strip on the 32bit OS: -if [ "$ARCH" == "i586" ]; then - if ! file $TMP/tmp-$PRGNAM/${SRCNAM}-${VERSION}/buildtools/third_party/eu-strip/bin/eu-strip 2>/dev/null | grep -q "ELF 32-bit" ; then +# because Chromium installs a 64bit version of eu-strip on the 32bit & ARM OS: +if [ "$ARCH" != "x86_64" ]; then + if file $TMP/tmp-$PRGNAM/${SRCNAM}-${VERSION}/buildtools/third_party/eu-strip/bin/eu-strip 2>/dev/null | grep -q "ELF 64-bit" ; then install -D -m0755 -t $TMP/tmp-$PRGNAM/${SRCNAM}-${VERSION}/buildtools/third_party/eu-strip/bin /usr/bin/eu-strip fi fi @@ -1045,14 +1077,25 @@ fi ulimit -n 2048 # Compile google's internal clang sources if needed -if [ ${USE_CLANG} -eq 1 ]; then +if [ ${USE_CLANG} -eq 1 ] && [ ${BUILD_CLANG} -eq 1 ]; then # Build clang from source instead of downloading: echo "-- Building google's clang toolchain." - # Actually 32bit compilation fails by not finding 'bits/c++config.h'. - # I could only work around this using a kludge: - # cp -ia /usr/include/c++/$(gcc -dumpversion)/${TARGET}/bits/* /usr/include/c++/$(gcc -dumpversion)/bits/ + HDR2REM="" + if [ "$ARCH" == "i586" ]; then + # Actually 32bit compilation fails by not finding 'bits/c++config.h'. + # I could only work around this using a kludge: + # cp -ia /usr/include/c++/$(gcc -dumpversion)/${TARGET}/bits/* /usr/include/c++/$(gcc -dumpversion)/bits/ + # Keep a list of the symlinks we'll be creating: + for HDR in /usr/include/c++/$(gcc -dumpversion)/${TARGET}/bits/*.h ; do + if [ ! -f /usr/include/c++/$(gcc -dumpversion)/bits/$(basename $HDR) ]; + then + ln -s $HDR /usr/include/c++/$(gcc -dumpversion)/bits/ + HDR2REM="$(basename $HDR) $HDR2REM" + fi + done + fi LDFLAGS="$LDFLAGS" \ - python2 tools/clang/scripts/build.py \ + python3 tools/clang/scripts/build.py \ --bootstrap \ --disable-asserts \ --gcc-toolchain /usr \ @@ -1062,13 +1105,18 @@ if [ ${USE_CLANG} -eq 1 ]; then --without-fuchsia \ 2>&1 | tee $OUTPUT/clang_build-${PRGNAM}.log #--llvm-force-head-revision \ -fi + if [ -n "$HDR2REM" ]; then + # Remove the temporary header symlinks we just created: + ( cd /usr/include/c++/$(gcc -dumpversion)/bits/ && rm $HDR2REM) + fi -# Ensure that only this new clang is used, ignoring the system version: -MYCLANG_PATH="$TMP/tmp-$PRGNAM/${SRCNAM}-${VERSION}/third_party/llvm-build/Release+Asserts/bin" -export PATH="$MYCLANG_PATH:$PATH" + # Ensure that only this new clang is used, ignoring the system version: + MYCLANG_PATH="$TMP/tmp-$PRGNAM/${SRCNAM}-${VERSION}/third_party/llvm-build/Release+Asserts/bin" + export PATH="$MYCLANG_PATH:$PATH" +fi -# For Chromium 92, disable ffmpeg re-configuration on 32bit OS to avoid linking errors like: +# For Chromium 92, disable ffmpeg re-configuration on 32bit OS, +# to avoid linking errors like: # "FAILED: v8_context_snapshot_generator - ld.lld: error: undefined symbol: ff_psdsp_init_x86" if [ ${FFMPEG_HEVC} -eq 1 ] && [ "${FFMPEG_ARCH}" != "ia32" ]; then echo "-- Re-configuring bundled ffmpeg..." @@ -1090,11 +1138,10 @@ if [ ${FFMPEG_HEVC} -eq 1 ] && [ "${FFMPEG_ARCH}" != "ia32" ]; then #sed -e "s/--extra-ldflags=-fuse-ld=lld/--extra-ldflags=''/" \ # -i chromium/scripts/build_ffmpeg.py # Actual reconfigure steps: - PATH="$MYCLANG_PATH:${PATH}" \ - python2 chromium/scripts/build_ffmpeg.py linux ${FFMPEG_ARCH} \ + python3 chromium/scripts/build_ffmpeg.py linux ${FFMPEG_ARCH} \ --branding ${FFMPEG_BRANDING} -- ${FFMPEG_CUSTOM_ARGS} \ 2>&1 | tee $OUTPUT/ffmpeg_configure-${PRGNAM}.log - python2 chromium/scripts/copy_config.sh \ + python3 chromium/scripts/copy_config.sh \ 2>&1 | tee -a $OUTPUT/ffmpeg_configure-${PRGNAM}.log # Runs into 'SyntaxError: invalid syntax' with Python2: python3 chromium/scripts/generate_gn.py \ @@ -1105,15 +1152,19 @@ fi # Generate the ninja build files: echo "-- Bootstrapping 'gn'." -# Symlink ld to lld to make gn linking stage succeed: -cd $MYCLANG_PATH ; ln -s lld ld ; cd - 1>/dev/null +if [ ${USE_CLANG} -eq 1 ] && [ ${BUILD_CLANG} -eq 1 ]; then + # Symlink ld to lld to make gn linking stage succeed: + cd $MYCLANG_PATH ; ln -s lld ld ; cd - 1>/dev/null +fi LDFLAGS="$LDFLAGS" python3 tools/gn/bootstrap/bootstrap.py \ 2>&1 | tee $OUTPUT/gyp-${PRGNAM}.log #--use-custom-libcxx \ -# Remove symlink again: -rm $MYCLANG_PATH/ld +if [ ${USE_CLANG} -eq 1 ] && [ ${BUILD_CLANG} -eq 1 ]; then + # Remove symlink again: + rm $MYCLANG_PATH/ld +fi echo "-- Generating ninja build files." out/Release/gn gen out/Release -v --args="${_chromium_conf[*]}" \ @@ -1122,17 +1173,20 @@ out/Release/gn gen out/Release -v --args="${_chromium_conf[*]}" \ # Compile everything: echo "-- Compiling the lot." -if [ "$USE_CLANG" = "1" ]; then +if [ ${USE_CLANG} -eq 1 ] && [ ${BUILD_CLANG} -eq 1 ]; then # Use the clang that we build in-tree instead of using the system version: export CC="$MYCLANG_PATH/clang" export CXX="$MYCLANG_PATH/clang++" export LD="$MYCLANG_PATH/lld" - #unset CC - #unset CXX -else +elif [ "$USE_CLANG" = "0" ]; then # Be careful not to override CC and CXX (may have been set by gcc5): export CC=${CC:-"gcc"} export CXX=${CXX:-"g++"} +else + # Use the system clang: + export CC="clang" + export CXX="clang++" + export LD="lld" fi export AS=as export AR=ar |