mirror of
https://github.com/void-linux/void-packages.git
synced 2025-04-16 14:17:02 +02:00
chromium: add missing patches, fix cross build
This commit is contained in:
parent
0c0b6833b8
commit
eddadcfee5
4 changed files with 253 additions and 1 deletions
|
@ -0,0 +1,33 @@
|
|||
Source: https://git.alpinelinux.org/aports/plain/community/chromium/no-res-ninit-nclose.patch
|
||||
similar to dns-resolver.patch, musl doesn't have res_ninit and so on
|
||||
--
|
||||
--- a/net/dns/public/scoped_res_state.cc
|
||||
+++ b/net/dns/public/scoped_res_state.cc
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace net {
|
||||
|
||||
ScopedResState::ScopedResState() {
|
||||
-#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA)
|
||||
+#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) || defined(_GNU_SOURCE)
|
||||
// Note: res_ninit in glibc always returns 0 and sets RES_INIT.
|
||||
// res_init behaves the same way.
|
||||
memset(&_res, 0, sizeof(_res));
|
||||
@@ -25,16 +25,8 @@
|
||||
}
|
||||
|
||||
ScopedResState::~ScopedResState() {
|
||||
-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
|
||||
-
|
||||
- // Prefer res_ndestroy where available.
|
||||
-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
|
||||
- res_ndestroy(&res_);
|
||||
-#else
|
||||
- res_nclose(&res_);
|
||||
-#endif // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
|
||||
-
|
||||
-#endif // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
|
||||
+ // musl res_init() doesn't actually do anything
|
||||
+ // no destruction is necessary as no memory has been allocated
|
||||
}
|
||||
|
||||
bool ScopedResState::IsValid() const {
|
94
srcpkgs/chromium/patches/musl-no-execinfo.patch
Normal file
94
srcpkgs/chromium/patches/musl-no-execinfo.patch
Normal file
|
@ -0,0 +1,94 @@
|
|||
Source: https://git.alpinelinux.org/aports/plain/community/chromium/no-execinfo.patch
|
||||
musl does not have execinfo.h, and hence no implementation of
|
||||
. backtrace()
|
||||
. backtrace_symbols()
|
||||
for discussion about this, see https://www.openwall.com/lists/musl/2021/07/16/1
|
||||
--
|
||||
--- a/v8/src/codegen/external-reference-table.cc
|
||||
+++ b/v8/src/codegen/external-reference-table.cc
|
||||
@@ -11,7 +11,9 @@
|
||||
|
||||
#if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
|
||||
#define SYMBOLIZE_FUNCTION
|
||||
+#if defined(__GLIBC__)
|
||||
#include <execinfo.h>
|
||||
+#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -96,7 +98,7 @@
|
||||
}
|
||||
|
||||
const char* ExternalReferenceTable::ResolveSymbol(void* address) {
|
||||
-#ifdef SYMBOLIZE_FUNCTION
|
||||
+#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__)
|
||||
char** names = backtrace_symbols(&address, 1);
|
||||
const char* name = names[0];
|
||||
// The array of names is malloc'ed. However, each name string is static
|
||||
--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
|
||||
+++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
|
||||
@@ -17,7 +17,11 @@
|
||||
#define ENABLE_CRASH_OVERRIDES 0
|
||||
|
||||
/* Define to 1 if you have the `backtrace' function. */
|
||||
+#ifdef __GLIBC__
|
||||
#define HAVE_BACKTRACE 1
|
||||
+#else
|
||||
+#define HAVE_BACKTRACE 0
|
||||
+#endif
|
||||
|
||||
/* Define to 1 if you have the <CrashReporterClient.h> header file. */
|
||||
/* #undef HAVE_CRASHREPORTERCLIENT_H */
|
||||
@@ -58,7 +62,11 @@
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the <execinfo.h> header file. */
|
||||
+#ifdef __GLIBC__
|
||||
#define HAVE_EXECINFO_H 1
|
||||
+#else
|
||||
+#define HAVE_EXECINFO_H 0
|
||||
+#endif
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
--- a/base/debug/stack_trace.cc
|
||||
+++ b/base/debug/stack_trace.cc
|
||||
@@ -251,7 +253,9 @@
|
||||
}
|
||||
|
||||
void StackTrace::OutputToStream(std::ostream* os) const {
|
||||
+#if defined(__GLIBC__) && !defined(_AIX)
|
||||
OutputToStreamWithPrefix(os, nullptr);
|
||||
+#endif
|
||||
}
|
||||
|
||||
std::string StackTrace::ToString() const {
|
||||
@@ -281,7 +281,7 @@
|
||||
}
|
||||
std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
|
||||
std::stringstream stream;
|
||||
-#if !defined(__UCLIBC__) && !defined(_AIX)
|
||||
+#if defined(__GLIBC__) && !defined(_AIX)
|
||||
OutputToStreamWithPrefix(&stream, prefix_string);
|
||||
#endif
|
||||
return stream.str();
|
||||
--- a/base/debug/stack_trace_unittest.cc
|
||||
+++ b/base/debug/stack_trace_unittest.cc
|
||||
@@ -33,7 +33,7 @@
|
||||
typedef testing::Test StackTraceTest;
|
||||
#endif
|
||||
|
||||
-#if !defined(__UCLIBC__) && !defined(_AIX)
|
||||
+#if !defined(__UCLIBC__) && !defined(_AIX) && defined(__GLIBC__)
|
||||
// StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
|
||||
// See https://crbug.com/706728
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
|
||||
#endif // !defined(__UCLIBC__) && !defined(_AIX)
|
||||
|
||||
-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
|
||||
+#if (BUILDFLAG(IS_POSIX) && defined(__GLIBC__)) && !BUILDFLAG(IS_ANDROID)
|
||||
#if !BUILDFLAG(IS_IOS)
|
||||
static char* newArray() {
|
||||
// Clang warns about the mismatched new[]/delete if they occur in the same
|
125
srcpkgs/chromium/patches/musl-no-mallinfo.patch
Normal file
125
srcpkgs/chromium/patches/musl-no-mallinfo.patch
Normal file
|
@ -0,0 +1,125 @@
|
|||
Source: https://git.alpinelinux.org/aports/plain/community/chromium/no-mallinfo.patch
|
||||
musl does not implement mallinfo()/mallinfo2()
|
||||
(or rather, malloc-ng, musl's allocator, doesn't)
|
||||
--
|
||||
--- a/base/trace_event/malloc_dump_provider.cc
|
||||
+++ b/base/trace_event/malloc_dump_provider.cc
|
||||
@@ -185,7 +185,6 @@
|
||||
#define MALLINFO2_FOUND_IN_LIBC
|
||||
struct mallinfo2 info = mallinfo2();
|
||||
#endif
|
||||
-#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||
#if !defined(MALLINFO2_FOUND_IN_LIBC)
|
||||
struct mallinfo info = mallinfo();
|
||||
#endif
|
||||
@@ -205,6 +204,7 @@
|
||||
sys_alloc_dump->AddScalar(MemoryAllocatorDump::kNameSize,
|
||||
MemoryAllocatorDump::kUnitsBytes, info.uordblks);
|
||||
}
|
||||
+#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -339,7 +340,7 @@
|
||||
&allocated_objects_count);
|
||||
#elif BUILDFLAG(IS_FUCHSIA)
|
||||
// TODO(fuchsia): Port, see https://crbug.com/706592.
|
||||
-#else
|
||||
+#elif defined(__GLIBC__)
|
||||
ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
|
||||
&allocated_objects_size, &allocated_objects_count);
|
||||
#endif
|
||||
--- a/base/process/process_metrics_posix.cc
|
||||
+++ b/base/process/process_metrics_posix.cc
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
#endif // !BUILDFLAG(IS_FUCHSIA)
|
||||
|
||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
|
||||
+#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
|
||||
namespace {
|
||||
|
||||
size_t GetMallocUsageMallinfo() {
|
||||
@@ -123,7 +123,7 @@
|
||||
}
|
||||
|
||||
} // namespace
|
||||
-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
|
||||
+#endif // (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) ||
|
||||
// BUILDFLAG(IS_ANDROID)
|
||||
|
||||
size_t ProcessMetrics::GetMallocUsage() {
|
||||
@@ -131,9 +131,9 @@
|
||||
malloc_statistics_t stats = {0};
|
||||
malloc_zone_statistics(nullptr, &stats);
|
||||
return stats.size_in_use;
|
||||
-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
|
||||
+#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
|
||||
return GetMallocUsageMallinfo();
|
||||
-#elif BUILDFLAG(IS_FUCHSIA)
|
||||
+#else
|
||||
// TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
|
||||
return 0;
|
||||
#endif
|
||||
--- ./third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc.orig
|
||||
+++ ./third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
MemoryUsage GetMemoryUsage() {
|
||||
MemoryUsage result;
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) && defined(__GLIBC__)
|
||||
rusage res;
|
||||
if (getrusage(RUSAGE_SELF, &res) == 0) {
|
||||
result.max_rss_kb = res.ru_maxrss;
|
||||
--- ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc
|
||||
+++ ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc.orig
|
||||
@@ -86,11 +86,11 @@
|
||||
}
|
||||
|
||||
size_t Process::GetMallocUsage() {
|
||||
-#if defined(HAVE_MALLINFO2)
|
||||
+#if defined(HAVE_MALLINFO2) && defined(__GLIBC__)
|
||||
struct mallinfo2 mi;
|
||||
mi = ::mallinfo2();
|
||||
return mi.uordblks;
|
||||
-#elif defined(HAVE_MALLINFO)
|
||||
+#elif defined(HAVE_MALLINFO) && defined(__GLIBC__)
|
||||
struct mallinfo mi;
|
||||
mi = ::mallinfo();
|
||||
return mi.uordblks;
|
||||
|
||||
--- ./third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h.orig 2019-09-30 13:03:42.556880537 -0400
|
||||
+++ ./third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h 2019-09-30 13:07:27.989821227 -0400
|
||||
@@ -122,7 +122,9 @@
|
||||
/* #undef HAVE_MALLCTL */
|
||||
|
||||
/* Define to 1 if you have the `mallinfo' function. */
|
||||
+#if defined(__GLIBC__)
|
||||
#define HAVE_MALLINFO 1
|
||||
+#endif
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
--- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
|
||||
+++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
|
||||
@@ -717,7 +717,7 @@
|
||||
|
||||
#endif // !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
+#if 0
|
||||
SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
|
||||
base::SimplePartitionStatsDumper allocator_dumper;
|
||||
Allocator()->DumpStats("malloc", true, &allocator_dumper);
|
||||
--- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc
|
||||
+++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc
|
||||
@@ -24,7 +24,7 @@
|
||||
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
|
||||
|
||||
// Platforms on which we override weak libc symbols.
|
||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
+#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
|
||||
|
||||
NOINLINE void FreeForTest(void* data) {
|
||||
free(data);
|
|
@ -54,7 +54,7 @@ if [ "$CROSS_BUILD" ]; then
|
|||
$(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 libXdamage-devel libepoxy-devel
|
||||
libavif-devel libaom-devel jsoncpp-devel woff2-devel libdav1d-devel"
|
||||
libavif-devel libaom-devel jsoncpp-devel woff2-devel libdav1d-devel libflac-devel"
|
||||
fi
|
||||
|
||||
if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue