Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] chromium: aarch64 cross build support
@ 2021-10-01 14:31 Duncaen
  2021-10-01 18:25 ` [PR REVIEW] " ericonr
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Duncaen @ 2021-10-01 14:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

There is a new pull request by Duncaen against master on the void-packages repository

https://github.com/Duncaen/void-packages chromium-94
https://github.com/void-linux/void-packages/pull/33208

chromium: aarch64 cross build support
None

A patch file from https://github.com/void-linux/void-packages/pull/33208.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-94-33208.patch --]
[-- Type: text/x-diff, Size: 11226 bytes --]

From f84cb76feb3fd33af6c1de40ecc8535e022f4ee5 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Sun, 26 Sep 2021 15:47:29 +0200
Subject: [PATCH] chromium: aarch64 cross build support

---
 srcpkgs/chromium/patches/cross-build.patch    | 65 +++++++++++++
 .../patches/unbundled-cross-toolchain.patch   | 12 +++
 srcpkgs/chromium/template                     | 91 +++++++++++++++++--
 3 files changed, 160 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/chromium/patches/cross-build.patch
 create mode 100644 srcpkgs/chromium/patches/unbundled-cross-toolchain.patch

diff --git a/srcpkgs/chromium/patches/cross-build.patch b/srcpkgs/chromium/patches/cross-build.patch
new file mode 100644
index 000000000000..63b89395cb80
--- /dev/null
+++ b/srcpkgs/chromium/patches/cross-build.patch
@@ -0,0 +1,65 @@
+--- a/build/config/compiler/BUILD.gn.orig
++++ b/build/config/compiler/BUILD.gn
+@@ -58,6 +58,10 @@
+ }
+ 
+ declare_args() {
++  is_musl = false
++}
++
++declare_args() {
+   # Normally, Android builds are lightly optimized, even for debug builds, to
+   # keep binary size down. Setting this flag to true disables such optimization
+   android_full_debug = false
+@@ -880,8 +884,13 @@
+       }
+     } else if (current_cpu == "arm64") {
+       if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
+-        cflags += [ "--target=aarch64-linux-gnu" ]
+-        ldflags += [ "--target=aarch64-linux-gnu" ]
++        if (is_musl) {
++          cflags += [ "--target=aarch64-linux-musl" ]
++          ldflags += [ "--target=aarch64-linux-musl" ]
++        } else {
++          cflags += [ "--target=aarch64-linux-gnu" ]
++          ldflags += [ "--target=aarch64-linux-gnu" ]
++        }
+       }
+     } else if (current_cpu == "mipsel" && !is_nacl) {
+       ldflags += [ "-Wl,--hash-style=sysv" ]
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -39,3 +39,22 @@
+     current_os = host_os
+   }
+ }
++
++gcc_toolchain("v8_snapshot_cross") {
++  cc = getenv("BUILD_CC")
++  cxx = getenv("BUILD_CXX")
++  ar = getenv("BUILD_AR")
++  nm = getenv("BUILD_NM")
++  ld = cxx
++
++  extra_cflags = getenv("BUILD_CFLAGS")
++  extra_cppflags = getenv("BUILD_CPPFLAGS")
++  extra_cxxflags = getenv("BUILD_CXXFLAGS")
++  extra_ldflags = getenv("BUILD_LDFLAGS")
++
++  toolchain_args = {
++    current_cpu = host_cpu
++    current_os = host_os
++    v8_current_cpu = target_cpu
++  }
++}
+--- a/build/config/linux/pkg_config.gni.orig
++++ b/build/config/linux/pkg_config.gni
+@@ -91,7 +91,7 @@
+   assert(defined(invoker.packages),
+          "Variable |packages| must be defined to be a list in pkg_config.")
+   config(target_name) {
+-    if (host_toolchain == current_toolchain) {
++    if (current_cpu != target_cpu) {
+       args = host_pkg_config_args + invoker.packages
+     } else {
+       args = pkg_config_args + invoker.packages
diff --git a/srcpkgs/chromium/patches/unbundled-cross-toolchain.patch b/srcpkgs/chromium/patches/unbundled-cross-toolchain.patch
new file mode 100644
index 000000000000..c3f2294ac4b2
--- /dev/null
+++ b/srcpkgs/chromium/patches/unbundled-cross-toolchain.patch
@@ -0,0 +1,12 @@
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -35,7 +35,7 @@
+   extra_ldflags = getenv("BUILD_LDFLAGS")
+ 
+   toolchain_args = {
+-    current_cpu = current_cpu
+-    current_os = current_os
++    current_cpu = host_cpu
++    current_os = host_os
+   }
+ }
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index a26d99aa08a9..2e2ae4399185 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -10,7 +10,6 @@ license="BSD-3-Clause"
 homepage="https://www.chromium.org/"
 distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
 checksum=6446db535c02c461c7e5c8d294a0300db03abba791f97f0c70bc52255aedb9bf
-nocross=yes
 
 lib32disabled=yes
 
@@ -24,8 +23,8 @@ desc_option_pulseaudio="Enable support for PulseAudio"
 desc_option_sndio="Enable support for sndio"
 desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
 
-hostmakedepends="$(vopt_if clang "clang lld llvm12") python pkgconf perl gperf bison ninja nodejs hwids
- libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk)"
+hostmakedepends="$(vopt_if clang "clang lld llvm12") python python3 pkgconf perl gperf bison ninja nodejs hwids
+ libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk) wayland-devel"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -34,7 +33,7 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
  libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
  minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
- re2-devel fontconfig-devel freetype-devel opus-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel libatomic-devel
  ffmpeg-devel libva-devel python-setuptools xcb-proto libcurl-devel
  $(vopt_if pipewire pipewire-devel) $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
@@ -43,6 +42,26 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc64*-musl) makedepends+=" libucontext-devel" ;;
 esac
 
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
+	 libjpeg-turbo-devel libXi-devel nss-devel libpng-devel libwebp-devel harfbuzz-devel
+	 libxml2-devel $(vopt_if pulseaudio pulseaudio-devel) libxslt-devel libxkbcommon-devel
+	 $(vopt_if pipewire pipewire-devel) ffmpeg-devel opus-devel pango-devel libva-devel
+	 libcurl-devel snappy-devel re2-devel libXrandr-devel libXcomposite-devel cups-devel
+	 mit-krb5-devel alsa-lib-devel"
+fi
+
+if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
+	broken="chromium (v8) can only be cross compiled if word size matches"
+fi
+
+if [ "$CROSS_BUILD" ]; then
+	case "${XBPS_TARGET_MACHINE}" in
+		aarch64*) ;;
+		*) nocross="chromium can not be cross compiled for this architecture" ;;
+	esac
+fi
+
 post_patch() {
 	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 		for f in "${FILESDIR}"/musl-patches/*.patch; do
@@ -80,6 +99,7 @@ post_patch() {
 	vsed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
 		tools/generate_shim_headers/generate_shim_headers.py
 }
+
 do_configure() {
 	local system="" conf=()
 	export -n CFLAGS CXXFLAGS LDFLAGS
@@ -163,8 +183,8 @@ do_configure() {
 		'enable_nacl_nonsfi=false'
 
 		'use_sysroot=false'
-		'custom_toolchain="//build/toolchain/linux/unbundle:default"'
-		'host_toolchain="//build/toolchain/linux/unbundle:default"'
+
+		'host_pkg_config="/usr/bin/pkg-config"'
 
 		"is_clang=$(vopt_if clang true false)"
 		"use_lld=$(vopt_if clang true false)"
@@ -190,6 +210,7 @@ do_configure() {
 		'enable_hangout_services_extension=true'
 
 		'use_system_harfbuzz=true'
+		'use_system_wayland_scanner=true'
 
 		'use_cups=true'
 
@@ -229,11 +250,28 @@ do_configure() {
 		'chrome_pgo_phase=0'
 	)
 
+	if [ "$CROSS_BUILD" ]; then
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:host"'
+			'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:v8_snapshot_cross"'
+		)
+	else
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:default"'
+		)
+	fi
+
 	# this does not work on ppc64 yet
 	case "$XBPS_TARGET_MACHINE" in
 		ppc64*) conf+=( "enable_jxl_decoder=false" );;
 	esac
 
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		conf+=( 'is_musl=true' )
+	fi
+
 	case "${XBPS_TARGET_MACHINE}" in
 		x86_64*) conf+=( 'target_cpu="x64"' ) ;;
 		i686*) conf+=( 'target_cpu="x86"' ) ;;
@@ -242,29 +280,66 @@ do_configure() {
 		ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
 	esac
 
+	if [ "$CROSS_BUILD" ]; then
+		case "${XBPS_MACHINE}" in
+			x86_64*) conf+=( 'host_cpu="x64"' ) ;;
+			i686*) conf+=( 'host_cpu="x86"' ) ;;
+			arm*) conf+=( 'host_cpu="arm"' ) ;;
+			aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
+			ppc64*) conf+=( 'host_cpu="ppc64"' ) ;;
+		esac
+	fi
+
 	if [ "$build_option_clang" ]; then
+		local gcc_version=$(gcc -dumpversion)
+		local clang_version=$(clang -dumpversion)
 		export CC=clang
 		export CXX=clang++
 		export AR=llvm-ar
 		export NM=llvm-nm
 		export CFLAGS="-Wno-unknown-warning-option"
 		export CXXFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CC=clang
+		export BUILD_CXX=clang++
+		export BUILD_AR=llvm-ar
+		export BUILD_NM=llvm-nm
+		export BUILD_CFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
+		if [ "$CROSS_BUILD" ]; then
+			CFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			CXXFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc++ -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			export LDFLAGS="--gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE}"
+		fi
 	fi
 
 	out/Release/gn gen out/Release --args="${conf[*]}"
 }
+
 do_build() {
 	if [ "$build_option_clang" ]; then
+		local gcc_version=$(gcc -dumpversion)
+		local clang_version=$(clang -dumpversion)
 		export CC=clang
 		export CXX=clang++
 		export AR=llvm-ar
 		export NM=llvm-nm
 		export CFLAGS="-Wno-unknown-warning-option"
 		export CXXFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CC=clang
+		export BUILD_CXX=clang++
+		export BUILD_AR=llvm-ar
+		export BUILD_NM=llvm-nm
+		export BUILD_CFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
+		if [ "$CROSS_BUILD" ]; then
+			CFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			CXXFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc++ -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			export LDFLAGS="--gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE}"
+		fi
 	fi
-
-	ninja -C out/Release ${makejobs} chrome chromedriver mksnapshot chrome_crashpad_handler
+	ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
 }
+
 do_install() {
 	vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
 	vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR REVIEW] chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
@ 2021-10-01 18:25 ` ericonr
  2021-10-01 18:32 ` Duncaen
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ericonr @ 2021-10-01 18:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#discussion_r720456629

Comment:
Is deduplicating this block possible?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR REVIEW] chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
  2021-10-01 18:25 ` [PR REVIEW] " ericonr
