From 299dd5b47ec4a8c8c589bf9f2b2d56cce3513cd1 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 2 Mar 2017 15:12:46 +0100 Subject: [PATCH] chromium: update to 57.0.2987.98 (icu-58.2, libevent-2.1, nss-3.28.3, libwebp-0.6.0). Disables gold for musl builds. --- .../default-pthread-stacksize.patch | 27 ++++++- .../files/musl-patches/musl-fixes.patch | 14 ++-- srcpkgs/chromium/patches/no-mallinfo.patch | 79 ++++++++++++++++--- .../chromium/patches/unset-madv_free.patch | 8 +- srcpkgs/chromium/template | 23 ++++-- 5 files changed, 123 insertions(+), 28 deletions(-) diff --git a/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch b/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch index a316d84cad6..a46878ea523 100644 --- a/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch +++ b/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch @@ -1,6 +1,29 @@ ---- base/threading/platform_thread_linux.cc.orig 2016-08-30 21:36:06.809571185 +0200 -+++ base/threading/platform_thread_linux.cc 2016-08-30 21:36:14.582805286 +0200 +--- base/threading/platform_thread_linux.cc.orig ++++ base/threading/platform_thread_linux.cc @@ -99 +99,2 @@ size_t GetDefaultThreadStackSize(const p - return 0; + // use 8mb like glibc to avoid running out of space + return (1 << 23); +--- chrome/browser/chrome_browser_main_posix.cc.orig ++++ chrome/browser/chrome_browser_main_posix.cc +@@ -276,12 +276,20 @@ + g_shutdown_pipe_read_fd = pipefd[0]; + g_shutdown_pipe_write_fd = pipefd[1]; + #if !defined(ADDRESS_SANITIZER) && !defined(KEEP_SHADOW_STACKS) ++# if defined(__GLIBC__) + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2; ++# else ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k ++# endif + #else + // ASan instrumentation and -finstrument-functions (used for keeping the + // shadow stacks) bloat the stack frames, so we need to increase the stack + // size to avoid hitting the guard page. ++# if defined(__GLIBC__) + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4; ++# else ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k ++# endif + #endif + // TODO(viettrungluu,willchan): crbug.com/29675 - This currently leaks, so + // if you change this, you'll probably need to change the suppression. diff --git a/srcpkgs/chromium/files/musl-patches/musl-fixes.patch b/srcpkgs/chromium/files/musl-patches/musl-fixes.patch index 4282a17f338..8f0b116cd14 100644 --- a/srcpkgs/chromium/files/musl-patches/musl-fixes.patch +++ b/srcpkgs/chromium/files/musl-patches/musl-fixes.patch @@ -126,21 +126,21 @@ #endif #if HAVE_UNISTD_H #include ---- ./third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp.orig -+++ ./third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp -@@ -68,7 +68,7 @@ +--- ./third_party/WebKit/Source/wtf/StackUtil.cpp.orig ++++ ./third_party/WebKit/Source/wtf/StackUtil.cpp +@@ -28,7 +28,7 @@ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size // correctly for the main thread. - + -#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD) +#if OS(LINUX) || OS(ANDROID) || OS(FREEBSD) // pthread_getattr_np() can fail if the thread is not invoked by // pthread_create() (e.g., the main thread of webkit_unit_tests). // If so, a conservative size estimate is returned. -@@ -135,7 +135,7 @@ +@@ -95,7 +95,7 @@ } - - void* StackFrameDepth::getStackStart() { + + void* getStackStart() { -#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD) +#if OS(LINUX) || OS(ANDROID) || OS(FREEBSD) pthread_attr_t attr; diff --git a/srcpkgs/chromium/patches/no-mallinfo.patch b/srcpkgs/chromium/patches/no-mallinfo.patch index 3ea66e475d8..306c64b622a 100644 --- a/srcpkgs/chromium/patches/no-mallinfo.patch +++ b/srcpkgs/chromium/patches/no-mallinfo.patch @@ -1,16 +1,16 @@ ---- base/trace_event/malloc_dump_provider.cc.orig 2016-11-16 02:19:56.753320143 +0100 -+++ base/trace_event/malloc_dump_provider.cc 2016-11-16 02:13:58.286196506 +0100 -@@ -224,7 +224,7 @@ - resident_size = all_heap_info.committed_size; - allocated_objects_size = all_heap_info.allocated_size; - allocated_objects_count = all_heap_info.block_count; +--- base/trace_event/malloc_dump_provider.cc.orig ++++ base/trace_event/malloc_dump_provider.cc +@@ -187,7 +187,7 @@ + resident_size = main_heap_info.committed_size; + allocated_objects_size = main_heap_info.allocated_size; + allocated_objects_count = main_heap_info.block_count; -#else +#elif defined(OS_LINUX) && defined(__GLIBC__) struct mallinfo info = mallinfo(); DCHECK_GE(info.arena + info.hblkhd, info.uordblks); - ---- content/child/content_child_helpers.cc.orig 2016-05-08 08:05:37.415219394 +0200 -+++ content/child/content_child_helpers.cc 2016-05-08 08:06:27.110142484 +0200 + +--- content/child/content_child_helpers.cc.orig ++++ content/child/content_child_helpers.cc @@ -24,7 +24,7 @@ namespace content { // though, this provides only a partial and misleading value. // Unfortunately some telemetry benchmark rely on it and these need to @@ -20,3 +20,64 @@ size_t GetMemoryUsageKB() { struct mallinfo minfo = mallinfo(); uint64_t mem_usage = +--- content/renderer/render_thread_impl.cc.orig ++++ content/renderer/render_thread_impl.cc +@@ -1712,6 +1712,49 @@ + } + + } // namespace ++#elif defined(OS_LINUX) && !defined(__GLIBC__) ++namespace { ++ ++static size_t GetMallocUsage() { ++ char *line=NULL; ++ size_t n,usage=0; ++ FILE *f = fopen("/proc/self/maps", "r"); ++ char *path, *perm; ++ if (f == NULL) { ++ perror("/proc/self/maps"); ++ return 0; ++ } ++ path = (char *)malloc(PATH_MAX+16); ++ if (path == NULL) ++ goto out; ++ perm = path + PATH_MAX; ++ ++ while (getline(&line, &n, f) >=0) { ++ size_t start,end,offset,inode; ++ int devmaj, devmin, items; ++ ++ items = sscanf(line, "%zx-%zx %s %zx %x:%x %zu %s", ++ &start, &end, perm, &offset, ++ &devmaj, &devmin, &inode, path); ++ ++ if (items < 7) ++ continue; ++ ++ if (items < 8) ++ path[0] = '\0'; ++ ++ if ((strcmp(perm, "rw-p") == 0 && devmaj+devmin == 0) ++ && (path[0] == '\0' || strcmp(path, "[heap]") == 0)) ++ usage += end-start; ++ } ++ free(line); ++ free(path); ++out: ++ fclose(f); ++ return usage; ++} ++ ++} // namespace + #endif + + void RenderThreadImpl::GetRendererMemoryMetrics( +@@ -1722,7 +1765,7 @@ + memory_metrics->partition_alloc_kb = + blink_stats.partitionAllocTotalAllocatedBytes / 1024; + memory_metrics->blink_gc_kb = blink_stats.blinkGCTotalAllocatedBytes / 1024; +-#if defined(OS_LINUX) || defined(OS_ANDROID) ++#if (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID) + struct mallinfo minfo = mallinfo(); + #if defined(USE_TCMALLOC) + size_t malloc_usage = minfo.uordblks; diff --git a/srcpkgs/chromium/patches/unset-madv_free.patch b/srcpkgs/chromium/patches/unset-madv_free.patch index f748179fc90..613d37c5853 100644 --- a/srcpkgs/chromium/patches/unset-madv_free.patch +++ b/srcpkgs/chromium/patches/unset-madv_free.patch @@ -1,10 +1,10 @@ ---- third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp -+++ third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp -@@ -41,6 +41,11 @@ +--- base/allocator/partition_allocator/page_allocator.cc.orig ++++ base/allocator/partition_allocator/page_allocator.cc +@@ -17,6 +17,11 @@ #include #include -+#if OS(LINUX) && defined(MADV_FREE) ++#if defined(OS_LINUX) && defined(MADV_FREE) +// Added in Linux 4.5, but it breaks the sandbox. +#undef MADV_FREE +#endif diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template index e7e74ad5f74..b80cb0e3242 100644 --- a/srcpkgs/chromium/template +++ b/srcpkgs/chromium/template @@ -1,14 +1,14 @@ # Template file for 'chromium' pkgname=chromium # See http://www.chromium.org/developers/calendar for the latest version -version=55.0.2883.87 +version=57.0.2987.98 revision=1 short_desc="Google's attempt at creating a safer, faster, and more stable browser" maintainer="Juan RP " homepage="http://www.chromium.org/" license="BSD" distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz" -checksum=e81bd3140d9c84dfee04d9a94686dfe6a20ae79475d84f17154c5536dcb81a58 +checksum=16b5ecf70fcab8476231636ec20f5415897781b01ed21640283cb358322f792d only_for_archs="i686 x86_64 x86_64-musl" lib32disabled=yes @@ -20,7 +20,7 @@ desc_option_nacl="Enable NaCL support" hostmakedepends="yasm python pkg-config perl gperf bison ninja hwids libatomic-devel libevent-devel libglib-devel" -makedepends="libpng-devel gtk+-devel nss-devel pciutils-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 libXScrnSaver-devel alsa-lib-devel snappy-devel @@ -119,9 +119,15 @@ do_configure() { gold_path="/usr/bin/ld.gold" use_gconf=false use_sysroot=false - use_gold=true use_allocator="none" use_experimental_allocator_shim=false' + + # XXX: gold broken with musl + case "${XBPS_TARGET_MACHINE}" in + *-musl) bootstrap_conf+=' use_gold=false' ;; + *) bootstrap_conf+=' use_gold=true' ;; + esac + AR="ar" CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD LD=$CXX_FOR_BUILD \ python2 tools/gn/bootstrap/bootstrap.py --gn-gen-args "${bootstrap_conf// / }" @@ -171,8 +177,13 @@ do_configure() { # Never use bundled binutils/gold binary. conf+=" binutils_path=\"${XBPS_CROSS_BASE}/usr/bin\" - gold_path=\"${XBPS_CROSS_BASE}/usr/bin/ld.gold\" - use_gold=true" + gold_path=\"${XBPS_CROSS_BASE}/usr/bin/ld.gold\"" + + # XXX: gold broken with musl + case "${XBPS_TARGET_MACHINE}" in + *-musl) conf+=' use_gold=false' ;; + *) conf+=' use_gold=true' ;; + esac # Always support proprietary codecs. # Enable H.264 support in bundled ffmpeg.