extra/chromium: fix

This commit is contained in:
Kevin Mihelich 2021-07-22 12:32:08 +00:00
parent f238ad5359
commit e202c037c6
4 changed files with 227 additions and 6 deletions

View file

@ -1,7 +1,7 @@
From 91ec5e7245f7ab302cd8fe22bfbbd2f0738ae286 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Thu, 18 Feb 2021 19:35:58 -0700
Subject: [PATCH 1/2] widevine support for arm
Subject: [PATCH 1/3] widevine support for arm
---
third_party/widevine/cdm/widevine.gni | 2 +-

View file

@ -1,7 +1,7 @@
From b6540b7ab88e5c47ee0978de312cf0a997d9b981 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Tue, 2 Feb 2021 13:58:59 -0700
Subject: [PATCH 2/2] Run blink bindings generation single threaded
Subject: [PATCH 2/3] Run blink bindings generation single threaded
When not single threaded this process will eat all the RAM.
---

View file

@ -0,0 +1,212 @@
From b003f9962b249cede54be9744fd8b6319cb5d321 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Wed, 21 Jul 2021 21:37:31 -0600
Subject: [PATCH 3/3] Fix eu-strip build for newer GCC
---
buildtools/third_party/eu-strip/build.sh | 3 +-
.../third_party/eu-strip/gcc-fixes.patch | 171 ++++++++++++++++++
2 files changed, 173 insertions(+), 1 deletion(-)
create mode 100644 buildtools/third_party/eu-strip/gcc-fixes.patch
diff --git a/buildtools/third_party/eu-strip/build.sh b/buildtools/third_party/eu-strip/build.sh
index 86f2b67f6bbd..722ebcf46f06 100755
--- a/buildtools/third_party/eu-strip/build.sh
+++ b/buildtools/third_party/eu-strip/build.sh
@@ -1,7 +1,7 @@
#!/bin/sh -xe
rm -rf elfutils
-git clone git://sourceware.org/git/elfutils.git
+git clone https://sourceware.org/git/elfutils.git
cd elfutils
git checkout elfutils-0.170
autoheader
@@ -9,6 +9,7 @@ aclocal
autoconf
automake --add-missing
patch -p1 < ../fix-elf-size.patch
+patch -p1 < ../gcc-fixes.patch
mkdir build
cd build
../configure --enable-maintainer-mode
diff --git a/buildtools/third_party/eu-strip/gcc-fixes.patch b/buildtools/third_party/eu-strip/gcc-fixes.patch
new file mode 100644
index 000000000000..fdb84dffd936
--- /dev/null
+++ b/buildtools/third_party/eu-strip/gcc-fixes.patch
@@ -0,0 +1,171 @@
+diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
+index 67638d70..08282ba4 100644
+--- a/backends/linux-core-note.c
++++ b/backends/linux-core-note.c
+@@ -111,7 +111,7 @@ struct EBLHOOK(prstatus)
+ FIELD (INT, pr_fpvalid);
+ }
+ #ifdef ALIGN_PRSTATUS
+- __attribute__ ((packed, aligned (ALIGN_PRSTATUS)))
++ attribute_packed __attribute__ ((aligned (ALIGN_PRSTATUS)))
+ #endif
+ ;
+
+diff --git a/libelf/libelfP.h b/libelf/libelfP.h
+index 7ee6625a..4007301b 100644
+--- a/libelf/libelfP.h
++++ b/libelf/libelfP.h
+@@ -463,9 +463,9 @@ extern Elf_Type __libelf_data_type (Elf *elf, int sh_type) internal_function;
+ These functions cannot be marked internal since they are aliases
+ of the export elfXX_fsize functions.*/
+ extern size_t __elf32_msize (Elf_Type __type, size_t __count,
+- unsigned int __version);
++ unsigned int __version) __const_attribute__;
+ extern size_t __elf64_msize (Elf_Type __type, size_t __count,
+- unsigned int __version);
++ unsigned int __version) __const_attribute__;
+
+
+ /* Create Elf descriptor from memory image. */
+diff --git a/src/ar.c b/src/ar.c
+index ec32cee59..818115bd9 100644
+--- a/src/ar.c
++++ b/src/ar.c
+@@ -1,5 +1,5 @@
+ /* Create, modify, and extract from archives.
+- Copyright (C) 2005-2012, 2016 Red Hat, Inc.
++ Copyright (C) 2005-2012, 2016, 2017 Red Hat, Inc.
+ This file is part of elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+@@ -442,7 +442,7 @@ static int
+ do_oper_extract (int oper, const char *arfname, char **argv, int argc,
+ long int instance)
+ {
+- bool found[argc];
++ bool found[argc > 0 ? argc : 1];
+ memset (found, '\0', sizeof (found));
+
+ size_t name_max = 0;
+@@ -1056,13 +1056,11 @@ do_oper_delete (const char *arfname, char **argv, int argc,
+ goto nonew_unlink;
+
+ errout:
+-#ifdef DEBUG
+ elf_end (elf);
+
+ arlib_fini ();
+
+ close (fd);
+-#endif
+
+ not_found (argc, argv, found);
+
+@@ -1070,12 +1068,18 @@ do_oper_delete (const char *arfname, char **argv, int argc,
+ }
+
+
+-static void
++/* Prints the given value in the given buffer without a trailing zero char.
++ Returns false if the given value doesn't fit in the given buffer. */
++static bool
+ no0print (bool ofmt, char *buf, int bufsize, long int val)
+ {
+ char tmpbuf[bufsize + 1];
+- snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val);
++ int ret = snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld",
++ bufsize, val);
++ if (ret >= (int) sizeof (tmpbuf))
++ return false;
+ memcpy (buf, tmpbuf, bufsize);
++ return true;
+ }
+
+
+@@ -1084,7 +1088,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
+ const char *member)
+ {
+ int status = 0;
+- Elf *elf;
++ Elf *elf = NULL;
+ struct stat st;
+ int fd = open_archive (arfname, O_RDONLY, 0, &elf, &st, oper != oper_move);
+
+@@ -1303,13 +1307,11 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
+
+ if (status != 0)
+ {
+-#ifdef DEBUG
+ elf_end (elf);
+
+ arlib_fini ();
+
+ close (fd);
+-#endif
+
+ return status;
+ }
+@@ -1463,14 +1465,36 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
+ memcpy (arhdr.ar_name, tmpbuf, sizeof (arhdr.ar_name));
+ }
+
+- no0print (false, arhdr.ar_date, sizeof (arhdr.ar_date),
+- all->sec);
+- no0print (false, arhdr.ar_uid, sizeof (arhdr.ar_uid), all->uid);
+- no0print (false, arhdr.ar_gid, sizeof (arhdr.ar_gid), all->gid);
+- no0print (true, arhdr.ar_mode, sizeof (arhdr.ar_mode),
+- all->mode);
+- no0print (false, arhdr.ar_size, sizeof (arhdr.ar_size),
+- all->size);
++ if (! no0print (false, arhdr.ar_date, sizeof (arhdr.ar_date),
++ all->sec))
++ {
++ error (0, errno, gettext ("cannot represent ar_date"));
++ goto nonew_unlink;
++ }
++ if (! no0print (false, arhdr.ar_uid, sizeof (arhdr.ar_uid),
++ all->uid))
++ {
++ error (0, errno, gettext ("cannot represent ar_uid"));
++ goto nonew_unlink;
++ }
++ if (! no0print (false, arhdr.ar_gid, sizeof (arhdr.ar_gid),
++ all->gid))
++ {
++ error (0, errno, gettext ("cannot represent ar_gid"));
++ goto nonew_unlink;
++ }
++ if (! no0print (true, arhdr.ar_mode, sizeof (arhdr.ar_mode),
++ all->mode))
++ {
++ error (0, errno, gettext ("cannot represent ar_mode"));
++ goto nonew_unlink;
++ }
++ if (! no0print (false, arhdr.ar_size, sizeof (arhdr.ar_size),
++ all->size))
++ {
++ error (0, errno, gettext ("cannot represent ar_size"));
++ goto nonew_unlink;
++ }
+ memcpy (arhdr.ar_fmag, ARFMAG, sizeof (arhdr.ar_fmag));
+
+ if (unlikely (write_retry (newfd, &arhdr, sizeof (arhdr))
+@@ -1514,13 +1538,15 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
+ goto nonew_unlink;
+
+ errout:
+-#ifdef DEBUG
++ for (int cnt = 0; cnt < argc; ++cnt)
++ elf_end (found[cnt]->elf);
++
+ elf_end (elf);
+
+ arlib_fini ();
+
+- close (fd);
+-#endif
++ if (fd != -1)
++ close (fd);
+
+ return status;
+ }
--
2.32.0

View file

@ -10,6 +10,7 @@
# - is_cfi=false, use_gold=false
# - clang_use_default_sample_profile=false, AFDO breaks distcc
# - use_allocator="none", tcmalloc breaks ARM
# - patch and rebuild bundled eu-strip
buildarch=12
highmem=1
@ -27,7 +28,7 @@ depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'libva'
'desktop-file-utils' 'hicolor-icon-theme')
makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire'
'java-runtime-headless' 'python2')
'java-runtime-headless' 'python2' 'git')
optdepends=('pipewire: WebRTC desktop sharing under Wayland'
'kdialog: support for native dialogs in Plasma'
'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
@ -42,7 +43,8 @@ source=(https://commondatastorage.googleapis.com/chromium-browser-official/$pkgn
sql-make-VirtualCursor-standard-layout-type.patch
use-oauth2-client-switches-as-default.patch
0001-widevine-support-for-arm.patch
0002-Run-blink-bindings-generation-single-threaded.patch)
0002-Run-blink-bindings-generation-single-threaded.patch
0003-Fix-eu-strip-build-for-newer-GCC.patch)
sha256sums=('6e51ac6512a4e95018eefc9fef1d2e7597f28a1c45c763b3a8eb7dde5f557012'
'86859c11cfc8ba106a3826479c0bc759324a62150b271dd35d1a0f96e890f52f'
'53a2cbb1b58d652d5424ff9040b6a51b9dc6348ce3edc68344cd0d25f1f4beb2'
@ -52,8 +54,9 @@ sha256sums=('6e51ac6512a4e95018eefc9fef1d2e7597f28a1c45c763b3a8eb7dde5f557012'
'4489e5e7854a7dcd9464133eb4664250ce7149ac1714a0bf10ca0d82d8806568'
'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150'
'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711'
'0014f33d92c514ff9160f1a82e9aa65f8b92d77574433ff5535ab078a6b23b4e'
'c6c586a0098ef22334081e7e1a36dc8efa866e32587fed79df9d3c9afb7b237f')
'1e6675897762250dd96054d13e35939e7d9e93a812c909ba95966c86d5a3a284'
'a07c2c855e7e1eba9c07c5f998f5dddd41286dca1764837abd3fc476e5fc0992'
'3c5c6b2034847d735e4e170af30a5af38202b2ed193210d49dc148b2e7c9572c')
# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
# Keys are the names in the above script; values are the dependencies in Arch
@ -100,6 +103,7 @@ prepare() {
# Arch Linux ARM fixes
patch -p1 -i ../0001-widevine-support-for-arm.patch
patch -p1 -i ../0002-Run-blink-bindings-generation-single-threaded.patch
patch -p1 -i ../0003-Fix-eu-strip-build-for-newer-GCC.patch
# Build ARMv7 with NEON
[[ $CARCH == "armv7h" ]] && MAKEFLAGS="-j4" && CFLAGS=`echo $CFLAGS | sed -e 's/vfpv3-d16/neon/'` && CXXFLAGS="$CFLAGS"
@ -157,6 +161,11 @@ build() {
cd "$srcdir/$pkgname-$pkgver"
# Rebuild eu-strip
pushd buildtools/third_party/eu-strip
./build.sh
popd
export CC=clang
export CXX=clang++
export AR=ar