@ 2021-10-01 18:32 ` Duncaen
  2021-10-01 18:36 ` Duncaen
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Duncaen @ 2021-10-01 18:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#discussion_r720461409

Comment:
We can't set it at the toplevel because the I think xbps-src adds its own CFLAGS etc, we theoretically don't need it in do_build, but it makes working on the build a whole lot easier since ninja might need to rebuild some ninja files.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR REVIEW] chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
  2021-10-01 18:25 ` [PR REVIEW] " ericonr
  2021-10-01 18:32 ` Duncaen
@ 2021-10-01 18:36 ` Duncaen
  2021-10-01 18:38 ` Duncaen
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Duncaen @ 2021-10-01 18:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#discussion_r720463558

Comment:
Maybe it could be moved into a function like `_clang_env` which is called from both.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (2 preceding siblings ...)
  2021-10-01 18:36 ` Duncaen
@ 2021-10-01 18:38 ` Duncaen
  2021-10-01 18:38 ` Duncaen
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Duncaen @ 2021-10-01 18:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

New comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#issuecomment-932465702

Comment:
Im also not sure if it would be generally good to get the clang compiler setup for cross compiling by either a wrapper that looks for `--target=` arguments or maybe setting up `$triplet-clang` symlinks, this way there could be configuration files used which can set additional flags.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (3 preceding siblings ...)
  2021-10-01 18:38 ` Duncaen
@ 2021-10-01 18:38 ` Duncaen
  2021-10-01 18:38 ` Duncaen
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Duncaen @ 2021-10-01 18:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

New comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#issuecomment-932465702

Comment:
I'm also not sure if it would be generally good to get the clang compiler setup for cross compiling by either a wrapper that looks for `--target=` arguments or maybe setting up `$triplet-clang` symlinks, this way there could be configuration files used which can set additional flags.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (4 preceding siblings ...)
  2021-10-01 18:38 ` Duncaen
@ 2021-10-01 18:38 ` Duncaen
  2021-10-01 18:44 ` [PR REVIEW] " ericonr
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Duncaen @ 2021-10-01 18:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

New comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#issuecomment-932465702

Comment:
I'm also not sure if it would be generally good to get the clang compiler setup for cross compiling by either a wrapper that looks for `--target=` arguments or maybe setting up `$triplet-clang` symlinks, this way there could be configuration files used which can set additional flags.

https://clang.llvm.org/docs/UsersManual.html#configuration-files

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR REVIEW] chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (5 preceding siblings ...)
  2021-10-01 18:38 ` Duncaen
@ 2021-10-01 18:44 ` ericonr
  2021-10-01 18:46 ` ericonr
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ericonr @ 2021-10-01 18:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#discussion_r720468189

Comment:
Sounds reasonable to me.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (6 preceding siblings ...)
  2021-10-01 18:44 ` [PR REVIEW] " ericonr
@ 2021-10-01 18:46 ` ericonr
  2021-10-14 18:50 ` [PR PATCH] [Updated] " Duncaen
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ericonr @ 2021-10-01 18:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#issuecomment-932470427

Comment:
> $triplet-clang symlinks, this way there could be configuration files used which can set additional flags.

That sounds interesting and possibly cleaner, though unless we ship the configuration files in the gcc template, they still need to be generated in the template (or with a build helper?) in order to capture the gcc version.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (7 preceding siblings ...)
  2021-10-01 18:46 ` ericonr
@ 2021-10-14 18:50 ` Duncaen
  2021-10-14 18:54 ` Duncaen
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Duncaen @ 2021-10-14 18:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

There is an updated pull request by Duncaen against master on the void-packages repository

https://github.com/Duncaen/void-packages chromium-94
https://github.com/void-linux/void-packages/pull/33208

chromium: aarch64 cross build support
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/33208.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-94-33208.patch --]
[-- Type: text/x-diff, Size: 3863 bytes --]

From ae033d75311570e19df3f604fff2c6be51dfdbbe Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 14 Oct 2021 20:48:26 +0200
Subject: [PATCH] chromium: update to 94.0.4606.81.

---
 srcpkgs/chromium/patches/python3.10.patch | 57 +++++++++++++++++++++++
 srcpkgs/chromium/template                 |  4 +-
 2 files changed, 59 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/chromium/patches/python3.10.patch

diff --git a/srcpkgs/chromium/patches/python3.10.patch b/srcpkgs/chromium/patches/python3.10.patch
new file mode 100644
index 000000000000..9ce6ee71202e
--- /dev/null
+++ b/srcpkgs/chromium/patches/python3.10.patch
@@ -0,0 +1,57 @@
+diff -ur ./third_party/jinja2.orig/runtime.py ./third_party/jinja2/runtime.py
+--- a/third_party/jinja2.orig/runtime.py	2021-09-24 00:26:35.000000000 -0400
++++ b/third_party/jinja2/runtime.py	2021-10-13 11:51:16.493986556 -0400
+@@ -315,7 +315,7 @@
+ 
+ # register the context as mapping if possible
+ try:
+-    from collections import Mapping
++    from collections.abc import Mapping
+     Mapping.register(Context)
+ except ImportError:
+     pass
+diff -ur ./third_party/jinja2.orig/sandbox.py ./third_party/jinja2/sandbox.py
+--- a/third_party/jinja2.orig/sandbox.py	2021-09-24 00:26:35.000000000 -0400
++++ b/third_party/jinja2/sandbox.py	2021-10-13 11:50:51.513980399 -0400
+@@ -14,7 +14,7 @@
+ """
+ import types
+ import operator
+-from collections import Mapping
++from collections.abc import Mapping
+ from jinja2.environment import Environment
+ from jinja2.exceptions import SecurityError
+ from jinja2._compat import string_types, PY2
+@@ -79,7 +79,7 @@
+     pass
+ 
+ #: register Python 2.6 abstract base classes
+-from collections import MutableSet, MutableMapping, MutableSequence
++from collections.abc import MutableSet, MutableMapping, MutableSequence
+ _mutable_set_types += (MutableSet,)
+ _mutable_mapping_types += (MutableMapping,)
+ _mutable_sequence_types += (MutableSequence,)
+diff -ur ./third_party/jinja2.orig/tests.py ./third_party/jinja2/tests.py
+--- a/third_party/jinja2.orig/tests.py	2021-09-24 00:26:35.000000000 -0400
++++ b/third_party/jinja2/tests.py	2021-10-13 11:51:51.693995227 -0400
+@@ -10,7 +10,7 @@
+ """
+ import operator
+ import re
+-from collections import Mapping
++from collections.abc import Mapping
+ from jinja2.runtime import Undefined
+ from jinja2._compat import text_type, string_types, integer_types
+ import decimal
+diff -ur ./third_party/jinja2.orig/utils.py ./third_party/jinja2/utils.py
+--- a/third_party/jinja2.orig/utils.py	2021-09-24 00:26:35.000000000 -0400
++++ b/third_party/jinja2/utils.py	2021-10-13 11:51:34.969991106 -0400
+@@ -482,7 +482,7 @@
+ 
+ # register the LRU cache as mutable mapping if possible
+ try:
+-    from collections import MutableMapping
++    from collections.abc import MutableMapping
+     MutableMapping.register(LRUCache)
+ except ImportError:
+     pass
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index a26d99aa08a9..c57c29508dfc 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
 # Template file for 'chromium'
 pkgname=chromium
 # See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=94.0.4606.61
+version=94.0.4606.81
 revision=1
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
@@ -9,7 +9,7 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
 license="BSD-3-Clause"
 homepage="https://www.chromium.org/"
 distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=6446db535c02c461c7e5c8d294a0300db03abba791f97f0c70bc52255aedb9bf
+checksum=7071aa2b2caf48094c2ae816395948b4daec940606f4982ad5bbf68e5d2de598
 nocross=yes
 
 lib32disabled=yes

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (8 preceding siblings ...)
  2021-10-14 18:50 ` [PR PATCH] [Updated] " Duncaen
@ 2021-10-14 18:54 ` Duncaen
  2021-11-17  1:14 ` ericonr
  2021-11-17  1:14 ` [PR PATCH] [Closed]: " ericonr
  11 siblings, 0 replies; 13+ messages in thread
From: Duncaen @ 2021-10-14 18:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

There is an updated pull request by Duncaen against master on the void-packages repository

https://github.com/Duncaen/void-packages chromium-94
https://github.com/void-linux/void-packages/pull/33208

chromium: aarch64 cross build support
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/33208.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-94-33208.patch --]
[-- Type: text/x-diff, Size: 11226 bytes --]

From f84cb76feb3fd33af6c1de40ecc8535e022f4ee5 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Sun, 26 Sep 2021 15:47:29 +0200
Subject: [PATCH] chromium: aarch64 cross build support

