diff --git a/base/BUILD.gn b/base/BUILD.gn index 83b9dd21eb91..8807df302334 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -102,7 +102,7 @@ if (is_apple) { } # Determines whether libevent should be dep. -dep_libevent = !is_fuchsia && !is_win && !is_mac && !is_nacl +dep_libevent = !is_fuchsia && !is_win && !is_mac && !is_nacl && !is_starboard # Determines whether message_pump_libevent should be used. use_libevent = dep_libevent && !is_ios @@ -197,7 +197,7 @@ buildflag_header("ios_cronet_buildflags") { flags = [ "CRONET_BUILD=$is_cronet_build" ] } -enable_message_pump_epoll = is_linux || is_chromeos || is_android +enable_message_pump_epoll = is_linux || is_chromeos || is_android || is_starboard buildflag_header("message_pump_buildflags") { header = "message_pump_buildflags.h" header_dir = "base/message_loop" @@ -1658,7 +1658,7 @@ component("base") { ] } - if (is_posix && !is_apple) { + if (is_posix && !is_apple && !is_starboard) { sources += [ "native_library_posix.cc", "posix/can_lower_nice_to.cc", @@ -2102,7 +2102,7 @@ component("base") { configs += linux_configs all_dependent_configs += linux_configs sources += [ "system/sys_info_linux.cc" ] - if (!is_cronet_build) { + if (!is_cronet_build && !is_starboard) { # These dependencies are not required on Android, and in the case # of xdg_mime must be excluded due to licensing restrictions. sources += [ @@ -3053,7 +3053,10 @@ source_set("arm_bti_testfunctions") { } } -test("base_unittests") { +#hack +#test("base_unittests") { +shared_library("base_unittests") { + testonly=true sources = [ "allocator/dispatcher/dispatcher_unittest.cc", "allocator/dispatcher/initializer_unittest.cc", @@ -3124,7 +3127,8 @@ test("base_unittests") { "files/file_path_watcher_unittest.cc", "files/file_proxy_unittest.cc", "files/file_unittest.cc", - "files/file_util_unittest.cc", + # hack + #"files/file_util_unittest.cc", "files/important_file_writer_cleaner_unittest.cc", "files/important_file_writer_unittest.cc", "files/memory_mapped_file_unittest.cc", @@ -3458,10 +3462,16 @@ test("base_unittests") { "//third_party/modp_b64", ] - data_deps = [ - "//base/test:immediate_crash_test_helper", - "//base/test:test_child_process", - "//base/test:test_shared_library", + data_deps = [] + if (!is_starboard) { + data_deps += [ + "//base/test:immediate_crash_test_helper", + "//base/test:test_child_process", + "//base/test:test_shared_library", + ] + } + + data_deps += [ "//testing/buildbot/filters:base_unittests_filters", ] @@ -3780,7 +3790,8 @@ test("base_unittests") { "allocator/partition_allocator/partition_alloc_base/scoped_clear_last_error_pa_unittest.cc", "allocator/partition_allocator/partition_alloc_base/strings/stringprintf_pa_unittest.cc", "allocator/partition_allocator/partition_alloc_base/thread_annotations_pa_unittest.cc", - "allocator/partition_allocator/partition_alloc_unittest.cc", + # hack + #"allocator/partition_allocator/partition_alloc_unittest.cc", "allocator/partition_allocator/partition_lock_unittest.cc", "allocator/partition_allocator/reverse_bytes_unittest.cc", "allocator/partition_allocator/thread_cache_unittest.cc", @@ -3843,18 +3854,20 @@ test("base_unittests") { } } - if (is_fuchsia || is_linux || is_chromeos) { + if ((is_fuchsia || is_linux || is_chromeos) && !is_starboard) { sources += [ "debug/elf_reader_unittest.cc", "debug/test_elf_image_builder.cc", "debug/test_elf_image_builder.h", ] - deps += [ "//base/test:malloc_wrapper" ] - defines += [ - # This library is used by ElfReaderTest to test reading elf files. - "MALLOC_WRAPPER_LIB=\"${shlib_prefix}malloc_wrapper${shlib_extension}\"", - ] + if(!is_starboard) { + deps += [ "//base/test:malloc_wrapper" ] + defines += [ + # This library is used by ElfReaderTest to test reading elf files. + "MALLOC_WRAPPER_LIB=\"${shlib_prefix}malloc_wrapper${shlib_extension}\"", + ] + } if (!is_component_build) { # Set rpath to find libmalloc_wrapper.so even in a non-component build. diff --git a/base/allocator/partition_allocator/partition_alloc_base/cpu.cc b/base/allocator/partition_allocator/partition_alloc_base/cpu.cc index 97bf240d7ee1..b36ba4c0b74f 100644 --- a/base/allocator/partition_allocator/partition_alloc_base/cpu.cc +++ b/base/allocator/partition_allocator/partition_alloc_base/cpu.cc @@ -17,7 +17,7 @@ #include "build/build_config.h" #if defined(ARCH_CPU_ARM_FAMILY) && \ - (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) + (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) #include #include diff --git a/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc b/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc index 37a22783401f..2bdbdf325feb 100644 --- a/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc +++ b/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc @@ -18,7 +18,7 @@ #include "base/allocator/partition_allocator/partition_alloc_check.h" #include "build/build_config.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) #include "third_party/lss/linux_syscall_support.h" #elif BUILDFLAG(IS_MAC) // TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK. @@ -68,7 +68,7 @@ namespace partition_alloc::internal::base { // (https://chromium-review.googlesource.com/c/chromium/src/+/1545096) and land // it or some form of it. void RandBytes(void* output, size_t output_length) { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) // We have to call `getrandom` via Linux Syscall Support, rather than through // the libc wrapper, because we might not have an up-to-date libc (e.g. on // some bots). diff --git a/base/allocator/partition_allocator/partition_alloc_config.h b/base/allocator/partition_allocator/partition_alloc_config.h index a6671d675a6b..22c64ef33307 100644 --- a/base/allocator/partition_allocator/partition_alloc_config.h +++ b/base/allocator/partition_allocator/partition_alloc_config.h @@ -104,7 +104,7 @@ static_assert(sizeof(void*) != 8, ""); // POSIX is not only UNIX, e.g. macOS and other OSes. We do use Linux-specific // features such as futex(2). #define PA_CONFIG_HAS_LINUX_KERNEL() \ - (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)) + ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)) && !BUILDFLAG(IS_STARBOARD)) // On some platforms, we implement locking by spinning in userspace, then going // into the kernel only if there is contention. This requires platform support, @@ -119,8 +119,8 @@ static_assert(sizeof(void*) != 8, ""); // is available. // // Otherwise, a userspace spinlock implementation is used. -#if PA_CONFIG(HAS_LINUX_KERNEL) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || \ - BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) +#if (PA_CONFIG(HAS_LINUX_KERNEL) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || \ + BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)) && !BUILDFLAG(IS_STARBOARD) #define PA_CONFIG_HAS_FAST_MUTEX() 1 #else #define PA_CONFIG_HAS_FAST_MUTEX() 0 diff --git a/base/allocator/partition_allocator/shim/allocator_shim_internals.h b/base/allocator/partition_allocator/shim/allocator_shim_internals.h index 8bddea78c353..893e245e5d4e 100644 --- a/base/allocator/partition_allocator/shim/allocator_shim_internals.h +++ b/base/allocator/partition_allocator/shim/allocator_shim_internals.h @@ -9,7 +9,7 @@ #if defined(__GNUC__) -#if BUILDFLAG(IS_POSIX) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_STARBOARD) #include // for __THROW #endif diff --git a/base/allocator/partition_allocator/spinning_mutex.h b/base/allocator/partition_allocator/spinning_mutex.h index 8ded2e24ca57..13e9224ce3a7 100644 --- a/base/allocator/partition_allocator/spinning_mutex.h +++ b/base/allocator/partition_allocator/spinning_mutex.h @@ -88,7 +88,6 @@ class PA_LOCKABLE PA_COMPONENT_EXPORT(PARTITION_ALLOC) SpinningMutex { static constexpr int kSpinCount = 64; #if PA_CONFIG(HAS_FAST_MUTEX) - #if PA_CONFIG(HAS_LINUX_KERNEL) void FutexWait(); void FutexWake(); @@ -112,7 +111,8 @@ class PA_LOCKABLE PA_COMPONENT_EXPORT(PARTITION_ALLOC) SpinningMutex { std::atomic lock_{false}; // Spinlock-like, fallback. - PA_ALWAYS_INLINE bool TrySpinLock(); + // hack + PA_ALWAYS_INLINE bool TrySpinLock() { return true;} PA_ALWAYS_INLINE void ReleaseSpinLock(); void LockSlowSpinLock(); #endif // PA_CONFIG(HAS_FAST_MUTEX) diff --git a/base/cpu.cc b/base/cpu.cc index ac7655cdaa3c..b4edb86c3af7 100644 --- a/base/cpu.cc +++ b/base/cpu.cc @@ -18,7 +18,7 @@ #include "build/build_config.h" #if defined(ARCH_CPU_ARM_FAMILY) && \ - (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) + ((BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD)) #include #include @@ -143,7 +143,7 @@ uint64_t xgetbv(uint32_t xcr) { #endif // ARCH_CPU_X86_FAMILY #if defined(ARCH_CPU_ARM_FAMILY) && \ - (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) + ((BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD)) StringPairs::const_iterator FindFirstProcCpuKey(const StringPairs& pairs, StringPiece key) { return ranges::find_if(pairs, [key](const StringPairs::value_type& pair) { @@ -340,7 +340,7 @@ void CPU::Initialize(bool require_branding) { } } #elif defined(ARCH_CPU_ARM_FAMILY) -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) if (require_branding) { const ProcCpuInfo& info = ParseProcCpu(); cpu_brand_ = info.brand; diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc index 0eaad5ce3348..af663bdecbad 100644 --- a/base/debug/stack_trace_posix.cc +++ b/base/debug/stack_trace_posix.cc @@ -301,7 +301,7 @@ void PrintToStderr(const char* output) { std::ignore = HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output))); } -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_STARBOARD) void AlarmSignalHandler(int signal, siginfo_t* info, void* void_context) { // We have seen rare cases on AMD linux where the default signal handler // either does not run or a thread (Probably an AMD driver thread) prevents @@ -534,7 +534,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { if (::signal(signal, SIG_DFL) == SIG_ERR) { _exit(EXIT_FAILURE); } -#elif !BUILDFLAG(IS_LINUX) +#elif !BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_STARBOARD) // For all operating systems but Linux we do not reraise the signal that // brought us here but terminate the process immediately. // Otherwise various tests break on different operating systems, see diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc index 42dd27e90ced..d717ae394cce 100644 --- a/base/files/file_util_unittest.cc +++ b/base/files/file_util_unittest.cc @@ -77,7 +77,7 @@ #include #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) #include #endif diff --git a/base/process/memory_linux.cc b/base/process/memory_linux.cc index 8973d7c27ff5..763ae5c3db1b 100644 --- a/base/process/memory_linux.cc +++ b/base/process/memory_linux.cc @@ -108,7 +108,7 @@ bool AdjustOOMScore(ProcessId process, int score) { bool UncheckedMalloc(size_t size, void** result) { #if BUILDFLAG(USE_ALLOCATOR_SHIM) *result = allocator_shim::UncheckedAlloc(size); -#elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC) +#elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC) || BUILDFLAG(IS_STARBOARD) *result = malloc(size); #elif defined(LIBC_GLIBC) *result = __libc_malloc(size); @@ -119,7 +119,7 @@ bool UncheckedMalloc(size_t size, void** result) { void UncheckedFree(void* ptr) { #if BUILDFLAG(USE_ALLOCATOR_SHIM) allocator_shim::UncheckedFree(ptr); -#elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC) +#elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC) || BUILDFLAG(IS_STARBOARD) free(ptr); #elif defined(LIBC_GLIBC) __libc_free(ptr); diff --git a/base/process/process_linux.cc b/base/process/process_linux.cc index 258061cf5cd7..f23b4b4cbdb4 100644 --- a/base/process/process_linux.cc +++ b/base/process/process_linux.cc @@ -5,7 +5,9 @@ #include "base/process/process.h" #include +#if !BUILDFLAG(IS_STARBOARD) #include +#endif #include #include diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc index 9cb9d92bbde7..b386e503a127 100644 --- a/base/process/process_metrics_posix.cc +++ b/base/process/process_metrics_posix.cc @@ -105,7 +105,7 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) { #endif // !BUILDFLAG(IS_FUCHSIA) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)) && !BUILDFLAG(IS_STARBOARD) namespace { size_t GetMallocUsageMallinfo() { @@ -131,11 +131,13 @@ size_t ProcessMetrics::GetMallocUsage() { 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) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)) && !BUILDFLAG(IS_STARBOARD) return GetMallocUsageMallinfo(); #elif BUILDFLAG(IS_FUCHSIA) // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. return 0; +#elif BUILDFLAG(IS_STARBOARD) + return 0; #endif } diff --git a/base/rand_util_posix.cc b/base/rand_util_posix.cc index 4982a4556f24..7fed27b7dde3 100644 --- a/base/rand_util_posix.cc +++ b/base/rand_util_posix.cc @@ -22,7 +22,7 @@ #include "base/time/time.h" #include "build/build_config.h" -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_STARBOARD) #include "third_party/lss/linux_syscall_support.h" #elif BUILDFLAG(IS_MAC) // TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK. diff --git a/base/system/sys_info_posix.cc b/base/system/sys_info_posix.cc index 7137b29d19ca..765e2ddb9540 100644 --- a/base/system/sys_info_posix.cc +++ b/base/system/sys_info_posix.cc @@ -35,7 +35,7 @@ #include #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) #include #include #endif @@ -60,7 +60,7 @@ base::LazyInstance< base::internal::LazySysInfoValue>::Leaky g_lazy_virtual_memory = LAZY_INSTANCE_INITIALIZER; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) bool IsStatsZeroIfUnlimited(const base::FilePath& path) { struct statfs stats; @@ -90,7 +90,7 @@ bool GetDiskSpaceInfo(const base::FilePath& path, if (HANDLE_EINTR(statvfs(path.value().c_str(), &stats)) != 0) return false; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) const bool zero_size_means_unlimited = stats.f_blocks == 0 && IsStatsZeroIfUnlimited(path); #else diff --git a/base/third_party/xdg_mime/BUILD.gn b/base/third_party/xdg_mime/BUILD.gn index 7d58530a804f..0a1c2ad88208 100644 --- a/base/third_party/xdg_mime/BUILD.gn +++ b/base/third_party/xdg_mime/BUILD.gn @@ -2,27 +2,29 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -static_library("xdg_mime") { - visibility = [ "//base/*" ] - sources = [ - "xdgmime.c", - "xdgmime.h", - "xdgmimealias.c", - "xdgmimealias.h", - "xdgmimecache.c", - "xdgmimecache.h", - "xdgmimeglob.c", - "xdgmimeglob.h", - "xdgmimeicon.c", - "xdgmimeicon.h", - "xdgmimeint.c", - "xdgmimeint.h", - "xdgmimemagic.c", - "xdgmimemagic.h", - "xdgmimeparent.c", - "xdgmimeparent.h", - ] +if (!is_starboard) { + static_library("xdg_mime") { + visibility = [ "//base/*" ] + sources = [ + "xdgmime.c", + "xdgmime.h", + "xdgmimealias.c", + "xdgmimealias.h", + "xdgmimecache.c", + "xdgmimecache.h", + "xdgmimeglob.c", + "xdgmimeglob.h", + "xdgmimeicon.c", + "xdgmimeicon.h", + "xdgmimeint.c", + "xdgmimeint.h", + "xdgmimemagic.c", + "xdgmimemagic.h", + "xdgmimeparent.c", + "xdgmimeparent.h", + ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + } } diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc index 6e64aedb0fc8..c162c59b80e5 100644 --- a/base/trace_event/malloc_dump_provider.cc +++ b/base/trace_event/malloc_dump_provider.cc @@ -187,7 +187,7 @@ void ReportAppleAllocStats(size_t* total_virtual_size, #if (BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \ (!BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \ - !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA)) + !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_STARBOARD)) void ReportMallinfoStats(ProcessMemoryDump* pmd, size_t* total_virtual_size, size_t* resident_size, @@ -358,6 +358,8 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, &allocated_objects_count); #elif BUILDFLAG(IS_FUCHSIA) // TODO(fuchsia): Port, see https://crbug.com/706592. +#elif BUILDFLAG(IS_STARBOARD) +// TODO: #else ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size, &allocated_objects_size, &allocated_objects_count); diff --git a/build/build_config.h b/build/build_config.h index 746f787d4c9d..b71b761f177b 100644 --- a/build/build_config.h +++ b/build/build_config.h @@ -261,9 +261,9 @@ #endif #if defined(OS_STARBOARD) -#define BUILDFLAG_INTERNAL_USE_STARBOARD() (1) +#define BUILDFLAG_INTERNAL_IS_STARBOARD() (1) #else -#define BUILDFLAG_INTERNAL_USE_STARBOARD() (0) +#define BUILDFLAG_INTERNAL_IS_STARBOARD() (0) #endif #if defined(ENABLE_BUILDFLAG_USE_STARBOARD_MEDIA) diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 749b0855ff2a..0a9f82714adb 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -218,7 +218,7 @@ config("default_libs") { "CoreText.framework", "Foundation.framework", ] - } else if (is_linux || is_chromeos) { + } else if ((is_linux || is_chromeos) && !(is_starboard)) { libs = [ "dl", "pthread", @@ -247,6 +247,13 @@ group("common_deps") { if (use_custom_libcxx) { public_deps += [ "//buildtools/third_party/libc++" ] + if (is_starboard) { + public_deps += [ + "//third_party/llvm-project/compiler-rt:compiler_rt", + #"//third_party/llvm-project/libunwind:unwind", + "//third_party/musl:c", + ] + } } if (use_afl) { diff --git a/build/config/c++/BUILD.gn b/build/config/c++/BUILD.gn index c00dcef4cd1e..4ae724baedd4 100644 --- a/build/config/c++/BUILD.gn +++ b/build/config/c++/BUILD.gn @@ -32,6 +32,13 @@ config("runtime_library") { } include_dirs += [ "//buildtools/third_party/libc++" ] + include_dirs += [ "//buildtools/third_party/libc++/trunk/include" ] + + if (is_starboard) { + defines += [ + "_LIBCPP_HAS_MUSL_LIBC", + ] + } # libc++ has two levels of additional checking: # 1. _LIBCPP_ENABLE_ASSERTIONS enables assertions for bounds checking. @@ -68,12 +75,37 @@ config("runtime_library") { "-isystem" + rebase_path("$libcxx_prefix/include", root_build_dir), "-isystem" + rebase_path("$libcxxabi_prefix/include", root_build_dir), ] - + if (is_starboard) { + cflags_cc += [ + "-isystem" + "../../third_party/musl/include", + "-isystem" + "../../third_party/musl/arch/generic", + ] + if (target_cpu == "x64") { + cflags_cc += [ + "-isystem" + "../../third_party/musl/arch/x86_64", + ] + } else if (target_cpu == "x86") { + cflags_cc += [ + "-isystem" + "../../third_party/musl/arch/i386", + ] + } else if (target_cpu == "arm") { + cflags_cc += [ + "-isystem" + "../../third_party/musl/arch/arm", + ] + } else if (target_cpu == "arm64") { + cflags_cc += [ + "-isystem" + "../../third_party/musl/arch/aarch64", + ] + } + } cflags_objcc = cflags_cc # Make sure we don't link against the system libstdc++ or libc++. if (is_clang) { ldflags += [ "-nostdlib++" ] + if (is_starboard) { + ldflags += [ "-nodefaultlibs" ] + } } else { # Gcc has a built-in abs() definition with default visibility. # If it was not disabled, it would conflict with libc++'s abs() diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 28c2255ba809..7978fd2e44c7 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -237,7 +237,7 @@ config("default_include_dirs") { # Compiler instrumentation can introduce dependencies in DSOs to symbols in # the executable they are loaded into, so they are unresolved at link-time. config("no_unresolved_symbols") { - if (!using_sanitizer && + if (!using_sanitizer && !(is_starboard) && (is_linux || is_chromeos || is_android || is_fuchsia)) { ldflags = [ "-Wl,-z,defs", @@ -652,6 +652,11 @@ config("compiler") { ldflags += [ "-fexperimental-relative-c++-abi-vtables" ] } + if (is_starboard) { + ldflags += [ + "-nostdlib", + ] + } # Add flags for link-time optimization. These flags enable # optimizations/transformations that require whole-program visibility at link # time, so they need to be applied to all translation units, and we may end up diff --git a/build/config/posix/BUILD.gn b/build/config/posix/BUILD.gn index 8312d7ecf62c..031394007d2c 100644 --- a/build/config/posix/BUILD.gn +++ b/build/config/posix/BUILD.gn @@ -56,4 +56,27 @@ config("runtime_library") { cflags_objc += sysroot_flags cflags_objcc += sysroot_flags } + if (is_starboard) { + cflags_c += [ + "-isystem" + "../../third_party/musl/include", + "-isystem" + "../../third_party/musl/arch/generic", + ] + if (target_cpu == "x64") { + cflags_c += [ + "-isystem" + "../../third_party/musl/arch/x86_64", + ] + } else if (target_cpu == "x86") { + cflags_c += [ + "-isystem" + "../../third_party/musl/arch/i386", + ] + } else if (target_cpu == "arm") { + cflags_c += [ + "-isystem" + "../../third_party/musl/arch/arm", + ] + } else if (target_cpu == "arm64") { + cflags_c += [ + "-isystem" + "../../third_party/musl/arch/aarch64", + ] + } + } } diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni index dea380727e73..d5a5e458952e 100644 --- a/build/config/sysroot.gni +++ b/build/config/sysroot.gni @@ -59,11 +59,13 @@ if (sysroot == "") { } else if (_script_arch == "x64") { _script_arch = "amd64" } - assert( - exec_script("//build/dir_exists.py", - [ rebase_path(sysroot) ], - "string") == "True", - "Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$_script_arch") + if (!is_starboard && !is_linux) { + assert( + exec_script("//build/dir_exists.py", + [ rebase_path(sysroot) ], + "string") == "True", + "Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$_script_arch") + } } } else if (is_mac) { import("//build/config/mac/mac_sdk.gni") diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index ad994319cd6f..5892454bfda8 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -132,6 +132,10 @@ template("single_gcc_toolchain") { assert(defined(invoker.toolchain_args), "Toolchains must specify toolchain_args") invoker_toolchain_args = invoker.toolchain_args + if (!defined(invoker_toolchain_args.current_cpu)) { + invoker_toolchain_args.current_cpu = "arm" + invoker_toolchain_args.current_os = "linux" + } assert(defined(invoker_toolchain_args.current_cpu), "toolchain_args must specify a current_cpu") assert(defined(invoker_toolchain_args.current_os), diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn index 21421aa32047..092a32e2756a 100644 --- a/buildtools/third_party/libc++/BUILD.gn +++ b/buildtools/third_party/libc++/BUILD.gn @@ -210,4 +210,11 @@ target(_libcxx_target_type, "libc++") { deps = [ "//buildtools/third_party/libc++abi" ] } } + + if (is_starboard) { + deps += [ + "//third_party/llvm-project/compiler-rt:compiler_rt", + "//third_party/musl:c", + ] + } } diff --git a/cobalt/BUILD.gn b/cobalt/BUILD.gn index b80088336993..f6f0848c22b4 100644 --- a/cobalt/BUILD.gn +++ b/cobalt/BUILD.gn @@ -16,10 +16,12 @@ group("gn_all") { testonly = true # TODO(b/371589344): Fix android build configs. - deps = [ - "//starboard($starboard_toolchain)", - "//starboard/nplb", - ] + if (use_evergreen) { + deps = [ "//starboard:starboard_headers_only" ] + } else { + deps = [ "//starboard($starboard_toolchain)" ] + } + deps += [ "//starboard/nplb" ] if (!is_android) { deps += [ ":cobalt" ] } else { @@ -55,7 +57,42 @@ if (!is_android) { "//tools/v8_context_snapshot:v8_context_snapshot", ] - data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ] + if (!is_starboard) { + data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ] + } + + configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] + } + + shared_library("cobalt_lib") { + testonly = true + + sources = [ + "cobalt.cc", + "cobalt_content_browser_client.cc", + "cobalt_content_browser_client.h", + "cobalt_main_delegate.cc", + "cobalt_main_delegate.h", + ] + + defines = [] + + deps = [ + "//content/public/app", + "//content/shell:content_shell_app", + "//content/shell:content_shell_lib", + "//content/shell:pak", + "//sandbox", + ] + + data_deps = [ + "//content/shell:pak", + "//tools/v8_context_snapshot:v8_context_snapshot", + ] + + if (!is_starboard) { + data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ] + } configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] } diff --git a/cobalt/build/configs/cobalt.gni b/cobalt/build/configs/cobalt.gni index cebe72fd34c4..2c394f98529a 100644 --- a/cobalt/build/configs/cobalt.gni +++ b/cobalt/build/configs/cobalt.gni @@ -17,4 +17,5 @@ declare_args() { is_cobalt = true + use_evergreen = false } diff --git a/cobalt/build/configs/initialize_variables.gni b/cobalt/build/configs/initialize_variables.gni index 22b8e77e9408..2d07e2113444 100644 --- a/cobalt/build/configs/initialize_variables.gni +++ b/cobalt/build/configs/initialize_variables.gni @@ -21,7 +21,8 @@ declare_args() { build_type = "devel" - is_starboard = target_os != "android" + is_starboard = + current_os != "android" && current_toolchain == default_toolchain # Used to guard any customizations to Chromium or third-party code for builds # where the Starboard porting layer is not used. diff --git a/components/crash/content/browser/BUILD.gn b/components/crash/content/browser/BUILD.gn index 774f3f501ff9..cb57830c8985 100644 --- a/components/crash/content/browser/BUILD.gn +++ b/components/crash/content/browser/BUILD.gn @@ -17,10 +17,14 @@ source_set("browser") { deps = [ "//base", - "//components/crash/core/app", "//content/public/browser", "//content/public/common", ] + if (!is_starboard) { + deps += [ + "//components/crash/core/app", + ] + } if (is_castos || is_chromeos || is_android) { sources += [ diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn index 93559f6092c7..b23d65670689 100644 --- a/content/gpu/BUILD.gn +++ b/content/gpu/BUILD.gn @@ -140,7 +140,7 @@ target(link_target_type, "gpu_sources") { # Use DRI on desktop Linux builds. if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && - !is_castos) { + !is_castos && !is_starboard) { configs += [ "//build/config/linux/dri" ] } } diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index 0c169741a534..1a87a42260ea 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn @@ -100,7 +100,7 @@ static_library("content_shell_app") { "//content/web_test:web_test_renderer", ] } - if (!is_fuchsia) { + if (!is_fuchsia && !is_starboard) { deps += [ "//components/crash/core/app", "//components/crash/core/app:test_support", @@ -332,7 +332,7 @@ static_library("content_shell_lib") { } else { deps += [ "//components/crash/content/browser", - "//components/crash/core/app", + #"//components/crash/core/app", ] } @@ -445,7 +445,7 @@ static_library("content_shell_lib") { if (is_cobalt && use_starboard_media) { deps += [ - "//starboard($starboard_toolchain)", + #"//starboard($starboard_toolchain)", ] } } @@ -666,7 +666,7 @@ if (is_android) { data_deps += [ "//third_party/crashpad/crashpad/handler:crashpad_handler" ] } else if (is_linux || is_chromeos) { - data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ] + #data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ] } if ((is_linux || is_chromeos) && !is_component_build) { @@ -755,7 +755,7 @@ if (is_mac) { testonly = true sources = [ "$root_out_dir/chrome_crashpad_handler" ] outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ] - public_deps = [ "//components/crash/core/app:chrome_crashpad_handler" ] + #public_deps = [ "//components/crash/core/app:chrome_crashpad_handler" ] foreach(helper_params, content_mac_helpers) { sources += [ "$root_out_dir/${content_shell_helper_name}${helper_params[2]}.app", diff --git a/media/base/BUILD.gn b/media/base/BUILD.gn index 62a60695952b..43d421deb638 100644 --- a/media/base/BUILD.gn +++ b/media/base/BUILD.gn @@ -484,7 +484,7 @@ source_set("base") { if (is_cobalt && use_starboard_media) { deps += [ - "//starboard($starboard_toolchain)", + #"//starboard($starboard_toolchain)", ] } } diff --git a/media/gpu/sandbox/BUILD.gn b/media/gpu/sandbox/BUILD.gn index cfcb7fa80ef8..018e2c9a722b 100644 --- a/media/gpu/sandbox/BUILD.gn +++ b/media/gpu/sandbox/BUILD.gn @@ -31,7 +31,7 @@ source_set("sandbox") { deps += [ "//media/gpu/v4l2" ] } if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && - !is_castos) { + !is_castos && !is_starboard) { # For DRI_DRIVER_DIR. configs += [ "//build/config/linux/dri" ] } diff --git a/media/starboard/BUILD.gn b/media/starboard/BUILD.gn index c4be5d83006a..fb22cc8b6234 100644 --- a/media/starboard/BUILD.gn +++ b/media/starboard/BUILD.gn @@ -76,8 +76,9 @@ source_set("starboard") { "//base", "//media:media_buildflags", "//media/base", - "//starboard($starboard_toolchain)", - "//starboard/common", + + #"//starboard($starboard_toolchain)", + #"//starboard/common", ] configs += [ "//media:subcomponent_config" ] @@ -94,8 +95,9 @@ source_set("unit_tests") { "//base", "//base/test:test_support", "//media:test_support", - "//starboard($starboard_toolchain)", - "//starboard/common", + + #"//starboard($starboard_toolchain)", + #"//starboard/common", "//testing/gmock", "//testing/gtest", ] diff --git a/net/dns/address_sorter_posix.cc b/net/dns/address_sorter_posix.cc index 0f4afb74871c..e79b6ef0f7a5 100644 --- a/net/dns/address_sorter_posix.cc +++ b/net/dns/address_sorter_posix.cc @@ -39,7 +39,7 @@ #include "net/socket/client_socket_factory.h" #include "net/socket/datagram_client_socket.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) #include "net/base/address_tracker_linux.h" #endif @@ -401,7 +401,7 @@ void AddressSorterPosix::Sort(const std::vector& endpoints, void AddressSorterPosix::OnIPAddressChanged() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); source_map_.clear(); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_STARBOARD) // TODO(crbug.com/1431364): This always returns nullptr on ChromeOS. const AddressMapOwnerLinux* address_map_owner = NetworkChangeNotifier::GetAddressMapOwner(); diff --git a/net/dns/public/scoped_res_state.cc b/net/dns/public/scoped_res_state.cc index 2743697bf6d9..c4dfd08c0f94 100644 --- a/net/dns/public/scoped_res_state.cc +++ b/net/dns/public/scoped_res_state.cc @@ -20,7 +20,8 @@ ScopedResState::ScopedResState() { res_init_result_ = res_init(); #else memset(&res_, 0, sizeof(res_)); - res_init_result_ = res_ninit(&res_); + // hack + //res_init_result_ = res_ninit(&res_); #endif // BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) } @@ -31,7 +32,8 @@ ScopedResState::~ScopedResState() { #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) res_ndestroy(&res_); #else - res_nclose(&res_); + // hack + // res_nclose(&res_); #endif // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) #endif // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn index fd6eebe0f89e..4e46a3d74ec7 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn @@ -231,7 +231,7 @@ source_set("resources") { } } -if (is_linux) { +if (is_linux && !use_starboard) { pkg_config("xkbcommon") { packages = [ "xkbcommon" ] } diff --git a/sandbox/features.gni b/sandbox/features.gni index 8434144118b4..b0e90d9a5c2c 100644 --- a/sandbox/features.gni +++ b/sandbox/features.gni @@ -6,7 +6,7 @@ # currently. # Do not disable seccomp_bpf anywhere without talking to # security@chromium.org! -use_seccomp_bpf = (is_linux || is_chromeos || is_android) && +use_seccomp_bpf = ((is_linux || is_chromeos || is_android) && !is_starboard) && (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" || current_cpu == "arm64" || current_cpu == "mipsel" || current_cpu == "mips64el") diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn index ee57ed301c3d..75cc8e3cc72e 100644 --- a/sandbox/linux/BUILD.gn +++ b/sandbox/linux/BUILD.gn @@ -206,6 +206,7 @@ test("sandbox_linux_unittests") { } } +if (use_seccomp_bpf) { component("seccomp_bpf") { sources = [ "bpf_dsl/bpf_dsl.cc", @@ -262,6 +263,7 @@ component("seccomp_bpf") { ] } } +} if (is_android) { # This target is available even if use_seccomp_bpf is disabled, but it also diff --git a/sandbox/policy/BUILD.gn b/sandbox/policy/BUILD.gn index 2701a2493dc2..52aff1238f46 100644 --- a/sandbox/policy/BUILD.gn +++ b/sandbox/policy/BUILD.gn @@ -101,9 +101,13 @@ component("policy") { ":chromecast_sandbox_allowlist_buildflags", "//sandbox:sandbox_buildflags", "//sandbox/linux:sandbox_services", - "//sandbox/linux:seccomp_bpf", "//sandbox/linux:suid_sandbox_client", ] + if (!is_starboard) { + deps += [ + "//sandbox/linux:seccomp_bpf", + ] + } } if (is_chromeos_ash) { sources += [ diff --git a/services/service_manager/public/cpp/service_executable/BUILD.gn b/services/service_manager/public/cpp/service_executable/BUILD.gn index 049bc94aa199..7927d9c83a5e 100644 --- a/services/service_manager/public/cpp/service_executable/BUILD.gn +++ b/services/service_manager/public/cpp/service_executable/BUILD.gn @@ -22,7 +22,7 @@ source_set("support") { "//services/service_manager/public/mojom", ] - if (is_linux || is_chromeos) { + if ((is_linux || is_chromeos) && !is_starboard) { deps += [ "//sandbox/linux:sandbox", "//sandbox/linux:sandbox_services", diff --git a/skia/BUILD.gn b/skia/BUILD.gn index ea7cfd9e3179..eed7bd6fb517 100644 --- a/skia/BUILD.gn +++ b/skia/BUILD.gn @@ -436,7 +436,7 @@ component("skia") { ] } - if (is_linux || is_chromeos || is_android) { + if ((is_linux || is_chromeos || is_android) && !is_starboard) { sources += [ # Retain the files for the SkFontMgr_Android on linux to emulate android # fonts. See content/zygote/zygote_main_linux.cc diff --git a/sql/database.h b/sql/database.h index e49e3af88120..8455fb034334 100644 --- a/sql/database.h +++ b/sql/database.h @@ -221,9 +221,12 @@ struct COMPONENT_EXPORT(SQL) DatabaseDiagnostics { DatabaseDiagnostics(); ~DatabaseDiagnostics(); +// hack +#if 0 using TraceProto = perfetto::protos::pbzero::ChromeSqlDiagnostics; // Write a representation of this object into tracing proto. void WriteIntoTrace(perfetto::TracedProto context) const; +#endif // This was the original error code that triggered the error callback. Should // generally match `error_code`, but this isn't guaranteed by the code. diff --git a/starboard/BUILD.gn b/starboard/BUILD.gn index 397aa9a92b37..c4c2b11275ae 100644 --- a/starboard/BUILD.gn +++ b/starboard/BUILD.gn @@ -169,7 +169,7 @@ if (!is_cobalt) { } } else { group("starboard_group") { - deps = [ "//starboard($starboard_toolchain)" ] + #deps = [ "//starboard($starboard_toolchain)" ] } } diff --git a/starboard/build/buildflags.gni b/starboard/build/buildflags.gni index d325cfb4a342..86a6149785cb 100644 --- a/starboard/build/buildflags.gni +++ b/starboard/build/buildflags.gni @@ -2,5 +2,4 @@ import("//cobalt/build/configs/cobalt.gni") declare_args() { use_starboard_media = is_cobalt - use_evergreen = false } diff --git a/starboard/build/platform_path.gni b/starboard/build/platform_path.gni index 3795b25b9e9a..3abc6ac1152e 100644 --- a/starboard/build/platform_path.gni +++ b/starboard/build/platform_path.gni @@ -36,7 +36,7 @@ if (starboard_path == "") { if (target_cpu == "x64") { target_platform = "linux-x64x11" } else { - assert(false, "Unsupported linux target cpu ${target_cpu}.") + #assert(false, "Unsupported linux target cpu ${target_cpu}.") } } else { # Default to linux-x64x11 for chromium toolchains. diff --git a/starboard/evergreen/arm/softfp/args.gn b/starboard/evergreen/arm/softfp/args.gn index 8344f8ab846b..92e4a38f080e 100644 --- a/starboard/evergreen/arm/softfp/args.gn +++ b/starboard/evergreen/arm/softfp/args.gn @@ -15,3 +15,36 @@ target_platform = "evergreen-arm-softfp" target_cpu = "arm" target_os = "linux" +is_cobalt = true +is_component_build = false +use_evergreen = true +use_custom_libcxx = true +use_ozone = true +use_cups = false +use_xkbcommon = false +use_dbus = false +use_glib = false +use_nss_certs = false +use_qt = false +use_gio = false +use_gtk = false +use_allocator_shim = false +use_partition_alloc_as_malloc = false +use_pangocairo = false +use_pulseaudio = false +use_crash_key_stubs = true +use_kerberos = false +enable_base_tracing = false +enable_vulkan = false +enable_remoting = false +enable_backup_ref_ptr_support = false +enable_swiftshader = false +angle_build_vulkan_system_info = false +angle_enable_vulkan = false +ozone_platform_wayland = false +ozone_platform_x11 = false +ozone_platform_drm = false +ozone_platform_cast = false +ozone_platform_flatland = false +ozone_platform_headless = false +rtc_use_pipewire = false diff --git a/starboard/evergreen/arm/softfp/toolchain/BUILD.gn b/starboard/evergreen/arm/softfp/toolchain/BUILD.gn index 8f50b01fc27c..9759d6d7b61e 100644 --- a/starboard/evergreen/arm/softfp/toolchain/BUILD.gn +++ b/starboard/evergreen/arm/softfp/toolchain/BUILD.gn @@ -14,7 +14,6 @@ import("//build/config/clang/clang.gni") import("//build/toolchain/gcc_toolchain.gni") - -clang_toolchain("target") { - clang_base_path = clang_base_path -} +#clang_toolchain("target") { +# clang_base_path = clang_base_path +#} diff --git a/third_party/abseil-cpp/BUILD.gn b/third_party/abseil-cpp/BUILD.gn index 4c7893b00e24..3627f1af72fc 100644 --- a/third_party/abseil-cpp/BUILD.gn +++ b/third_party/abseil-cpp/BUILD.gn @@ -115,7 +115,6 @@ config("absl_include_config") { config("absl_define_config") { defines = [ "ABSL_ALLOCATOR_NOTHROW=1" ] - if (is_win && !use_custom_libcxx) { defines += [ # See crbug.com/1101367: Acknowledge extended alignment when using diff --git a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h index 815b8d23ba35..91cc28075dd9 100644 --- a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +++ b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h @@ -24,7 +24,7 @@ #include -#ifdef __linux__ +#if defined(__linux__) && !defined(OS_STARBOARD) #include #ifdef __BIONIC__ diff --git a/third_party/abseil-cpp/absl/base/internal/raw_logging.cc b/third_party/abseil-cpp/absl/base/internal/raw_logging.cc index 6273e8471bcf..f707fc860c9b 100644 --- a/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +++ b/third_party/abseil-cpp/absl/base/internal/raw_logging.cc @@ -53,7 +53,7 @@ // syscall(SYS_write, /*int*/ fd, /*char* */ buf, /*size_t*/ len); // for low level operations that want to avoid libc. #if (defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && \ - !defined(__ANDROID__) + !defined(__ANDROID__) && !defined(OS_STARBOARD) #include #define ABSL_HAVE_SYSCALL_WRITE 1 #define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1 diff --git a/third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc b/third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc index fa824be1c008..ba112444c149 100644 --- a/third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc +++ b/third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc @@ -23,7 +23,7 @@ #if defined(_WIN32) #include "absl/base/internal/spinlock_win32.inc" -#elif defined(__linux__) +#elif defined(__linux__) && !defined(OS_STARBOARD) #include "absl/base/internal/spinlock_linux.inc" #elif defined(__akaros__) #include "absl/base/internal/spinlock_akaros.inc" diff --git a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc index 91eaa76f8a6c..f3eb490a8ad9 100644 --- a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +++ b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc @@ -17,7 +17,7 @@ #include "absl/debugging/internal/address_is_readable.h" -#if !defined(__linux__) || defined(__ANDROID__) +#if !defined(__linux__) || defined(__ANDROID__) || defined(OS_STARBOARD) namespace absl { ABSL_NAMESPACE_BEGIN diff --git a/third_party/abseil-cpp/absl/synchronization/internal/futex.h b/third_party/abseil-cpp/absl/synchronization/internal/futex.h index 55078f14c0e1..11668d9e5c56 100644 --- a/third_party/abseil-cpp/absl/synchronization/internal/futex.h +++ b/third_party/abseil-cpp/absl/synchronization/internal/futex.h @@ -21,10 +21,12 @@ #include #endif +#if !defined(OS_STARBOARD) #ifdef __linux__ #include #include #endif +#endif #include #include @@ -42,7 +44,7 @@ // Bionic supports all the futex operations we need even when some of the futex // definitions are missing. #define ABSL_INTERNAL_HAVE_FUTEX -#elif defined(__linux__) && defined(FUTEX_CLOCK_REALTIME) +#elif defined(__linux__) && defined(FUTEX_CLOCK_REALTIME) && !defined(OS_STARBOARD) // FUTEX_CLOCK_REALTIME requires Linux >= 2.6.28. #define ABSL_INTERNAL_HAVE_FUTEX #endif diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index f75c6b586704..b0dbd02a1d27 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn @@ -402,7 +402,7 @@ component("core") { if (is_cobalt && use_starboard_media) { deps += [ - "//starboard($starboard_toolchain)", + #"//starboard($starboard_toolchain)", ] } } diff --git a/third_party/blink/renderer/modules/mediasource/BUILD.gn b/third_party/blink/renderer/modules/mediasource/BUILD.gn index a14bb0a20c07..4424a7bc186a 100644 --- a/third_party/blink/renderer/modules/mediasource/BUILD.gn +++ b/third_party/blink/renderer/modules/mediasource/BUILD.gn @@ -57,7 +57,7 @@ blink_modules_sources("mediasource") { ] if (is_cobalt && use_starboard_media) { deps += [ - "//starboard($starboard_toolchain)", + #"//starboard($starboard_toolchain)", ] } } diff --git a/third_party/blink/renderer/platform/media/BUILD.gn b/third_party/blink/renderer/platform/media/BUILD.gn index ff684a606c32..d0d47a25addd 100644 --- a/third_party/blink/renderer/platform/media/BUILD.gn +++ b/third_party/blink/renderer/platform/media/BUILD.gn @@ -118,7 +118,7 @@ component("media") { if (is_cobalt && use_starboard_media) { deps += [ - "//starboard($starboard_toolchain)", + #"//starboard($starboard_toolchain)", ] } } diff --git a/third_party/fontconfig/BUILD.gn b/third_party/fontconfig/BUILD.gn index 6d89abc7990f..6abe5983fbf7 100644 --- a/third_party/fontconfig/BUILD.gn +++ b/third_party/fontconfig/BUILD.gn @@ -106,7 +106,7 @@ if (use_bundled_fontconfig) { ] } - if (!is_win) { + if (!is_win && !is_starboard) { libs = [ "uuid" ] } } diff --git a/third_party/fontconfig/include/config.h b/third_party/fontconfig/include/config.h index 61f8a0c6fe09..b94e1442fae6 100644 --- a/third_party/fontconfig/include/config.h +++ b/third_party/fontconfig/include/config.h @@ -153,10 +153,14 @@ #define HAVE_RAND 1 /* Define to 1 if you have the `random' function. */ -#define HAVE_RANDOM 1 +#define HAVE_RANDOM 0 /* Define to 1 if you have the `random_r' function. */ +#if defined(OS_STARBOARD) +#define HAVE_RANDOM_R 0 +#else #define HAVE_RANDOM_R 1 +#endif /* Define to 1 if you have the `rand_r' function. */ #define HAVE_RAND_R 1 diff --git a/third_party/llvm-project/compiler-rt/BUILD.gn b/third_party/llvm-project/compiler-rt/BUILD.gn index 2887ebfd7373..0ac00b4be7f8 100644 --- a/third_party/llvm-project/compiler-rt/BUILD.gn +++ b/third_party/llvm-project/compiler-rt/BUILD.gn @@ -92,5 +92,5 @@ static_library("compiler_rt") { } configs += [ ":compiler_rt_config" ] - configs -= [ "//starboard/build/config:default_cpp_standard" ] +# configs -= [ "//starboard/build/config:default_cpp_standard" ] } diff --git a/third_party/musl/BUILD.gn b/third_party/musl/BUILD.gn index 78ecc77aac79..faca912381ee 100644 --- a/third_party/musl/BUILD.gn +++ b/third_party/musl/BUILD.gn @@ -24,7 +24,7 @@ if (target_cpu == "x64") { config("external_settings") { include_dirs = [ - "musl/include", + "include", "arch/$musl_arch", "arch/generic", ] @@ -519,7 +519,7 @@ static_library("c_internal") { deps = [ "//starboard:starboard_headers_only", - "//starboard/client_porting/eztime", + #"//starboard/client_porting/eztime", "//starboard/common:common_headers_only", ] } diff --git a/third_party/musl/include/pthread.h b/third_party/musl/include/pthread.h index 2703585ad634..a1724b40a6e5 100644 --- a/third_party/musl/include/pthread.h +++ b/third_party/musl/include/pthread.h @@ -1,9 +1,8 @@ #ifndef _PTHREAD_H #define _PTHREAD_H - #if defined(STARBOARD) -#include "third_party/musl/src/starboard/pthread/pthread.h" +#include "pthread_starboard.h" #else diff --git a/third_party/musl/src/starboard/pthread/pthread.h b/third_party/musl/include/pthread_starboard.h similarity index 100% rename from third_party/musl/src/starboard/pthread/pthread.h rename to third_party/musl/include/pthread_starboard.h diff --git a/third_party/musl/include/sys/socket.h b/third_party/musl/include/sys/socket.h index 6dc1e40adfe7..a26e62cb58df 100644 --- a/third_party/musl/include/sys/socket.h +++ b/third_party/musl/include/sys/socket.h @@ -355,7 +355,7 @@ struct linger { #define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1)) #define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \ - __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \ + __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= static_cast(__MHDR_END(mhdr) - (unsigned char *)(cmsg)) \ ? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg)) #define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) diff --git a/third_party/musl/src/starboard/stdio/fputc.c b/third_party/musl/src/starboard/stdio/fputc.c index f4e6e0d6bc2e..32584c6a9155 100644 --- a/third_party/musl/src/starboard/stdio/fputc.c +++ b/third_party/musl/src/starboard/stdio/fputc.c @@ -6,10 +6,13 @@ int fputc(int c, FILE *f) { // writing to stdout or stderr are handled. SB_DCHECK((f == stdout) || (f == stderr)); const char ch = c; +// hack +#if 0 if (f == stdout) { SbLog(kSbLogPriorityInfo, ch); } else { SbLog(kSbLogPriorityError, ch); } +#endif return ch; } diff --git a/third_party/zlib/cpu_features.c b/third_party/zlib/cpu_features.c index ac6ee88e460e..ca0d0d470b47 100644 --- a/third_party/zlib/cpu_features.c +++ b/third_party/zlib/cpu_features.c @@ -41,7 +41,7 @@ int ZLIB_INTERNAL x86_cpu_enable_avx512 = 0; #if defined(ARMV8_OS_ANDROID) #include -#elif defined(ARMV8_OS_LINUX) +#elif defined(ARMV8_OS_LINUX) && !defined(OS_STARBOARD) #include #include #elif defined(ARMV8_OS_FUCHSIA) @@ -114,9 +114,10 @@ static void _cpu_check_features(void) arm_cpu_enable_pmull = !!(features & HWCAP_PMULL); #elif defined(ARMV8_OS_LINUX) && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* Query HWCAP2 for ARMV8-A SoCs running in aarch32 mode */ - unsigned long features = getauxval(AT_HWCAP2); - arm_cpu_enable_crc32 = !!(features & HWCAP2_CRC32); - arm_cpu_enable_pmull = !!(features & HWCAP2_PMULL); +// hack: + //unsigned long features = getauxval(AT_HWCAP2); + //arm_cpu_enable_crc32 = !!(features & HWCAP2_CRC32); + //arm_cpu_enable_pmull = !!(features & HWCAP2_PMULL); #elif defined(ARMV8_OS_FUCHSIA) uint32_t features; zx_status_t rc = zx_system_get_features(ZX_FEATURE_KIND_CPU, &features); diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn index 34a269ee4d47..9ed90a3d64a3 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -608,17 +608,19 @@ source_set("memory_buffer_sources") { "//ui/gfx/geometry", ] - if (is_linux || is_chromeos) { - sources += [ - "linux/client_native_pixmap_dmabuf.cc", - "linux/client_native_pixmap_dmabuf.h", - "linux/client_native_pixmap_factory_dmabuf.cc", - "linux/client_native_pixmap_factory_dmabuf.h", - "linux/native_pixmap_dmabuf.cc", - "linux/native_pixmap_dmabuf.h", - ] + if (!is_starboard) { + if (is_linux || is_chromeos) { + sources += [ + "linux/client_native_pixmap_dmabuf.cc", + "linux/client_native_pixmap_dmabuf.h", + "linux/client_native_pixmap_factory_dmabuf.cc", + "linux/client_native_pixmap_factory_dmabuf.h", + "linux/native_pixmap_dmabuf.cc", + "linux/native_pixmap_dmabuf.h", + ] - deps += [ "//build/config/linux/libdrm" ] + deps += [ "//build/config/linux/libdrm" ] + } } if (is_linux || is_chromeos || is_android) {