From 23fdf4b4f0d2f02b96ba7ff03f9a3a4b051ca74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Sun, 16 Sep 2018 15:28:49 +0000
Subject: community/chromium: armhf fixes

---
 community/chromium/APKBUILD         | 21 +++++++++-------
 community/chromium/musl-fixes.patch | 50 +++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 9 deletions(-)

(limited to 'community/chromium')

diff --git a/community/chromium/APKBUILD b/community/chromium/APKBUILD
index 792f524013..493ecf044d 100644
--- a/community/chromium/APKBUILD
+++ b/community/chromium/APKBUILD
@@ -116,12 +116,6 @@ source="https://commondatastorage.googleapis.com/chromium-browser-official/$pkgn
 
 builddir="$srcdir"/$pkgname-$pkgver
 
-case "${CARCH}" in
-	x86_64) target_arch=x64;;
-	x86) target_arch=ia32;;
-	arm) target_arch=arm;;
-esac
-
 if [ -n "$DEBUG" ]; then
 	_buildtype=Debug
 	_is_debug=true
@@ -218,6 +212,15 @@ build() {
 	export CC=clang
 	export CXX=clang++
 
+	local _ca=""
+	#case "$CARCH" in
+	# Chromium build as armv6 is broken, ffmpeg fails utterly
+	# The default is armv7 which is not armhf standard, but better than nothing.
+	#armhf) _ca=$(_gn_flags arm_version=6 arm_arch=\"armv6zk\" \
+	#		arm_fpu=\"vfp\" arm_float_abi=\"hard\" \
+	#		arm_use_neon=false arm_optionally_use_neon=true);;
+	#esac
+
 	msg "Bootstrapping GN"
 	local _c=$(_gn_flags is_clang=true \
 		use_sysroot=false \
@@ -230,7 +233,7 @@ build() {
 	)
 
 	AR="ar" CC="$CC" CXX="$CXX" LD="$CXX" \
-		python tools/gn/bootstrap/bootstrap.py -s -v --no-clean --gn-gen-args "$_c"
+		python tools/gn/bootstrap/bootstrap.py -s -v --no-clean --gn-gen-args "$_c $_ca"
 
 	msg "Configuring build"
 	_c=$(_gn_flags \
@@ -270,7 +273,7 @@ build() {
 	)
 
 	AR="ar" CC="$CC" CXX="$CXX" LD="$CXX" NM=/usr/bin/nm \
-		out/Release/gn gen out/$_buildtype --args="$_c"
+		out/Release/gn gen out/$_buildtype --args="$_c $_ca"
 
 	msg "Ninja turtles GO!"
 	# workaround parallel build
@@ -352,7 +355,7 @@ e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b3
 05fb6d9434565a7a73f5c18d470ae600bf4afbe15d0e4a7c2770bf2596a0bd2788cdfeb37e0b566fc3d26ff2d0791b70488b2c184e3286cff5a1fa25e17582cd  default-pthread-stacksize.patch
 46e141a932860c6db1f655c8b188b8c41bce0dbb1654c066379fa53063ce6cc3bf8be156bd8e73e103c7d9e956e436732e2f7db0653f9847eb26cbfebc441a10  gn_bootstrap.patch
 8fbfd67a0b6bbdf08364e810bd85b4a80dda9af73fefe3aba8010d9b33022d458a785c628515bbda9c743b8a0293d57cfe18fcc5aa2313c845c6fb948c2335f9  last-commit-position.patch
-92c39aaa66d74dd192f1e6fc6702390dadd87c2807d3b6c80cd6240634b8ad86328d51f3c528e2037823c9d2e02970c0969e96ea4bdf29be861db7f3bcdb76e4  musl-fixes.patch
+245a5bf4c0881851482561830d9241ad8b3061d2e2596916c2efbdeaf41b96f5a6181183442b3a33aac53fefb3faf7c327258e051141d778ae6fa5b48b98969c  musl-fixes.patch
 90efbc89151c77f32434364dcbaabaf9d9a207f4a77f147cd51b3fe100832fbfb3a9fb665303a79a3d788e400f4f41890de202ccbb7bd1fc6252e33c6e74e429  musl-fixes-breakpad.patch
 507a8db2317f1f6ec18dec6cb5894b716e9b2542b58887bab9319bc6d4c66fe4a4d09b200ca8e3f11b32e380b282442a27e7a1b358d3c25eef0fa7655e9dc134  musl-hacks.patch
 95ead57f7338649351948d100e32e5ec1eeadb02bffa136ff15c6c515eceb8013c444be092d777c1b62b945bfb83b97778ba4d3a0ccc2d7c2c9a0a8cd8ee0f01  musl-libc++.patch
diff --git a/community/chromium/musl-fixes.patch b/community/chromium/musl-fixes.patch
index 9d9d6ae82d..84dbc3825d 100644
--- a/community/chromium/musl-fixes.patch
+++ b/community/chromium/musl-fixes.patch
@@ -154,3 +154,53 @@ index 10f1c0d..8e86a2e 100644
      defined(OS_FUCHSIA)
    pthread_attr_t attr;
    int error;
+--- third_party/lss/linux_syscall_support.h.orig
++++ third_party/lss/linux_syscall_support.h
+@@ -132,15 +132,18 @@
+ 
+ /* The Android NDK's <sys/stat.h> #defines these macros as aliases
+  * to their non-64 counterparts. To avoid naming conflict, remove them. */
+-#ifdef __ANDROID__
++#if defined(fstat64)
+   /* These are restored by the corresponding #pragma pop_macro near
+    * the end of this file. */
+ # pragma push_macro("stat64")
+ # pragma push_macro("fstat64")
++# pragma push_macro("fstatat64")
+ # pragma push_macro("lstat64")
+ # undef stat64
+ # undef fstat64
++# undef fstatat64
+ # undef lstat64
++# define __RESTORE_MACRO 1
+ #endif
+ 
+ #if defined(__ANDROID__) && defined(__x86_64__)
+@@ -4545,12 +4548,14 @@
+ # endif
+ #endif
+ 
+-#ifdef __ANDROID__
++#ifdef __RESTORE_MACRO
+   /* These restore the original values of these macros saved by the
+    * corresponding #pragma push_macro near the top of this file. */
+ # pragma pop_macro("stat64")
+ # pragma pop_macro("fstat64")
++# pragma pop_macro("fstatat64")
+ # pragma pop_macro("lstat64")
++#undef __RESTORE_MACRO
+ #endif
+ 
+ #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS)
+--- third_party/crashpad/crashpad/util/linux/ptracer.cc.orig
++++ third_party/crashpad/crashpad/util/linux/ptracer.cc
+@@ -28,6 +28,9 @@
+ #include <asm/ldt.h>
+ #include <asm/ptrace-abi.h>
+ #endif
++#if defined(ARCH_CPU_ARM_FAMILY)
++#include <asm/ptrace.h>
++#endif
+ 
+ namespace crashpad {
+ 
-- 
cgit v1.2.3