---
 srcpkgs/chromium/patches/cross-build.patch    | 65 +++++++++++++
 .../patches/unbundled-cross-toolchain.patch   | 12 +++
 srcpkgs/chromium/template                     | 91 +++++++++++++++++--
 3 files changed, 160 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/chromium/patches/cross-build.patch
 create mode 100644 srcpkgs/chromium/patches/unbundled-cross-toolchain.patch

diff --git a/srcpkgs/chromium/patches/cross-build.patch b/srcpkgs/chromium/patches/cross-build.patch
new file mode 100644
index 000000000000..63b89395cb80
--- /dev/null
+++ b/srcpkgs/chromium/patches/cross-build.patch
@@ -0,0 +1,65 @@
+--- a/build/config/compiler/BUILD.gn.orig
++++ b/build/config/compiler/BUILD.gn
+@@ -58,6 +58,10 @@
+ }
+ 
+ declare_args() {
++  is_musl = false
++}
++
++declare_args() {
+   # Normally, Android builds are lightly optimized, even for debug builds, to
+   # keep binary size down. Setting this flag to true disables such optimization
+   android_full_debug = false
+@@ -880,8 +884,13 @@
+       }
+     } else if (current_cpu == "arm64") {
+       if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
+-        cflags += [ "--target=aarch64-linux-gnu" ]
+-        ldflags += [ "--target=aarch64-linux-gnu" ]
++        if (is_musl) {
++          cflags += [ "--target=aarch64-linux-musl" ]
++          ldflags += [ "--target=aarch64-linux-musl" ]
++        } else {
++          cflags += [ "--target=aarch64-linux-gnu" ]
++          ldflags += [ "--target=aarch64-linux-gnu" ]
++        }
+       }
+     } else if (current_cpu == "mipsel" && !is_nacl) {
+       ldflags += [ "-Wl,--hash-style=sysv" ]
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -39,3 +39,22 @@
+     current_os = host_os
+   }
+ }
++
++gcc_toolchain("v8_snapshot_cross") {
++  cc = getenv("BUILD_CC")
++  cxx = getenv("BUILD_CXX")
++  ar = getenv("BUILD_AR")
++  nm = getenv("BUILD_NM")
++  ld = cxx
++
++  extra_cflags = getenv("BUILD_CFLAGS")
++  extra_cppflags = getenv("BUILD_CPPFLAGS")
++  extra_cxxflags = getenv("BUILD_CXXFLAGS")
++  extra_ldflags = getenv("BUILD_LDFLAGS")
++
++  toolchain_args = {
++    current_cpu = host_cpu
++    current_os = host_os
++    v8_current_cpu = target_cpu
++  }
++}
+--- a/build/config/linux/pkg_config.gni.orig
++++ b/build/config/linux/pkg_config.gni
+@@ -91,7 +91,7 @@
+   assert(defined(invoker.packages),
+          "Variable |packages| must be defined to be a list in pkg_config.")
+   config(target_name) {
+-    if (host_toolchain == current_toolchain) {
++    if (current_cpu != target_cpu) {
+       args = host_pkg_config_args + invoker.packages
+     } else {
+       args = pkg_config_args + invoker.packages
diff --git a/srcpkgs/chromium/patches/unbundled-cross-toolchain.patch b/srcpkgs/chromium/patches/unbundled-cross-toolchain.patch
new file mode 100644
index 000000000000..c3f2294ac4b2
--- /dev/null
+++ b/srcpkgs/chromium/patches/unbundled-cross-toolchain.patch
@@ -0,0 +1,12 @@
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -35,7 +35,7 @@
+   extra_ldflags = getenv("BUILD_LDFLAGS")
+ 
+   toolchain_args = {
+-    current_cpu = current_cpu
+-    current_os = current_os
++    current_cpu = host_cpu
++    current_os = host_os
+   }
+ }
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index a26d99aa08a9..2e2ae4399185 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -10,7 +10,6 @@ license="BSD-3-Clause"
 homepage="https://www.chromium.org/"
 distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
 checksum=6446db535c02c461c7e5c8d294a0300db03abba791f97f0c70bc52255aedb9bf
-nocross=yes
 
 lib32disabled=yes
 
@@ -24,8 +23,8 @@ desc_option_pulseaudio="Enable support for PulseAudio"
 desc_option_sndio="Enable support for sndio"
 desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
 
-hostmakedepends="$(vopt_if clang "clang lld llvm12") python pkgconf perl gperf bison ninja nodejs hwids
- libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk)"
+hostmakedepends="$(vopt_if clang "clang lld llvm12") python python3 pkgconf perl gperf bison ninja nodejs hwids
+ libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk) wayland-devel"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -34,7 +33,7 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
  libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
  minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
