Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [WIP] chromium: enable cross.
@ 2020-11-23  9:03 fosslinux
  2020-11-23  9:04 ` fosslinux
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fosslinux @ 2020-11-23  9:03 UTC (permalink / raw)
  To: ml

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

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

https://github.com/fosslinux/void-packages cross-chromium
https://github.com/void-linux/void-packages/pull/26634

[WIP] chromium: enable cross.
This is a super super big WIP. **Do not expect to work.** I am only PRing so interested parties might be able to provide assistance.

This was built for Chromium 86 for `aarch64` and `aarch64-musl`. `armv7l-musl` was in progress IIRC but didn't build. This has been runtime tested by @q66 for aarch64; it launches, but tabs crash.

I plan to revisit this this weekend. If people feel like building in the meantime, go ahead. I also have no idea if this works on the latest version of chromium.

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

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

From 7957723a71a14a65f9ebc02ce5a77fdd9ba12d5f Mon Sep 17 00:00:00 2001
From: fosslinux <fosslinux@aussies.space>
Date: Mon, 23 Nov 2020 19:21:44 +1100
Subject: [PATCH] chromium: enable cross.

---
 .../files/musl-patches/armv7l-musl.patch      |  15 ++
 srcpkgs/chromium/patches/cross-include.patch  |  24 ++++
 .../chromium/patches/native-theme-float.patch |  14 ++
 srcpkgs/chromium/patches/signbit.patch        |  35 +++++
 .../chromium/patches/toolchain-cross.patch    |  11 ++
 srcpkgs/chromium/template                     | 128 +++++++++++++++---
 6 files changed, 206 insertions(+), 21 deletions(-)
 create mode 100644 srcpkgs/chromium/files/musl-patches/armv7l-musl.patch
 create mode 100644 srcpkgs/chromium/patches/cross-include.patch
 create mode 100644 srcpkgs/chromium/patches/native-theme-float.patch
 create mode 100644 srcpkgs/chromium/patches/signbit.patch
 create mode 100644 srcpkgs/chromium/patches/toolchain-cross.patch

diff --git a/srcpkgs/chromium/files/musl-patches/armv7l-musl.patch b/srcpkgs/chromium/files/musl-patches/armv7l-musl.patch
new file mode 100644
index 00000000000..6d35fbc5563
--- /dev/null
+++ b/srcpkgs/chromium/files/musl-patches/armv7l-musl.patch
@@ -0,0 +1,15 @@
+user_vfp dosen't exist on musl's sys/user.h either (actually pretty much on
+no modern libcs).
+
+--- third_party/crashpad/crashpad/util/linux/thread_info.h	2020-10-04 19:04:27.902955377 +1100
++++ third_party/crashpad/crashpad/util/linux/thread_info.h	2020-10-04 19:04:30.426969313 +1100
+@@ -304,9 +304,6 @@
+                 "Size mismatch");
+ #elif defined(ARCH_CPU_ARMEL)
+   static_assert(sizeof(f32_t::fpregs) == sizeof(user_fpregs), "Size mismatch");
+-#if !defined(__GLIBC__)
+-  static_assert(sizeof(f32_t::vfp) == sizeof(user_vfp), "Size mismatch");
+-#endif
+ #elif defined(ARCH_CPU_ARM64)
+   static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
+ #elif defined(ARCH_CPU_MIPS_FAMILY)
diff --git a/srcpkgs/chromium/patches/cross-include.patch b/srcpkgs/chromium/patches/cross-include.patch
new file mode 100644
index 00000000000..0596fd3f2a8
--- /dev/null
+++ b/srcpkgs/chromium/patches/cross-include.patch
@@ -0,0 +1,24 @@
+For an unknown reason in cross it dosen't detect nss subdirectories.
+
+--- crypto/nss_util.cc	2020-09-26 17:36:50.201101961 +1000
++++ crypto/nss_util.cc	2020-09-26 17:35:35.329796220 +1000
+@@ -4,7 +4,7 @@
+ 
+ #include "crypto/nss_util.h"
+ 
+-#include <nss.h>
++#include <nss/nss.h>
+ #include <pk11pub.h>
+ #include <plarena.h>
+ #include <prerror.h>
+--- net/cert/x509_util_nss.cc	2020-09-27 21:11:11.393820715 +1000
++++ net/cert/x509_util_nss.cc	2020-09-27 21:11:29.340897670 +1000
+@@ -7,7 +7,7 @@
+ #include <cert.h>  // Must be included before certdb.h
+ #include <certdb.h>
+ #include <cryptohi.h>
+-#include <nss.h>
++#include <nss/nss.h>
+ #include <pk11pub.h>
+ #include <prerror.h>
+ #include <secder.h>
diff --git a/srcpkgs/chromium/patches/native-theme-float.patch b/srcpkgs/chromium/patches/native-theme-float.patch
new file mode 100644
index 00000000000..546f30a4981
--- /dev/null
+++ b/srcpkgs/chromium/patches/native-theme-float.patch
@@ -0,0 +1,14 @@
+base::ClampToRange expects a float for the first argument but std::fabs returns
+a double. Cast to a float.
+
+--- ui/native_theme/native_theme_base.cc	2020-09-28 10:07:35.485919210 +1000
++++ ui/native_theme/native_theme_base.cc	2020-09-28 10:07:17.867786053 +1000
+@@ -1483,7 +1483,7 @@
+   SkScalar min_diff =
+       base::ClampToRange((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
+   SkScalar diff =
+-      base::ClampToRange(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
++      base::ClampToRange((float)fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
+ 
+   if (hsv1[2] + hsv2[2] > 1.0)
+     diff = -diff;
diff --git a/srcpkgs/chromium/patches/signbit.patch b/srcpkgs/chromium/patches/signbit.patch
new file mode 100644
index 00000000000..75b809fd3b9
--- /dev/null
+++ b/srcpkgs/chromium/patches/signbit.patch
@@ -0,0 +1,35 @@
+For some files on cross, C++ requires the cmath header, when only the C
+math.h header is included. Include cmath where nessecary.
+
+--- third_party/angle/src/compiler/translator/InfoSink.h	2020-09-26 11:53:15.195689884 +1000
++++ third_party/angle/src/compiler/translator/InfoSink.h	2020-09-26 12:00:55.341995386 +1000
+@@ -7,7 +7,12 @@
+ #ifndef COMPILER_TRANSLATOR_INFOSINK_H_
+ #define COMPILER_TRANSLATOR_INFOSINK_H_
+ 
+-#include <math.h>
++#ifdef __cplusplus
++# include <cmath>
++using std::signbit;
++#else
++# include <math.h>
++#endif
+ #include <stdlib.h>
+ #include "compiler/translator/Common.h"
+ #include "compiler/translator/Severity.h"
+--- third_party/skia/src/sksl/SkSLString.cpp	2020-09-26 17:43:56.042840919 +1000
++++ third_party/skia/src/sksl/SkSLString.cpp	2020-09-26 17:44:25.480961135 +1000
+@@ -15,6 +15,13 @@
+ #include <sstream>
+ #include <string>
+ 
++#ifdef __cplusplus
++# include <cmath>
++using std::signbit;
++#else
++# include <math.h>
++#endif
++
+ namespace SkSL {
+ 
+ String String::printf(const char* fmt, ...) {
diff --git a/srcpkgs/chromium/patches/toolchain-cross.patch b/srcpkgs/chromium/patches/toolchain-cross.patch
new file mode 100644
index 00000000000..f0182da0523
--- /dev/null
+++ b/srcpkgs/chromium/patches/toolchain-cross.patch
@@ -0,0 +1,11 @@
+--- build/toolchain/linux/unbundle/BUILD.gn	2020-09-28 11:06:47.393498030 +1000
++++ build/toolchain/linux/unbundle/BUILD.gn	2020-09-28 11:05:56.539213511 +1000
+@@ -35,7 +35,7 @@
+   extra_ldflags = getenv("BUILD_LDFLAGS")
+ 
+   toolchain_args = {
+-    current_cpu = current_cpu
++    current_cpu = getenv("BUILD_CURRENT_CPU")
+     current_os = current_os
+   }
+ }
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index b31a09ed1f6..0635daff2d4 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=29a8e4ea82edec2fdcf34ece68323bec7ab90f3d5669e6b77f58cff9c278f741
-nocross=yes
 
 lib32disabled=yes
 nodebug=yes
@@ -23,8 +22,13 @@ desc_option_vaapi="Enable support for VA-API"
 desc_option_pulseaudio="Enable support for PulseAudio"
 desc_option_sndio="Enable support for sndio"
 
-hostmakedepends="$(vopt_if clang clang) python pkgconf perl gperf bison ninja nodejs hwids
- libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk)"
+hostmakedepends="$(vopt_if clang clang) python pkgconf perl gperf bison ninja
+ nodejs hwids libatomic-devel libevent-devel libglib-devel libX11-devel
+ $(vopt_if js_optimize openjdk) pciutils-devel libXext-devel libglvnd-devel
+ libjpeg-turbo-devel libXi-devel libXcomposite-devel libXcursor-devel
+ libXdamage-devel libXfixes-devel libXrender-devel libXtst-devel
+ harfbuzz-devel dbus-devel nss-devel libva-devel libwebp-devel snappy-devel
+ re2-devel opus-devel libXrandr-devel ffmpeg-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 +38,7 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- ffmpeg-devel libva-devel python-setuptools xcb-proto
+ ffmpeg-devel libva-devel python-setuptools xcb-proto libatomic-devel
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -47,7 +51,7 @@ build_options_default="clang js_optimize vaapi pulseaudio"
 post_patch() {
 	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 		for f in "${FILESDIR}"/musl-patches/*.patch; do
-			echo "Applying $f"
+			echo "Applying $(basename $f)"
 			patch -Np0 -i "$f"
 		done
 	fi
@@ -55,7 +59,7 @@ post_patch() {
 	case "${XBPS_TARGET_MACHINE}" in
 	i686*)
 		for f in "${FILESDIR}"/i686-patches/*.patch; do
-			echo "Applying $f"
+			echo "Applying $(basename $f)"
 			patch -Np0 -i "$f"
 		done
 		;;
@@ -77,20 +81,53 @@ post_patch() {
 	vsed -i 's,^update_readme$,#update_readme,' \
 		third_party/libvpx/generate_gni.sh
 }
+
 do_configure() {
 	local system="" conf=()
-	export -n CFLAGS CXXFLAGS LDFLAGS
 
 	if [ "$build_option_clang" ]; then
-		export CC=clang
-		export CXX=clang++
+		export CC="clang"
+		export CXX="clang++"
+		export BUILD_CC="clang"
+		export BUILD_CXX="clang++"
 	fi
 
-	export LDFLAGS="-pthread"
+	export BUILD_NM="nm"
+	export BUILD_AR="ar"
+
+	if [ "$build_option_clang" ]; then
+		# Add the GCC path
+		export CXXFLAGS+=" -I${XBPS_CROSS_BASE}/usr/include/c++/9.3.0/${XBPS_CROSS_TRIPLET}"
+		export BUILD_CXXFLAGS+=" -I/usr/include/c++/9.3.0/${XBPS_TRIPLET}"
+		if [ "$XBPS_TARGET_LIBC" == "musl" ]; then
+			export CXXFLAGS+=" -I${XBPS_CROSS_BASE}/usr/include/c++/9.3.0 --target=${XBPS_CROSS_TRIPLET}"
+			export CFLAGS+=" --target=${XBPS_CROSS_TRIPLET}"
+			export LDFLAGS+=" --target=${XBPS_CROSS_TRIPLET}"
+		fi
+		if [ "$XBPS_LIBC" == "musl" ]; then
+			export BUILD_CXXFLAGS+=" -I/usr/include/c++/9.3.0 --target=${XBPS_TRIPLET}"
+			export BUILD_CFLAGS+=" --target=${XBPS_TRIPLET}"
+			export BUILD_LDFLAGS+=" --target=${XBPS_TRIPLET}"
+		fi
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		aarch64*)
+			export CFLAGS+=" -fPIC"
+			export CXXFLAGS+=" -fPIC"
+			;;
+		armv7l*)
+			export CFLAGS+=" -mfpu=neon -fPIC"
+			export CXXFLAGS+=" -mfpu=neon -fPIC"
+			;;
+	esac
+
+	export LDFLAGS+=" -pthread"
 
 	# compile gn early, so it can be used to generate gni stuff
 	AR="ar" CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD LD=$CXX_FOR_BUILD \
-	python2 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
+		CFLAGS= CXXFLAGS= CPPFLAGS= LDFLAGS= FFLAGS= \
+		python2 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
 
 	# we need to generate ppc64 stuff for libvpx as it's not shipped
 	# this has to be done before unbundling, but after gn is built
@@ -169,8 +206,6 @@ do_configure() {
 		"is_clang=$(vopt_if clang true false)"
 		'is_debug=false'
 		'clang_use_chrome_plugins=false'
-		'custom_toolchain="//build/toolchain/linux/unbundle:default"'
-		'host_toolchain="//build/toolchain/linux/unbundle:default"'
 		'blink_symbol_level=0'
 		'symbol_level=0'
 		'icu_use_data_file=true'
@@ -184,6 +219,20 @@ do_configure() {
 		'is_desktop_linux=true'
 	)
 
+	conf+=(
+		'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+	)
+	if [ "$CROSS_BUILD" ]; then
+		conf+=(
+			'host_toolchain="//build/toolchain/linux/unbundle:host"'
+			'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:host"'
+		)
+	else
+		conf+=(
+			'host_toolchain="//build/toolchain/linux/unbundle:default"'
+		)
+	fi
+
 	conf+=(
 		"use_vaapi=$(vopt_if vaapi true false)"
 	)
@@ -219,11 +268,15 @@ do_configure() {
 	)
 
 	# XXX: gold broken with musl and i686
-	case "${XBPS_TARGET_MACHINE}" in
-	*-musl) conf+=( 'use_gold=false' ) ;;
-	i686*) conf+=( 'use_gold=false' ) ;;
-	*) conf+=( 'use_gold=true' ) ;;
-	esac
+	if [ "$CROSS_BUILD" ]; then
+		conf+=( 'use_gold=false' )
+	else
+		case "${XBPS_TARGET_MACHINE}" in
+			*-musl) conf+=( 'use_gold=false' ) ;;
+			i686*) conf+=( 'use_gold=false' ) ;;
+			*) conf+=( 'use_gold=true' ) ;;
+		esac
+	fi
 
 	# Always support proprietary codecs.
 	# Enable H.264 support in bundled ffmpeg.
@@ -241,8 +294,8 @@ do_configure() {
 	)
 
 	# Save space by removing DLOG and DCHECK messages (about 6% reduction).
-	# conf+=" logging_like_official_build=true"
-	conf+=( fieldtrial_testing_like_official_build=true )
+	# conf+=( " logging_like_official_build=true" )
+	conf+=( 'fieldtrial_testing_like_official_build=true' )
 
 	case "${XBPS_TARGET_MACHINE}" in
 		x86_64*) conf+=( 'target_cpu="x64"' ) ;;
@@ -252,16 +305,49 @@ do_configure() {
 		ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
 	esac
 
+	case "${XBPS_MACHINE}" in
+		x86_64*)
+			conf+=( 'host_cpu="x64"' )
+			export BUILD_CURRENT_CPU="x64"
+			;;
+		i686*)
+			conf+=( 'host_cpu="x86"' )
+			export BUILD_CURRENT_CPU="x86"
+			;;
+		arm*)
+			conf+=( 'host_cpu="arm"' )
+			export BUILD_CURRENT_CPU="arm"
+			;;
+		aarch64*)
+			conf+=( 'host_cpu="arm64"' )
+			export BUILD_CURRENT_CPU="arm64"
+			;;
+		ppc64*)
+			conf+=( 'host_cpu="ppc64"' )
+			export BUILD_CURRENT_CPU="ppc64"
+			;;
+	esac
+
 	out/Release/gn gen out/Release --args="${conf[*]}"
+
+	# host files erroneously have XBPS_CROSS_BASE paths
+	find out/Release/host -name "*.ninja" \
+		-exec sed -i "s:${XBPS_CROSS_BASE}::g" {} \;
 }
+
 do_build() {
 	if [ "$build_option_clang" ]; then
 		export CC=clang
 		export CXX=clang++
 	fi
 
-	ninja -C out/Release ${makejobs} chrome chromedriver mksnapshot
+	if [ "$CROSS_BUILD" ]; then
+		ninja -C out/Release ${makejobs} chrome chromedriver
+	else
+		ninja -C out/Release ${makejobs} chrome chromedriver mksnapshot
+	fi
 }
+
 do_install() {
 	vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
 	vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver

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

* Re: [WIP] chromium: enable cross.
  2020-11-23  9:03 [PR PATCH] [WIP] chromium: enable cross fosslinux
@ 2020-11-23  9:04 ` fosslinux
  2021-11-17  1:14 ` ericonr
  2021-11-17  1:14 ` [PR PATCH] [Closed]: " ericonr
  2 siblings, 0 replies; 4+ messages in thread
