diff options
Diffstat (limited to 'lang/v8-beta/files')
32 files changed, 719 insertions, 0 deletions
diff --git a/lang/v8-beta/files/patch-BUILD.gn b/lang/v8-beta/files/patch-BUILD.gn new file mode 100644 index 000000000000..f39f14add820 --- /dev/null +++ b/lang/v8-beta/files/patch-BUILD.gn @@ -0,0 +1,32 @@ +--- BUILD.gn.orig 2021-10-06 18:22:58 UTC ++++ BUILD.gn +@@ -4804,7 +4804,7 @@ v8_component("v8_libbase") { + } + } + +- if (is_linux || is_chromeos) { ++ if ((is_linux || is_chromeos) && !is_bsd) { + sources += [ + "src/base/debug/stack_trace_posix.cc", + "src/base/platform/platform-linux.cc", +@@ -4821,6 +4821,12 @@ v8_component("v8_libbase") { + ] + + libs = [ "dl" ] ++ } else if (is_bsd) { ++ sources += [ ++ "src/base/debug/stack_trace_posix.cc", ++ "src/base/platform/platform-freebsd.cc", ++ ] ++ libs = [ "rt", "execinfo" ] + } else if (is_android) { + if (current_toolchain == host_toolchain) { + libs = [ +@@ -5313,6 +5319,7 @@ if (v8_monolithic) { + ":v8_libplatform", + "//build/win:default_exe_manifest", + ] ++ libs = ["execinfo"] + + configs = [ ":internal_config" ] + } diff --git a/lang/v8-beta/files/patch-build_config_BUILD.gn b/lang/v8-beta/files/patch-build_config_BUILD.gn new file mode 100644 index 000000000000..862adcb37658 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_BUILD.gn @@ -0,0 +1,30 @@ +--- build/config/BUILD.gn.orig 2021-05-26 12:26:11 UTC ++++ build/config/BUILD.gn +@@ -128,7 +128,7 @@ config("debug") { + # builds, and we have to tell it to turn it off. + defines += [ "_HAS_ITERATOR_DEBUGGING=0" ] + } +- } else if ((is_linux || is_chromeos) && current_cpu == "x64" && ++ } else if ((is_linux || is_chromeos || is_bsd) && current_cpu == "x64" && + enable_iterator_debugging) { + # Enable libstdc++ debugging facilities to help catch problems early, see + # http://crbug.com/65151 . +@@ -227,9 +227,7 @@ config("default_libs") { + ] + } else if (is_linux || is_chromeos) { + libs = [ +- "dl", + "pthread", +- "rt", + ] + } + } +@@ -308,7 +306,7 @@ config("executable_config") { + "//build/config/ios:ios_dynamic_flags", + "//build/config/ios:ios_executable_flags", + ] +- } else if (is_linux || is_chromeos || is_android || current_os == "aix") { ++ } else if (is_linux || is_bsd || is_chromeos || is_android || current_os == "aix") { + configs += [ "//build/config/gcc:executable_config" ] + if (is_chromecast) { + configs += [ "//build/config/chromecast:executable_config" ] diff --git a/lang/v8-beta/files/patch-build_config_BUILDCONFIG.gn b/lang/v8-beta/files/patch-build_config_BUILDCONFIG.gn new file mode 100644 index 000000000000..926e6acaf504 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_BUILDCONFIG.gn @@ -0,0 +1,44 @@ +--- build/config/BUILDCONFIG.gn.orig 2021-05-26 12:26:11 UTC ++++ build/config/BUILDCONFIG.gn +@@ -131,7 +131,7 @@ declare_args() { + is_official_build = false + + # Set to true when compiling with the Clang compiler. +- is_clang = current_os != "linux" || ++ is_clang = current_os != "linux" || current_os == "freebsd" || + (current_cpu != "s390x" && current_cpu != "s390" && + current_cpu != "ppc64" && current_cpu != "ppc" && + current_cpu != "mips" && current_cpu != "mips64" && +@@ -184,8 +184,8 @@ if (host_toolchain == "") { + # TODO(dpranke): Add some sort of assert here that verifies that + # no toolchain omitted host_toolchain from its toolchain_args(). + +- if (host_os == "linux") { +- if (target_os != "linux") { ++ if (host_os == "linux" || host_os == "freebsd") { ++ if (target_os != "linux" && target_os != "freebsd") { + host_toolchain = "//build/toolchain/linux:clang_$host_cpu" + } else if (is_clang) { + host_toolchain = "//build/toolchain/linux:clang_$host_cpu" +@@ -222,7 +222,7 @@ if (target_os == "android") { + assert(host_os == "linux" || host_os == "mac", + "Android builds are only supported on Linux and Mac hosts.") + _default_toolchain = "//build/toolchain/android:android_clang_$target_cpu" +-} else if (target_os == "chromeos" || target_os == "linux") { ++} else if (target_os == "chromeos" || target_os == "linux" || target_os == "freebsd") { + # See comments in build/toolchain/cros/BUILD.gn about board compiles. + if (is_clang) { + _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" +@@ -287,10 +287,11 @@ is_android = current_os == "android" + is_chromeos = current_os == "chromeos" + is_fuchsia = current_os == "fuchsia" + is_ios = current_os == "ios" +-is_linux = current_os == "linux" ++is_linux = current_os == "linux" || current_os == "freebsd" + is_mac = current_os == "mac" + is_nacl = current_os == "nacl" + is_win = current_os == "win" || current_os == "winuwp" ++is_bsd = current_os == "freebsd" + + is_apple = is_ios || is_mac + is_posix = !is_win && !is_fuchsia diff --git a/lang/v8-beta/files/patch-build_config_compiler_BUILD.gn b/lang/v8-beta/files/patch-build_config_compiler_BUILD.gn new file mode 100644 index 000000000000..20c0c04bcf4c --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_compiler_BUILD.gn @@ -0,0 +1,101 @@ +--- build/config/compiler/BUILD.gn.orig 2021-10-20 15:47:54 UTC ++++ build/config/compiler/BUILD.gn +@@ -140,7 +140,7 @@ declare_args() { + # + # TODO(crbug.com/1131993): Enabling this when 'is_android' is true breaks + # content_shell_test_apk on both ARM and x86. +- init_stack_vars = !is_android ++ init_stack_vars = !is_android && !is_bsd + + # This argument is to control whether enabling text section splitting in the + # final binary. When enabled, the separated text sections with prefix +@@ -355,7 +355,7 @@ config("compiler") { + } + + # Linker warnings. +- if (fatal_linker_warnings && !is_apple && current_os != "aix") { ++ if (fatal_linker_warnings && !is_apple && !is_bsd && current_os != "aix") { + ldflags += [ "-Wl,--fatal-warnings" ] + } + if (fatal_linker_warnings && is_apple) { +@@ -531,7 +531,7 @@ config("compiler") { + ldflags += [ "-Wl,-z,keep-text-section-prefix" ] + } + +- if (is_clang && !is_nacl && !use_xcode_clang) { ++ if (is_clang && !is_nacl && !use_xcode_clang && !is_bsd) { + cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ] + + # TODO(hans): Remove this once Clang generates better optimized debug info +@@ -909,7 +909,7 @@ config("compiler_cpu_abi") { + cflags += [ "-mtune=$arm_tune" ] + } + } else if (current_cpu == "arm64") { +- if (is_clang && !is_android && !is_nacl && !is_fuchsia) { ++ if (is_clang && !is_android && !is_nacl && !is_fuchsia && !is_bsd) { + cflags += [ "--target=aarch64-linux-gnu" ] + ldflags += [ "--target=aarch64-linux-gnu" ] + } +@@ -1253,7 +1253,7 @@ config("compiler_deterministic") { + # different build directory like "out/feature_a" and "out/feature_b" if + # we build same files with same compile flag. + # Other paths are already given in relative, no need to normalize them. +- if (is_nacl) { ++ if (is_nacl || is_bsd) { + # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here. + cflags += [ + "-Xclang", +@@ -1266,7 +1266,7 @@ config("compiler_deterministic") { + # and -fcoverage-compilation-dir=. + cflags += [ "-ffile-compilation-dir=." ] + } +- if (!is_win) { ++ if (!is_win && !is_bsd) { + # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167) + asmflags = [ "-Wa,-fdebug-compilation-dir,." ] + } +@@ -1650,7 +1650,7 @@ config("default_warnings") { + cflags += [ "-Wno-null-pointer-subtraction" ] + } + +- if (current_toolchain == host_toolchain || !use_xcode_clang) { ++ if ((current_toolchain == host_toolchain || !use_xcode_clang) && !is_bsd) { + # Flags Xcode 9.2 (Clang clang-900.0.39.2) does not recognize. + cflags += [ + "-Wenum-compare-conditional", +@@ -1904,7 +1904,7 @@ config("thin_archive") { + # archives. + # TODO(crbug.com/1221615): Enable on is_apple if use_lld once that no longer + # confuses lldb. +- if ((is_posix && !is_nacl && !is_apple) || is_fuchsia) { ++ if ((is_posix && !is_nacl && !is_apple && !is_bsd) || is_fuchsia) { + arflags = [ "-T" ] + } else if (is_win && use_lld) { + arflags = [ "/llvmlibthin" ] +@@ -2404,7 +2404,7 @@ config("symbols") { + # flag, so we can use use -g1 for pnacl and nacl-clang compiles. + # gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang. + if (!is_nacl || is_clang) { +- cflags += [ "-g2" ] ++ cflags += [ "-g0" ] + } + + if (!is_nacl && is_clang && !is_tsan && !is_asan) { +@@ -2439,7 +2439,7 @@ config("symbols") { + # DWARF info may be corrupt; offsets in a range list entry are in different + # sections" there. Maybe just a bug in nacl_switch_32.S. + if (!is_apple && !is_nacl && current_cpu != "x86" && +- (use_gold || use_lld)) { ++ (use_gold || use_lld) && !is_bsd) { + if (is_clang) { + # This flag enables the GNU-format pubnames and pubtypes sections, + # which lld needs in order to generate a correct GDB index. +@@ -2452,7 +2452,7 @@ config("symbols") { + } + + if (is_clang && !is_nacl && !use_xcode_clang) { +- if (is_apple) { ++ if (is_apple || is_bsd) { + # TODO(https://crbug.com/1050118): Investigate missing debug info on mac. + # Make sure we don't use constructor homing on mac. + cflags += [ diff --git a/lang/v8-beta/files/patch-build_config_compiler_compiler.gni b/lang/v8-beta/files/patch-build_config_compiler_compiler.gni new file mode 100644 index 000000000000..b40ee50f0b69 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_compiler_compiler.gni @@ -0,0 +1,11 @@ +--- build/config/compiler/compiler.gni.orig 2021-10-13 07:49:03 UTC ++++ build/config/compiler/compiler.gni +@@ -205,7 +205,7 @@ declare_args() { + + declare_args() { + # Whether to use the gold linker from binutils instead of lld or bfd. +- use_gold = !use_lld && !(is_chromecast && is_linux && ++ use_gold = !use_lld && !is_bsd && !(is_chromecast && is_linux && + (current_cpu == "arm" || current_cpu == "mipsel")) && + (((is_linux || is_chromeos_lacros) && + (current_cpu == "x64" || current_cpu == "x86" || diff --git a/lang/v8-beta/files/patch-build_config_features.gni b/lang/v8-beta/files/patch-build_config_features.gni new file mode 100644 index 000000000000..4469d4f06273 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_features.gni @@ -0,0 +1,11 @@ +--- build/config/features.gni.orig 2020-09-19 19:50:44 UTC ++++ build/config/features.gni +@@ -26,7 +26,7 @@ declare_args() { + proprietary_codecs = is_chrome_branded || is_chromecast + + # libudev usage. This currently only affects the content layer. +- use_udev = (is_linux || is_chromeos) && !is_chromecast ++ use_udev = (is_linux || is_chromeos) && !is_chromecast && !is_bsd + + use_dbus = (is_linux || is_chromeos) && !is_chromecast + diff --git a/lang/v8-beta/files/patch-build_config_freetype_freetype.gni b/lang/v8-beta/files/patch-build_config_freetype_freetype.gni new file mode 100644 index 000000000000..17bed01510f8 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_freetype_freetype.gni @@ -0,0 +1,9 @@ +--- build/config/freetype/freetype.gni.orig 2019-03-18 08:59:45 UTC ++++ build/config/freetype/freetype.gni +@@ -10,5 +10,5 @@ declare_args() { + # than version 2.7.1 and have color bitmap support compiled in. WARNING: + # System FreeType configurations other than as described WILL INTRODUCE TEXT + # RENDERING AND SECURITY REGRESSIONS. +- use_system_freetype = false ++ use_system_freetype = true + } diff --git a/lang/v8-beta/files/patch-build_config_linux_BUILD.gn b/lang/v8-beta/files/patch-build_config_linux_BUILD.gn new file mode 100644 index 000000000000..9b9bb1d634f9 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_linux_BUILD.gn @@ -0,0 +1,11 @@ +--- build/config/linux/BUILD.gn.orig 2021-10-13 07:49:03 UTC ++++ build/config/linux/BUILD.gn +@@ -39,7 +39,7 @@ config("runtime_library") { + + if ((!(is_chromeos_ash || is_chromeos_lacros) || + default_toolchain != "//build/toolchain/cros:target") && +- (!use_custom_libcxx || current_cpu == "mipsel")) { ++ (!use_custom_libcxx || current_cpu == "mipsel") && !is_bsd) { + libs = [ "atomic" ] + } + } diff --git a/lang/v8-beta/files/patch-build_config_linux_pkg-config.py b/lang/v8-beta/files/patch-build_config_linux_pkg-config.py new file mode 100644 index 000000000000..8a2865a024c0 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_linux_pkg-config.py @@ -0,0 +1,26 @@ +--- build/config/linux/pkg-config.py.orig 2019-07-24 18:58:02 UTC ++++ build/config/linux/pkg-config.py +@@ -59,8 +59,12 @@ def SetConfigPath(options): + print("You must specify an architecture via -a if using a sysroot.") + sys.exit(1) + +- libdir = sysroot + '/usr/' + options.system_libdir + '/pkgconfig' +- libdir += ':' + sysroot + '/usr/share/pkgconfig' ++ if "linux" in sys.platform: ++ libdir = sysroot + '/libdata/' + options.system_libdir + '/pkgconfig' ++ libdir += ':' + sysroot + '/usr/share/pkgconfig' ++ elif "bsd" in sys.platform: ++ libdir = sysroot + '/libdata/pkgconfig' ++ libdir += ':' + '/usr/libdata/pkgconfig' + os.environ['PKG_CONFIG_LIBDIR'] = libdir + return libdir + +@@ -109,7 +113,7 @@ def main(): + # If this is run on non-Linux platforms, just return nothing and indicate + # success. This allows us to "kind of emulate" a Linux build from other + # platforms. +- if "linux" not in sys.platform: ++ if "bsd" not in sys.platform: + print("[[],[],[],[],[]]") + return 0 + diff --git a/lang/v8-beta/files/patch-build_config_rust.gni b/lang/v8-beta/files/patch-build_config_rust.gni new file mode 100644 index 000000000000..b272ec620862 --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_rust.gni @@ -0,0 +1,11 @@ +--- build/config/rust.gni.orig 2021-10-20 15:47:54 UTC ++++ build/config/rust.gni +@@ -58,7 +58,7 @@ toolchain_has_official_rust = + (!is_nacl && + (is_android && (current_cpu == "arm" || current_cpu == "arm64" || + current_cpu == "x64" || current_cpu == "x86"))) || +- (is_linux && current_cpu == "x64") ++ (current_os == "linux" && current_cpu == "x64") + + toolchain_has_rust = enable_rust && (toolchain_has_official_rust || + use_unverified_rust_toolchain) diff --git a/lang/v8-beta/files/patch-build_config_sysroot.gni b/lang/v8-beta/files/patch-build_config_sysroot.gni new file mode 100644 index 000000000000..8b68404769fb --- /dev/null +++ b/lang/v8-beta/files/patch-build_config_sysroot.gni @@ -0,0 +1,14 @@ +--- build/config/sysroot.gni.orig 2020-05-13 18:39:36 UTC ++++ build/config/sysroot.gni +@@ -21,9 +21,9 @@ declare_args() { + + # Controls default is_linux sysroot. If set to true, and sysroot + # is empty, default sysroot is calculated. +- use_sysroot = current_cpu == "x86" || current_cpu == "x64" || ++ use_sysroot = !is_bsd && (current_cpu == "x86" || current_cpu == "x64" || + current_cpu == "arm" || current_cpu == "arm64" || +- current_cpu == "mipsel" || current_cpu == "mips64el" ++ current_cpu == "mipsel" || current_cpu == "mips64el") + } + + if (sysroot == "") { diff --git a/lang/v8-beta/files/patch-build_detect__host__arch.py b/lang/v8-beta/files/patch-build_detect__host__arch.py new file mode 100644 index 000000000000..588896662607 --- /dev/null +++ b/lang/v8-beta/files/patch-build_detect__host__arch.py @@ -0,0 +1,11 @@ +--- build/detect_host_arch.py.orig 2019-07-24 18:58:02 UTC ++++ build/detect_host_arch.py +@@ -21,6 +21,8 @@ def HostArch(): + host_arch = 'ia32' + elif host_arch in ['x86_64', 'amd64']: + host_arch = 'x64' ++ elif host_arch.startswith('arm64'): ++ host_arch = 'arm64' + elif host_arch.startswith('arm'): + host_arch = 'arm' + elif host_arch.startswith('aarch64'): diff --git a/lang/v8-beta/files/patch-build_gn__run__binary.py b/lang/v8-beta/files/patch-build_gn__run__binary.py new file mode 100644 index 000000000000..d9e733834b4a --- /dev/null +++ b/lang/v8-beta/files/patch-build_gn__run__binary.py @@ -0,0 +1,11 @@ +--- build/gn_run_binary.py.orig 2019-07-24 18:58:02 UTC ++++ build/gn_run_binary.py +@@ -24,7 +24,7 @@ if not os.path.isabs(path): + # The rest of the arguments are passed directly to the executable. + args = [path] + sys.argv[2:] + +-ret = subprocess.call(args) ++ret = subprocess.call(args, env={"CHROME_EXE_PATH":"${WRKSRC}/out/Release/chrome"}) + if ret != 0: + if ret <= -100: + # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to diff --git a/lang/v8-beta/files/patch-build_linux_chrome.map b/lang/v8-beta/files/patch-build_linux_chrome.map new file mode 100644 index 000000000000..f540509b3054 --- /dev/null +++ b/lang/v8-beta/files/patch-build_linux_chrome.map @@ -0,0 +1,29 @@ +--- build/linux/chrome.map.orig 2021-05-01 21:15:31 UTC ++++ build/linux/chrome.map +@@ -1,4 +1,7 @@ + { ++local: ++ *; ++ + global: + __bss_start; + __data_start; +@@ -20,6 +23,10 @@ global: + # Program entry point. + _start; + ++ # FreeBSD specific variables. ++ __progname; ++ environ; ++ + # Memory allocation symbols. We want chrome and any libraries to + # share the same heap, so it is correct to export these symbols. + calloc; +@@ -83,7 +90,4 @@ global: + localtime_r; + + v8dbg_*; +- +-local: +- *; + }; diff --git a/lang/v8-beta/files/patch-build_linux_libpci_BUILD.gn b/lang/v8-beta/files/patch-build_linux_libpci_BUILD.gn new file mode 100644 index 000000000000..86373b5ebf39 --- /dev/null +++ b/lang/v8-beta/files/patch-build_linux_libpci_BUILD.gn @@ -0,0 +1,53 @@ +--- build/linux/libpci/BUILD.gn.orig 2019-03-11 22:00:52 UTC ++++ build/linux/libpci/BUILD.gn +@@ -3,20 +3,36 @@ + # found in the LICENSE file. + + import("//tools/generate_library_loader/generate_library_loader.gni") ++import("//build/config/linux/pkg_config.gni") + +-# This generates a target named "libpci". +-generate_library_loader("libpci") { +- name = "LibPciLoader" +- output_h = "libpci.h" +- output_cc = "libpci_loader.cc" +- header = "<pci/pci.h>" ++declare_args() { ++ use_system_libpci = is_bsd ++} + +- functions = [ +- "pci_alloc", +- "pci_init", +- "pci_cleanup", +- "pci_scan_bus", +- "pci_fill_info", +- "pci_lookup_name", +- ] ++if (use_system_libpci) { ++ pkg_config("system_libpci") { ++ packages = [ "libpci" ] ++ } ++ ++ source_set("libpci") { ++ public_configs = [ ":system_libpci" ] ++ } ++ ++} else { ++ # This generates a target named "libpci". ++ generate_library_loader("libpci") { ++ name = "LibPciLoader" ++ output_h = "libpci.h" ++ output_cc = "libpci_loader.cc" ++ header = "<pci/pci.h>" ++ ++ functions = [ ++ "pci_alloc", ++ "pci_init", ++ "pci_cleanup", ++ "pci_scan_bus", ++ "pci_fill_info", ++ "pci_lookup_name", ++ ] ++ } + } diff --git a/lang/v8-beta/files/patch-build_linux_unbundle_libusb.gn b/lang/v8-beta/files/patch-build_linux_unbundle_libusb.gn new file mode 100644 index 000000000000..1cc0b00012c6 --- /dev/null +++ b/lang/v8-beta/files/patch-build_linux_unbundle_libusb.gn @@ -0,0 +1,27 @@ +--- build/linux/unbundle/libusb.gn.orig 2019-03-17 01:47:13 UTC ++++ build/linux/unbundle/libusb.gn +@@ -0,0 +1,24 @@ ++# Copyright 2016 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++import("//build/config/linux/pkg_config.gni") ++import("//build/shim_headers.gni") ++ ++pkg_config("system_libusb") { ++ packages = [ "libusb-1.0" ] ++} ++ ++shim_headers("libusb_shim") { ++ root_path = "src/libusb" ++ headers = [ ++ "libusb.h", ++ ] ++} ++ ++source_set("libusb") { ++ deps = [ ++ ":libusb_shim", ++ ] ++ public_configs = [ ":system_libusb" ] ++} diff --git a/lang/v8-beta/files/patch-build_linux_unbundle_replace__gn__files.py b/lang/v8-beta/files/patch-build_linux_unbundle_replace__gn__files.py new file mode 100644 index 000000000000..ca2d4fd5e12e --- /dev/null +++ b/lang/v8-beta/files/patch-build_linux_unbundle_replace__gn__files.py @@ -0,0 +1,10 @@ +--- build/linux/unbundle/replace_gn_files.py.orig 2019-03-11 22:00:52 UTC ++++ build/linux/unbundle/replace_gn_files.py +@@ -27,6 +27,7 @@ REPLACEMENTS = { + 'libevent': 'base/third_party/libevent/BUILD.gn', + 'libjpeg': 'third_party/libjpeg.gni', + 'libpng': 'third_party/libpng/BUILD.gn', ++ 'libusb': 'third_party/libusb/BUILD.gn', + 'libvpx': 'third_party/libvpx/BUILD.gn', + 'libwebp': 'third_party/libwebp/BUILD.gn', + 'libxml': 'third_party/libxml/BUILD.gn', diff --git a/lang/v8-beta/files/patch-build_toolchain_gcc__toolchain.gni b/lang/v8-beta/files/patch-build_toolchain_gcc__toolchain.gni new file mode 100644 index 000000000000..528964d2bc7d --- /dev/null +++ b/lang/v8-beta/files/patch-build_toolchain_gcc__toolchain.gni @@ -0,0 +1,45 @@ +--- build/toolchain/gcc_toolchain.gni.orig 2021-10-13 07:49:03 UTC ++++ build/toolchain/gcc_toolchain.gni +@@ -48,6 +48,11 @@ if (enable_resource_allowlist_generation) { + "enable_resource_allowlist_generation=true does not work for target_os=$target_os") + } + ++declare_args() { ++ extra_cxxflags = "" ++ extra_ldflags = "" ++} ++ + # This template defines a toolchain for something that works like gcc + # (including clang). + # +@@ -673,13 +678,23 @@ template("clang_toolchain") { + } + + gcc_toolchain(target_name) { +- prefix = rebase_path("$clang_base_path/bin", root_build_dir) +- cc = "$prefix/clang" +- cxx = "$prefix/clang++" +- ld = cxx +- readelf = "${toolprefix}readelf" +- ar = "${prefix}/llvm-ar" +- nm = "${prefix}/llvm-nm" ++ if (is_bsd) { ++ prefix = "%%LOCALBASE%%/bin" ++ cc = "cc" ++ cxx = "c++" ++ ld = cxx ++ readelf = "${toolprefix}readelf" ++ ar = "${prefix}/ar" ++ nm = "${prefix}/nm" ++ } else { ++ prefix = rebase_path("$clang_base_path/bin", root_build_dir) ++ cc = "$prefix/clang" ++ cxx = "$prefix/clang++" ++ ld = cxx ++ readelf = "${toolprefix}readelf" ++ ar = "${prefix}/llvm-ar" ++ nm = "${prefix}/llvm-nm" ++ } + + forward_variables_from(invoker, + [ diff --git a/lang/v8-beta/files/patch-build_toolchain_get__concurrent__links.py b/lang/v8-beta/files/patch-build_toolchain_get__concurrent__links.py new file mode 100644 index 000000000000..edf94a0e06b7 --- /dev/null +++ b/lang/v8-beta/files/patch-build_toolchain_get__concurrent__links.py @@ -0,0 +1,17 @@ +--- build/toolchain/get_concurrent_links.py.orig 2021-05-01 21:15:31 UTC ++++ build/toolchain/get_concurrent_links.py +@@ -53,6 +53,14 @@ def _GetTotalMemoryInBytes(): + return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize'])) + except Exception: + return 0 ++ elif sys.platform.startswith('freebsd'): ++ try: ++ avail_bytes = int(subprocess.check_output(['sysctl', '-n', 'hw.physmem'])) ++ # With -fuse-lld it doesn't take a lot of ram, feel free to change that ++ # 1 * ... to needed amount ++ return max(1, avail_bytes / (1 * (2 ** 30))) # total / 4GB ++ except Exception: ++ return 1 + # TODO(scottmg): Implement this for other platforms. + return 0 + diff --git a/lang/v8-beta/files/patch-build_toolchain_linux_BUILD.gn b/lang/v8-beta/files/patch-build_toolchain_linux_BUILD.gn new file mode 100644 index 000000000000..08d5cf924d40 --- /dev/null +++ b/lang/v8-beta/files/patch-build_toolchain_linux_BUILD.gn @@ -0,0 +1,10 @@ +--- build/toolchain/linux/BUILD.gn.orig 2021-05-01 21:15:31 UTC ++++ build/toolchain/linux/BUILD.gn +@@ -23,7 +23,6 @@ clang_toolchain("clang_arm") { + } + + clang_toolchain("clang_arm64") { +- toolprefix = "aarch64-linux-gnu-" + toolchain_args = { + current_cpu = "arm64" + current_os = "linux" diff --git a/lang/v8-beta/files/patch-buildtools_third__party_libc++_BUILD.gn b/lang/v8-beta/files/patch-buildtools_third__party_libc++_BUILD.gn new file mode 100644 index 000000000000..da2a4bc2e17a --- /dev/null +++ b/lang/v8-beta/files/patch-buildtools_third__party_libc++_BUILD.gn @@ -0,0 +1,10 @@ +--- buildtools/third_party/libc++/BUILD.gn.orig 2021-09-19 10:01:13 UTC ++++ buildtools/third_party/libc++/BUILD.gn +@@ -23,6 +23,7 @@ config("config") { + cflags += [ + "-fPIC", + "-std=c++17", ++ "-I%%LOCALBASE%%/include", + ] + } + } diff --git a/lang/v8-beta/files/patch-include_v8config.h b/lang/v8-beta/files/patch-include_v8config.h new file mode 100644 index 000000000000..2a1c5e2972e9 --- /dev/null +++ b/lang/v8-beta/files/patch-include_v8config.h @@ -0,0 +1,21 @@ +--- include/v8config.h.orig 2021-10-06 18:22:58 UTC ++++ include/v8config.h +@@ -338,7 +338,18 @@ path. Add it with -I<path> to the command line + + # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard)) + ++// Work around Clang bug present in 9.0.1, at least. ++// ++// Clang stores alignment as a 32-bit unsigned integer, but V8 only uses ++// V8_ASSUME_ALIGNED() for a 4GB (2^32) alignment ++// (kPtrComprIsolateRootAlignment). As such, the alignment overflows and ++// becomes zero, triggering an internal Clang assertion that alignment must not ++// be zero. ++#if 0 + # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned)) ++#else ++# define V8_HAS_BUILTIN_ASSUME_ALIGNED 0 ++#endif + # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16)) + # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32)) + # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64)) diff --git a/lang/v8-beta/files/patch-src_api_api.cc b/lang/v8-beta/files/patch-src_api_api.cc new file mode 100644 index 000000000000..056c643b5194 --- /dev/null +++ b/lang/v8-beta/files/patch-src_api_api.cc @@ -0,0 +1,11 @@ +--- src/api/api.cc.orig 2021-10-06 18:22:58 UTC ++++ src/api/api.cc +@@ -5886,7 +5886,7 @@ bool v8::V8::Initialize(const int build_config) { + return true; + } + +-#if V8_OS_LINUX || V8_OS_MACOSX ++#if V8_OS_LINUX || V8_OS_MACOSX || V8_OS_OPENBSD || V8_OS_FREEBSD + bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info, + void* context) { + #if V8_ENABLE_WEBASSEMBLY && V8_TRAP_HANDLER_SUPPORTED diff --git a/lang/v8-beta/files/patch-src_base_cpu.cc b/lang/v8-beta/files/patch-src_base_cpu.cc new file mode 100644 index 000000000000..edded0adef06 --- /dev/null +++ b/lang/v8-beta/files/patch-src_base_cpu.cc @@ -0,0 +1,18 @@ +--- src/base/cpu.cc.orig 2021-10-06 18:22:58 UTC ++++ src/base/cpu.cc +@@ -568,6 +568,7 @@ CPU::CPU() + + #if V8_OS_LINUX + ++#if V8_OS_LINUX + CPUInfo cpu_info; + + // Extract implementor from the "CPU implementer" field. +@@ -601,6 +602,7 @@ CPU::CPU() + } + delete[] part; + } ++#endif + + // Extract architecture from the "CPU Architecture" field. + // The list is well-known, unlike the the output of diff --git a/lang/v8-beta/files/patch-src_base_platform_platform-freebsd.cc b/lang/v8-beta/files/patch-src_base_platform_platform-freebsd.cc new file mode 100644 index 000000000000..0af7a6ed208b --- /dev/null +++ b/lang/v8-beta/files/patch-src_base_platform_platform-freebsd.cc @@ -0,0 +1,13 @@ +--- src/base/platform/platform-freebsd.cc.orig 2021-04-22 15:00:28 UTC ++++ src/base/platform/platform-freebsd.cc +@@ -82,8 +82,8 @@ std::vector<OS::SharedLibraryAddress> OS::GetSharedLib + lib_name = std::string(path); + } + result.push_back(SharedLibraryAddress( +- lib_name, reinterpret_cast<uintptr_t>(map->kve_start), +- reinterpret_cast<uintptr_t>(map->kve_end))); ++ lib_name, static_cast<uintptr_t>(map->kve_start), ++ static_cast<uintptr_t>(map->kve_end))); + } + + start += ssize; diff --git a/lang/v8-beta/files/patch-src_base_platform_platform-posix.cc b/lang/v8-beta/files/patch-src_base_platform_platform-posix.cc new file mode 100644 index 000000000000..df2cb6eb4180 --- /dev/null +++ b/lang/v8-beta/files/patch-src_base_platform_platform-posix.cc @@ -0,0 +1,24 @@ +--- src/base/platform/platform-posix.cc.orig 2021-10-06 18:22:58 UTC ++++ src/base/platform/platform-posix.cc +@@ -493,7 +493,7 @@ bool OS::DiscardSystemPages(void* address, size_t size + + // static + bool OS::HasLazyCommits() { +-#if V8_OS_AIX || V8_OS_LINUX || V8_OS_MACOSX ++#if V8_OS_AIX || V8_OS_LINUX || V8_OS_MACOSX || V8_OS_FREEBSD + return true; + #else + // TODO(bbudge) Return true for all POSIX platforms. +@@ -626,6 +626,12 @@ int OS::GetCurrentThreadId() { + return static_cast<int>(syscall(__NR_gettid)); + #elif V8_OS_ANDROID + return static_cast<int>(gettid()); ++#elif V8_OS_DRAGONFLYBSD || defined(__DragonFly__) ++ return static_cast<int>(lwp_gettid()); ++#elif V8_OS_FREEBSD ++ return static_cast<int>(pthread_getthreadid_np()); ++#elif V8_OS_NETBSD ++ return static_cast<int>(_lwp_self()); + #elif V8_OS_AIX + return static_cast<int>(thread_self()); + #elif V8_OS_FUCHSIA diff --git a/lang/v8-beta/files/patch-src_d8_d8-posix.cc b/lang/v8-beta/files/patch-src_d8_d8-posix.cc new file mode 100644 index 000000000000..e76ba72218e9 --- /dev/null +++ b/lang/v8-beta/files/patch-src_d8_d8-posix.cc @@ -0,0 +1,19 @@ +--- src/d8/d8-posix.cc.orig 2020-06-13 18:02:18 UTC ++++ src/d8/d8-posix.cc +@@ -4,6 +4,8 @@ + + #include <errno.h> + #include <fcntl.h> ++#include <sys/types.h> ++#include <netinet/in.h> + #include <netinet/ip.h> + #include <signal.h> + #include <stdlib.h> +@@ -12,7 +14,6 @@ + #include <sys/socket.h> + #include <sys/stat.h> + #include <sys/time.h> +-#include <sys/types.h> + #include <sys/wait.h> + #include <unistd.h> + diff --git a/lang/v8-beta/files/patch-third__party_zlib_BUILD.gn b/lang/v8-beta/files/patch-third__party_zlib_BUILD.gn new file mode 100644 index 000000000000..39aca73d5377 --- /dev/null +++ b/lang/v8-beta/files/patch-third__party_zlib_BUILD.gn @@ -0,0 +1,11 @@ +--- third_party/zlib/BUILD.gn.orig 2020-11-16 14:31:04 UTC ++++ third_party/zlib/BUILD.gn +@@ -108,6 +108,8 @@ if (use_arm_neon_optimizations) { + defines = [ "CRC32_ARMV8_CRC32" ] + if (is_android) { + defines += [ "ARMV8_OS_ANDROID" ] ++ } else if (is_bsd) { ++ defines += [ "ARMV8_OS_FREEBSD" ] + } else if (is_linux || is_chromeos) { + defines += [ "ARMV8_OS_LINUX" ] + } else if (is_mac) { diff --git a/lang/v8-beta/files/patch-third__party_zlib_cpu__features.c b/lang/v8-beta/files/patch-third__party_zlib_cpu__features.c new file mode 100644 index 000000000000..4b41c0bc2ccb --- /dev/null +++ b/lang/v8-beta/files/patch-third__party_zlib_cpu__features.c @@ -0,0 +1,48 @@ +--- third_party/zlib/cpu_features.c.orig 2020-11-16 14:31:04 UTC ++++ third_party/zlib/cpu_features.c +@@ -31,11 +31,20 @@ int ZLIB_INTERNAL x86_cpu_enable_simd = 0; + + #ifndef CPU_NO_SIMD + +-#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA) ++#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA) || defined(ARMV8_OS_FREEBSD) + #include <pthread.h> + #endif + +-#if defined(ARMV8_OS_ANDROID) ++#if defined(ARMV8_OS_FREEBSD) ++#include <machine/armreg.h> ++#include <sys/types.h> ++#ifndef ID_AA64ISAR0_AES_VAL ++#define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES ++#endif ++#ifndef ID_AA64ISAR0_CRC32_VAL ++#define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32 ++#endif ++#elif defined(ARMV8_OS_ANDROID) + #include <cpu-features.h> + #elif defined(ARMV8_OS_LINUX) + #include <asm/hwcap.h> +@@ -56,7 +65,7 @@ int ZLIB_INTERNAL x86_cpu_enable_simd = 0; + static void _cpu_check_features(void); + #endif + +-#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_MACOS) || defined(ARMV8_OS_FUCHSIA) || defined(X86_NOT_WINDOWS) ++#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_MACOS) || defined(ARMV8_OS_FUCHSIA) || defined(X86_NOT_WINDOWS) || defined(ARMV8_OS_FREEBSD) + #if !defined(ARMV8_OS_MACOS) + // _cpu_check_features() doesn't need to do anything on mac/arm since all + // features are known at build time, so don't call it. +@@ -123,6 +132,13 @@ static void _cpu_check_features(void) + #elif defined(ARMV8_OS_WINDOWS) + arm_cpu_enable_crc32 = IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE); + arm_cpu_enable_pmull = IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE); ++#elif defined(ARMV8_OS_FREEBSD) ++ uint64_t id_aa64isar0; ++ id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1); ++ if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) ++ arm_cpu_enable_pmull = 1; ++ if (ID_AA64ISAR0_CRC32_VAL(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) ++ arm_cpu_enable_crc32 = 1; + #endif + } + #endif diff --git a/lang/v8-beta/files/v8.pc.in b/lang/v8-beta/files/v8.pc.in new file mode 100644 index 000000000000..8d9970831e04 --- /dev/null +++ b/lang/v8-beta/files/v8.pc.in @@ -0,0 +1,11 @@ +prefix=%%PREFIX%% +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: v8 +Description: V8 JavaScript Engine +Version: @VERSION@ +Requires: icu-uc, icu-i18n, v8_libbase = @VERSION@ +Libs: -L${libdir} -lv8 -pthread +Cflags: -I${includedir} diff --git a/lang/v8-beta/files/v8_libbase.pc.in b/lang/v8-beta/files/v8_libbase.pc.in new file mode 100644 index 000000000000..171cd2e2112d --- /dev/null +++ b/lang/v8-beta/files/v8_libbase.pc.in @@ -0,0 +1,10 @@ +prefixr=%%PREFIX%% +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: v8 +Description: V8 JavaScript Engine - Base library +Version: @VERSION@ +Libs: -L${libdir} -lv8_libbase +Cflags: -I${includedir} diff --git a/lang/v8-beta/files/v8_libplatform.pc.in b/lang/v8-beta/files/v8_libplatform.pc.in new file mode 100644 index 000000000000..43708a89a9bd --- /dev/null +++ b/lang/v8-beta/files/v8_libplatform.pc.in @@ -0,0 +1,10 @@ +prefix=%%PREFIX%% +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: v8 +Description: V8 JavaScript Engine - Platform library +Version: @VERSION@ +Libs: -L${libdir} -lv8_libplatform -pthread +Cflags: -I${includedir} |