- re2-devel fontconfig-devel freetype-devel opus-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel libatomic-devel
  ffmpeg-devel libva-devel python-setuptools xcb-proto libcurl-devel
  $(vopt_if pipewire pipewire-devel) $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
@@ -43,6 +42,26 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc64*-musl) makedepends+=" libucontext-devel" ;;
 esac
 
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
+	 libjpeg-turbo-devel libXi-devel nss-devel libpng-devel libwebp-devel harfbuzz-devel
+	 libxml2-devel $(vopt_if pulseaudio pulseaudio-devel) libxslt-devel libxkbcommon-devel
+	 $(vopt_if pipewire pipewire-devel) ffmpeg-devel opus-devel pango-devel libva-devel
+	 libcurl-devel snappy-devel re2-devel libXrandr-devel libXcomposite-devel cups-devel
+	 mit-krb5-devel alsa-lib-devel"
+fi
+
+if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
+	broken="chromium (v8) can only be cross compiled if word size matches"
+fi
+
+if [ "$CROSS_BUILD" ]; then
+	case "${XBPS_TARGET_MACHINE}" in
+		aarch64*) ;;
+		*) nocross="chromium can not be cross compiled for this architecture" ;;
+	esac
+fi
+
 post_patch() {
 	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 		for f in "${FILESDIR}"/musl-patches/*.patch; do
@@ -80,6 +99,7 @@ post_patch() {
 	vsed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
 		tools/generate_shim_headers/generate_shim_headers.py
 }
+
 do_configure() {
 	local system="" conf=()
 	export -n CFLAGS CXXFLAGS LDFLAGS
@@ -163,8 +183,8 @@ do_configure() {
 		'enable_nacl_nonsfi=false'
 
 		'use_sysroot=false'
-		'custom_toolchain="//build/toolchain/linux/unbundle:default"'
-		'host_toolchain="//build/toolchain/linux/unbundle:default"'
+
+		'host_pkg_config="/usr/bin/pkg-config"'
 
 		"is_clang=$(vopt_if clang true false)"
 		"use_lld=$(vopt_if clang true false)"
@@ -190,6 +210,7 @@ do_configure() {
 		'enable_hangout_services_extension=true'
 
 		'use_system_harfbuzz=true'
+		'use_system_wayland_scanner=true'
 
 		'use_cups=true'
 
@@ -229,11 +250,28 @@ do_configure() {
 		'chrome_pgo_phase=0'
 	)
 
+	if [ "$CROSS_BUILD" ]; then
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:host"'
+			'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:v8_snapshot_cross"'
+		)
+	else
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:default"'
+		)
+	fi
+
 	# this does not work on ppc64 yet
 	case "$XBPS_TARGET_MACHINE" in
 		ppc64*) conf+=( "enable_jxl_decoder=false" );;
 	esac
 
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		conf+=( 'is_musl=true' )
+	fi
+
 	case "${XBPS_TARGET_MACHINE}" in
 		x86_64*) conf+=( 'target_cpu="x64"' ) ;;
 		i686*) conf+=( 'target_cpu="x86"' ) ;;
@@ -242,29 +280,66 @@ do_configure() {
 		ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
 	esac
 
+	if [ "$CROSS_BUILD" ]; then
+		case "${XBPS_MACHINE}" in
+			x86_64*) conf+=( 'host_cpu="x64"' ) ;;
+			i686*) conf+=( 'host_cpu="x86"' ) ;;
+			arm*) conf+=( 'host_cpu="arm"' ) ;;
+			aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
+			ppc64*) conf+=( 'host_cpu="ppc64"' ) ;;
+		esac
+	fi
+
 	if [ "$build_option_clang" ]; then
+		local gcc_version=$(gcc -dumpversion)
+		local clang_version=$(clang -dumpversion)
 		export CC=clang
 		export CXX=clang++
 		export AR=llvm-ar
 		export NM=llvm-nm
 		export CFLAGS="-Wno-unknown-warning-option"
 		export CXXFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CC=clang
+		export BUILD_CXX=clang++
+		export BUILD_AR=llvm-ar
+		export BUILD_NM=llvm-nm
+		export BUILD_CFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
+		if [ "$CROSS_BUILD" ]; then
+			CFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			CXXFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc++ -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			export LDFLAGS="--gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE}"
+		fi
 	fi
 
 	out/Release/gn gen out/Release --args="${conf[*]}"
 }
+
 do_build() {
 	if [ "$build_option_clang" ]; then
+		local gcc_version=$(gcc -dumpversion)
+		local clang_version=$(clang -dumpversion)
 		export CC=clang
 		export CXX=clang++
 		export AR=llvm-ar
 		export NM=llvm-nm
 		export CFLAGS="-Wno-unknown-warning-option"
 		export CXXFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CC=clang
+		export BUILD_CXX=clang++
+		export BUILD_AR=llvm-ar
+		export BUILD_NM=llvm-nm
+		export BUILD_CFLAGS="-Wno-unknown-warning-option"
+		export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
+		if [ "$CROSS_BUILD" ]; then
+			CFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			CXXFLAGS+=" --gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE} -nostdinc++ -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET} -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward -nostdinc -isystem ${XBPS_CROSS_BASE}/usr/include -isystem /usr/lib/clang/${clang_version}/include"
+			export LDFLAGS="--gcc-toolchain=/usr --sysroot=${XBPS_CROSS_BASE}"
+		fi
 	fi
-
-	ninja -C out/Release ${makejobs} chrome chromedriver mksnapshot chrome_crashpad_handler
+	ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
 }
+
 do_install() {
 	vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
 	vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (9 preceding siblings ...)
  2021-10-14 18:54 ` Duncaen
@ 2021-11-17  1:14 ` ericonr
  2021-11-17  1:14 ` [PR PATCH] [Closed]: " ericonr
  11 siblings, 0 replies; 13+ messages in thread
From: ericonr @ 2021-11-17  1:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/33208#issuecomment-971014546

Comment:
Done in cea371b26f110bd4080c5b646cdccbd5dbac5f4a

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Closed]: chromium: aarch64 cross build support
  2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
                   ` (10 preceding siblings ...)
  2021-11-17  1:14 ` ericonr
@ 2021-11-17  1:14 ` ericonr
  11 siblings, 0 replies; 13+ messages in thread
From: ericonr @ 2021-11-17  1:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

There's a closed pull request on the void-packages repository

chromium: aarch64 cross build support
https://github.com/void-linux/void-packages/pull/33208

Description:
[ci skip]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-11-17  1:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 14:31 [PR PATCH] chromium: aarch64 cross build support Duncaen
2021-10-01 18:25 ` [PR REVIEW] " ericonr
2021-10-01 18:32 ` Duncaen
2021-10-01 18:36 ` Duncaen
2021-10-01 18:38 ` Duncaen
2021-10-01 18:38 ` Duncaen
2021-10-01 18:38 ` Duncaen
2021-10-01 18:44 ` [PR REVIEW] " ericonr
2021-10-01 18:46 ` ericonr
2021-10-14 18:50 ` [PR PATCH] [Updated] " Duncaen
2021-10-14 18:54 ` Duncaen
2021-11-17  1:14 ` ericonr
2021-11-17  1:14 ` [PR PATCH] [Closed]: " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).