From: fosslinux @ 2020-11-23  9:04 UTC (permalink / raw)
  To: ml

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

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26634#issuecomment-732025430

Comment:
Pinging @pbui 

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

* Re: [WIP] chromium: enable cross.
  2020-11-23  9:03 [PR PATCH] [WIP] chromium: enable cross fosslinux
  2020-11-23  9:04 ` fosslinux
@ 2021-11-17  1:14 ` ericonr
  2021-11-17  1:14 ` [PR PATCH] [Closed]: " ericonr
  2 siblings, 0 replies; 4+ 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/26634#issuecomment-971014102

Comment:
Done in cea371b26f110bd4080c5b646cdccbd5dbac5f4a

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

* Re: [PR PATCH] [Closed]: [WIP] chromium: enable cross.
  2020-11-23  9:03 [PR PATCH] [WIP] chromium: enable cross fosslinux
  2020-11-23  9:04 ` fosslinux
  2021-11-17  1:14 ` ericonr
@ 2021-11-17  1:14 ` ericonr
  2 siblings, 0 replies; 4+ messages in thread
From: ericonr @ 2021-11-17  1:14 UTC (permalink / raw)
  To: ml

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

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

[WIP] chromium: enable cross.
https://github.com/void-linux/void-packages/pull/26634

Description:
This is a super super big WIP. **Do not expect to work.** I am only PRing so interested parties might be able to provide assistance.

This was built for Chromium 86 for `aarch64` and `aarch64-musl`. `armv7l-musl` was in progress IIRC but didn't build. This has been runtime tested by @q66 for aarch64; it launches, but tabs crash.

I plan to revisit this this weekend. If people feel like building in the meantime, go ahead. I also have no idea if this works on the latest version of chromium.

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23  9:03 [PR PATCH] [WIP] chromium: enable cross fosslinux
2020-11-23  9:04 ` fosslinux
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).