From cf98d5939b6f59a3a2ace9396c51e692df26aa7f Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 3 Sep 2022 00:40:00 +0200 Subject: [PATCH] Added V8 vcpkg files --- cmake/ports/hifi-deps/CONTROL | 2 +- cmake/ports/v8/CONTROL | 3 + cmake/ports/v8/V8Config-shared.cmake | 111 ++++++++++++ cmake/ports/v8/V8Config-static.cmake | 98 +++++++++++ cmake/ports/v8/build.patch | 187 +++++++++++++++++++++ cmake/ports/v8/icu.gn | 71 ++++++++ cmake/ports/v8/portfile.cmake | 198 ++++++++++++++++++++++ cmake/ports/v8/v8.patch | 241 +++++++++++++++++++++++++++ cmake/ports/v8/v8.pc.in | 11 ++ cmake/ports/v8/v8_libbase.pc.in | 10 ++ cmake/ports/v8/v8_libplatform.pc.in | 10 ++ cmake/ports/v8/v8_monolith.pc.in | 11 ++ cmake/ports/v8/vcpkg.json | 25 +++ cmake/ports/v8/zlib.gn | 21 +++ 14 files changed, 998 insertions(+), 1 deletion(-) create mode 100644 cmake/ports/v8/CONTROL create mode 100644 cmake/ports/v8/V8Config-shared.cmake create mode 100644 cmake/ports/v8/V8Config-static.cmake create mode 100644 cmake/ports/v8/build.patch create mode 100644 cmake/ports/v8/icu.gn create mode 100644 cmake/ports/v8/portfile.cmake create mode 100644 cmake/ports/v8/v8.patch create mode 100644 cmake/ports/v8/v8.pc.in create mode 100644 cmake/ports/v8/v8_libbase.pc.in create mode 100644 cmake/ports/v8/v8_libplatform.pc.in create mode 100644 cmake/ports/v8/v8_monolith.pc.in create mode 100644 cmake/ports/v8/vcpkg.json create mode 100644 cmake/ports/v8/zlib.gn diff --git a/cmake/ports/hifi-deps/CONTROL b/cmake/ports/hifi-deps/CONTROL index 1fed0476c0..29290f78f4 100644 --- a/cmake/ports/hifi-deps/CONTROL +++ b/cmake/ports/hifi-deps/CONTROL @@ -1,4 +1,4 @@ Source: hifi-deps Version: 0.1.5-github-actions Description: Collected dependencies for High Fidelity applications -Build-Depends: bullet3, draco, etc2comp, glad, glm, nvtt, openexr (!android), openssl (windows), opus, polyvox, tbb (!android), vhacd, webrtc (!android|!(linux&arm)), zlib +Build-Depends: bullet3, draco, etc2comp, glad, glm, nvtt, openexr (!android), openssl (windows), opus, polyvox, tbb (!android), v8, vhacd, webrtc (!android|!(linux&arm)), zlib diff --git a/cmake/ports/v8/CONTROL b/cmake/ports/v8/CONTROL new file mode 100644 index 0000000000..a7ed4dc1c2 --- /dev/null +++ b/cmake/ports/v8/CONTROL @@ -0,0 +1,3 @@ +Source: v8 +Version: 7d3d62c91f69a702e5aa54c6b4dbbaa883683717 +Description: V8 JavaScript engine \ No newline at end of file diff --git a/cmake/ports/v8/V8Config-shared.cmake b/cmake/ports/v8/V8Config-shared.cmake new file mode 100644 index 0000000000..1780e9343f --- /dev/null +++ b/cmake/ports/v8/V8Config-shared.cmake @@ -0,0 +1,111 @@ +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +include(SelectLibraryConfigurations) + +find_path(V8_INCLUDE_DIR NAMES v8.h PATH_SUFFIXES include) + +if(EXISTS ${_IMPORT_PREFIX}/bin/snapshot_blob.bin) + set(V8_SNAPSHOT_BLOB_RELEASE ${_IMPORT_PREFIX}/bin/snapshot_blob.bin CACHE FILEPATH "Release version of V8 snapshot blob location") +endif() +if(EXISTS ${_IMPORT_PREFIX}/debug/bin/snapshot_blob.bin) + set(V8_SNAPSHOT_BLOB_DEBUG ${_IMPORT_PREFIX}/debug/bin/snapshot_blob.bin CACHE FILEPATH "Debug version of V8 snapshot blob location") +endif() +set(V8_SNAPSHOT_BLOB "$,${V8_SNAPSHOT_BLOB_DEBUG},${V8_SNAPSHOT_BLOB_RELEASE}>") + +if(EXISTS "${_IMPORT_PREFIX}/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8_LIBRARY_RELEASE "${_IMPORT_PREFIX}/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Release version of the V8 library location") +endif() +if(EXISTS "${_IMPORT_PREFIX}/debug/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8_LIBRARY_DEBUG "${_IMPORT_PREFIX}/debug/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Debug version of the V8 library location") +endif() +select_library_configurations(V8) + +if(EXISTS "${_IMPORT_PREFIX}/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8LIBBASE_LIBRARY_RELEASE "${_IMPORT_PREFIX}/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Release version of the V8 libbase library location") +endif() +if(EXISTS "${_IMPORT_PREFIX}/debug/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8LIBBASE_LIBRARY_DEBUG "${_IMPORT_PREFIX}/debug/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Debug version of the V8 libbase library location") +endif() +select_library_configurations(V8LIBBASE) + +if(EXISTS "${_IMPORT_PREFIX}/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8LIBPLATFORM_LIBRARY_RELEASE "${_IMPORT_PREFIX}/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Release version of the V8 libplatform library location") +endif() +if(EXISTS "${_IMPORT_PREFIX}/debug/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8LIBPLATFORM_LIBRARY_DEBUG "${_IMPORT_PREFIX}/debug/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Delete version of the V8 libplatform library location") +endif() +select_library_configurations(V8LIBPLATFORM) + +mark_as_advanced(V8_INCLUDE_DIR) + +if(V8_INCLUDE_DIR AND EXISTS "${V8_INCLUDE_DIR}/v8-version.h") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_MAJOR_VERSION REGEX "^#define V8_MAJOR_VERSION [0-9]+.*$") + string(REGEX REPLACE "^#define V8_MAJOR_VERSION ([0-9]+).*$" "\\1" V8_MAJOR_VERSION "${V8_MAJOR_VERSION}") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_MINOR_VERSION REGEX "^#define V8_MINOR_VERSION [0-9]+.*$") + string(REGEX REPLACE "^#define V8_MINOR_VERSION ([0-9]+).*$" "\\1" V8_MINOR_VERSION "${V8_MINOR_VERSION}") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_BUILD_NUMBER REGEX "^#define V8_BUILD_NUMBER [0-9]+.*$") + string(REGEX REPLACE "^#define V8_BUILD_NUMBER ([0-9]+).*$" "\\1" V8_BUILD_NUMBER "${V8_BUILD_NUMBER}") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_PATCH_LEVEL REGEX "^#define V8_PATCH_LEVEL [0-9]+.*$") + string(REGEX REPLACE "^#define V8_PATCH_LEVEL ([0-9]+).*$" "\\1" V8_PATCH_LEVEL "${V8_PATCH_LEVEL}") + set(V8_VERSION_STRING "${V8_MAJOR_VERSION}.${V8_MINOR_VERSION}.${V8_BUILD_NUMBER}.${V8_PATCH_LEVEL}") +endif() + + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(V8_COMPILE_DEFINITIONS "V8_COMPRESS_POINTERS;V8_31BIT_SMIS_ON_64BIT_ARCH") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(V8_COMPILE_DEFINITIONS " ") +endif() + +mark_as_advanced(V8_COMPILE_DEFINITIONS) + +include(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(V8 REQUIRED_VARS V8_LIBRARY V8LIBBASE_LIBRARY V8LIBPLATFORM_LIBRARY V8_INCLUDE_DIR V8_COMPILE_DEFINITIONS +VERSION_VAR V8_VERSION_STRING) +set(V8_LIBRARIES ${V8_LIBRARY} ${V8LIBBASE_LIBRARY} ${V8LIBPLATFORM_LIBRARY}) + +mark_as_advanced(V8_LIBRARIES) + +if(NOT TARGET V8::V8) + add_library(V8::V8 SHARED IMPORTED) + set_target_properties(V8::V8 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${V8_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS "${V8_COMPILE_DEFINITIONS}") + + if(V8_LIBRARY_RELEASE) + set_property(TARGET V8::V8 APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(V8::V8 PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB_RELEASE "${V8_LIBRARY_RELEASE}" + ) + set_target_properties(V8::V8 PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE + "${V8LIBBASE_LIBRARY_RELEASE};${V8LIBPLATFORM_LIBRARY_RELEASE}") + endif() + + if(V8_LIBRARY_DEBUG) + set_property(TARGET V8::V8 APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(V8::V8 PROPERTIES + IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/debug/bin/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB_DEBUG "${V8_LIBRARY_DEBUG}") + set_target_properties(V8::V8 PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG + "${V8LIBBASE_LIBRARY_DEBUG};${V8LIBPLATFORM_LIBRARY_DEBUG}") + endif() + + if(NOT V8_LIBRARY_RELEASE AND NOT V8_LIBRARY_DEBUG) + set_property(TARGET V8::V8 APPEND PROPERTY + IMPORTED_IMPLIB "${V8_LIBRARY}") + set_target_properties(V8::V8 PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES + "${V8LIBBASE_LIBRARY};${V8LIBPLATFORM_LIBRARY}") + endif() +endif() diff --git a/cmake/ports/v8/V8Config-static.cmake b/cmake/ports/v8/V8Config-static.cmake new file mode 100644 index 0000000000..a03da8b2ee --- /dev/null +++ b/cmake/ports/v8/V8Config-static.cmake @@ -0,0 +1,98 @@ +include(CMakeFindDependencyMacro) +find_dependency(ICU REQUIRED COMPONENTS in uc dt) +find_dependency(ZLIB REQUIRED) +if(UNIX) + find_package(PkgConfig REQUIRED) + pkg_check_modules(GLIB2 glib-2.0 gobject-2.0 gmodule-2.0 gio-2.0 IMPORTED_TARGET) + set(V8_IMPORTED_LINK_INTERFACE_LIBRARIES + "ICU::in;ICU::uc;ICU::dt;ZLIB::ZLIB") +elseif(WIN32) + set(V8_IMPORTED_LINK_INTERFACE_LIBRARIES + "Winmm;DbgHelp;ZLIB::ZLIB;ICU::in;ICU::uc;ICU::dt") +endif() + +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +include(SelectLibraryConfigurations) + +find_path(V8_INCLUDE_DIR NAMES v8.h PATH_SUFFIXES include) + +if(EXISTS "${_IMPORT_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}v8_monolith${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8_LIBRARY_RELEASE "${_IMPORT_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}v8_monolith${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Release version of the V8 library location") +endif() +if(EXISTS "${_IMPORT_PREFIX}/debug/lib/${CMAKE_STATIC_LIBRARY_PREFIX}v8_monolith${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(V8_LIBRARY_DEBUG "${_IMPORT_PREFIX}/debug/lib/${CMAKE_STATIC_LIBRARY_PREFIX}v8_monolith${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Debug version of the V8 library location") +endif() +select_library_configurations(V8) + +mark_as_advanced(V8_INCLUDE_DIR) + +if(V8_INCLUDE_DIR AND EXISTS "${V8_INCLUDE_DIR}/v8-version.h") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_MAJOR_VERSION REGEX "^#define V8_MAJOR_VERSION [0-9]+.*$") + string(REGEX REPLACE "^#define V8_MAJOR_VERSION ([0-9]+).*$" "\\1" V8_MAJOR_VERSION "${V8_MAJOR_VERSION}") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_MINOR_VERSION REGEX "^#define V8_MINOR_VERSION [0-9]+.*$") + string(REGEX REPLACE "^#define V8_MINOR_VERSION ([0-9]+).*$" "\\1" V8_MINOR_VERSION "${V8_MINOR_VERSION}") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_BUILD_NUMBER REGEX "^#define V8_BUILD_NUMBER [0-9]+.*$") + string(REGEX REPLACE "^#define V8_BUILD_NUMBER ([0-9]+).*$" "\\1" V8_BUILD_NUMBER "${V8_BUILD_NUMBER}") + file(STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_PATCH_LEVEL REGEX "^#define V8_PATCH_LEVEL [0-9]+.*$") + string(REGEX REPLACE "^#define V8_PATCH_LEVEL ([0-9]+).*$" "\\1" V8_PATCH_LEVEL "${V8_PATCH_LEVEL}") + set(V8_VERSION_STRING "${V8_MAJOR_VERSION}.${V8_MINOR_VERSION}.${V8_BUILD_NUMBER}.${V8_PATCH_LEVEL}") +endif() + + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(V8_COMPILE_DEFINITIONS "V8_COMPRESS_POINTERS;V8_31BIT_SMIS_ON_64BIT_ARCH") +else() + set(V8_COMPILE_DEFINITIONS " ") +endif() + +mark_as_advanced(V8_COMPILE_DEFINITIONS) + +include(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(V8 REQUIRED_VARS V8_LIBRARY V8_INCLUDE_DIR V8_COMPILE_DEFINITIONS +VERSION_VAR V8_VERSION_STRING) +set(V8_LIBRARIES ${V8_LIBRARY}) + +mark_as_advanced(V8_LIBRARIES) + +if(NOT TARGET V8::V8) + add_library(V8::V8 STATIC IMPORTED) + set_target_properties(V8::V8 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${V8_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS "${V8_COMPILE_DEFINITIONS}") + if(MSVC) + set_target_properties(V8::V8 PROPERTIES + INTERFACE_COMPILE_OPTIONS "/MT$<$:d>") + endif() + + if(V8_LIBRARY_RELEASE) + set_property(TARGET V8::V8 APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(V8::V8 PROPERTIES + IMPORTED_LOCATION_RELEASE "${V8_LIBRARY_RELEASE}" + IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE + "${V8_IMPORTED_LINK_INTERFACE_LIBRARIES}") + endif() + + if(V8_LIBRARY_DEBUG) + set_property(TARGET V8::V8 APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(V8::V8 PROPERTIES + IMPORTED_LOCATION_DEBUG "${V8_LIBRARY_DEBUG}" + IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG + "${V8_IMPORTED_LINK_INTERFACE_LIBRARIES}") + endif() + + if(NOT V8_LIBRARY_RELEASE AND NOT V8_LIBRARY_DEBUG) + set_property(TARGET V8::V8 APPEND PROPERTY + IMPORTED_LOCATION "${V8_LIBRARY}" + IMPORTED_LINK_INTERFACE_LIBRARIES + "${V8_IMPORTED_LINK_INTERFACE_LIBRARIES}") + endif() +endif() diff --git a/cmake/ports/v8/build.patch b/cmake/ports/v8/build.patch new file mode 100644 index 0000000000..15fede3fe8 --- /dev/null +++ b/cmake/ports/v8/build.patch @@ -0,0 +1,187 @@ +diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn +index 1904a2559..e66586c88 100644 +--- a/config/compiler/BUILD.gn ++++ b/config/compiler/BUILD.gn +@@ -1571,6 +1571,7 @@ config("default_warnings") { + # Disables. + "-Wno-missing-field-initializers", # "struct foo f = {0};" + "-Wno-unused-parameter", # Unused function parameters. ++ "-Wno-invalid-offsetof", # Use of "conditionally-supported" offsetof in c++17 + ] + } + +@@ -1987,8 +1988,17 @@ config("no_incompatible_pointer_warnings") { + # Shared settings for both "optimize" and "optimize_max" configs. + # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags. + if (is_win) { +- common_optimize_on_cflags = [ +- "/Ob2", # Both explicit and auto inlining. ++ common_optimize_on_cflags = [] ++ if(is_clang) { ++ common_optimize_on_cflags += [ ++ "/Ob2", # Both explicit and auto inlining. ++ ] ++ } else { ++ common_optimize_on_cflags += [ ++ "/Ob3", # Both explicit and auto inlining. ++ ] ++ } ++ common_optimize_on_cflags += [ + "/Oy-", # Disable omitting frame pointers, must be after /O2. + "/Zc:inline", # Remove unreferenced COMDAT (faster links). + ] +diff --git a/config/linux/pkg-config.py b/config/linux/pkg-config.py +index 5adf70cc3..dab159f98 100755 +--- a/config/linux/pkg-config.py ++++ b/config/linux/pkg-config.py +@@ -41,6 +41,11 @@ from optparse import OptionParser + # Additionally, you can specify the option --atleast-version. This will skip + # the normal outputting of a dictionary and instead print true or false, + # depending on the return value of pkg-config for the given package. ++# ++# --pkg_config_libdir= allows direct override ++# of the PKG_CONFIG_LIBDIR environment library. ++# ++# --full-path-libs causes lib names to include their full path. + + + def SetConfigPath(options): +@@ -105,11 +110,32 @@ def RewritePath(path, strip_prefix, sysroot): + return path + + ++flag_regex = re.compile("(-.)(.+)") ++ ++ ++def FlagReplace(matchobj): ++ if matchobj.group(1) == '-I': ++ return matchobj.group(1) + subprocess.check_output([u'cygpath',u'-w',matchobj.group(2)]).strip().decode("utf-8") ++ if matchobj.group(1) == '-L': ++ return matchobj.group(1) + subprocess.check_output([u'cygpath',u'-w',matchobj.group(2)]).strip().decode("utf-8") ++ if matchobj.group(1) == '-l': ++ return matchobj.group(1) + matchobj.group(2) + '.lib' ++ return matchobj.group(0) ++ ++ ++def ConvertGCCToMSVC(flags): ++ """Rewrites GCC flags into MSVC flags.""" ++ # need a better way to determine mingw vs msvc build ++ if 'win32' not in sys.platform or "GCC" in sys.version: ++ return flags ++ return [ flag_regex.sub(FlagReplace,flag) for flag in flags] ++ ++ + 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 "linux" not in sys.platform and 'win32' not in sys.platform: + print("[[],[],[],[],[]]") + return 0 + +@@ -128,6 +154,9 @@ def main(): + parser.add_option('--dridriverdir', action='store_true', dest='dridriverdir') + parser.add_option('--version-as-components', action='store_true', + dest='version_as_components') ++ parser.add_option('--pkg_config_libdir', action='store', dest='pkg_config_libdir', ++ type='string') ++ parser.add_option('--full-path-libs', action='store_true', dest='full_path_libs') + (options, args) = parser.parse_args() + + # Make a list of regular expressions to strip out. +@@ -144,6 +173,10 @@ def main(): + else: + prefix = '' + ++ # Override PKG_CONFIG_LIBDIR ++ if options.pkg_config_libdir: ++ os.environ['PKG_CONFIG_LIBDIR'] = options.pkg_config_libdir ++ + if options.atleast_version: + # When asking for the return value, just run pkg-config and print the return + # value, no need to do other work. +@@ -203,7 +236,7 @@ def main(): + # For now just split on spaces to get the args out. This will break if + # pkgconfig returns quoted things with spaces in them, but that doesn't seem + # to happen in practice. +- all_flags = flag_string.strip().split(' ') ++ all_flags = ConvertGCCToMSVC(flag_string.strip().split(' ')) + + + sysroot = options.sysroot +@@ -220,7 +253,10 @@ def main(): + continue; + + if flag[:2] == '-l': +- libs.append(RewritePath(flag[2:], prefix, sysroot)) ++ library = RewritePath(flag[2:], prefix, sysroot) ++ # Skip math library on MSVC ++ if library != 'm.lib': ++ libs.append(library) + elif flag[:2] == '-L': + lib_dirs.append(RewritePath(flag[2:], prefix, sysroot)) + elif flag[:2] == '-I': +@@ -237,6 +273,14 @@ def main(): + else: + cflags.append(flag) + ++ if options.full_path_libs: ++ full_path_libs = [] ++ for lib_dir in lib_dirs: ++ for lib in libs: ++ if os.path.isfile(lib_dir+"/"+lib): ++ full_path_libs.append(lib_dir+"/"+lib) ++ libs = full_path_libs ++ + # Output a GN array, the first one is the cflags, the second are the libs. The + # JSON formatter prints GN compatible lists when everything is a list of + # strings. +diff --git a/config/linux/pkg_config.gni b/config/linux/pkg_config.gni +index 428e44ac0..a0d2175ee 100644 +--- a/config/linux/pkg_config.gni ++++ b/config/linux/pkg_config.gni +@@ -45,6 +45,9 @@ declare_args() { + # in similar fashion by setting the `system_libdir` variable in the build's + # args.gn file to 'lib' or 'lib64' as appropriate for the target architecture. + system_libdir = "lib" ++ ++ # Allow directly overriding the PKG_CONFIG_LIBDIR enviroment variable ++ pkg_config_libdir = "" + } + + pkg_config_script = "//build/config/linux/pkg-config.py" +@@ -87,6 +90,17 @@ if (host_pkg_config != "") { + host_pkg_config_args = pkg_config_args + } + ++if (pkg_config_libdir != "") { ++ pkg_config_args += [ ++ "--pkg_config_libdir", ++ pkg_config_libdir, ++ ] ++ host_pkg_config_args += [ ++ "--pkg_config_libdir", ++ pkg_config_libdir, ++ ] ++} ++ + template("pkg_config") { + assert(defined(invoker.packages), + "Variable |packages| must be defined to be a list in pkg_config.") +diff --git a/util/lastchange.py b/util/lastchange.py +index 02a36642b..78934f1b0 100755 +--- a/util/lastchange.py ++++ b/util/lastchange.py +@@ -192,7 +192,10 @@ def GetGitTopDirectory(source_dir): + Returns: + The output of "git rev-parse --show-toplevel" as a string + """ +- return _RunGitCommand(source_dir, ['rev-parse', '--show-toplevel']) ++ directory = _RunGitCommand(source_dir, ['rev-parse', '--show-toplevel']) ++ if "GCC" in sys.version and sys.platform=='win32': ++ return subprocess.check_output(["cygpath", "-w", directory]).strip(b"\n").decode() ++ return directory + + + def WriteIfChanged(file_name, contents): diff --git a/cmake/ports/v8/icu.gn b/cmake/ports/v8/icu.gn new file mode 100644 index 0000000000..60dc6b8b7a --- /dev/null +++ b/cmake/ports/v8/icu.gn @@ -0,0 +1,71 @@ +import("//build/config/linux/pkg_config.gni") + +declare_args() { + # Tells icu to load an external data file rather than rely on the icudata + # being linked directly into the binary. + icu_use_data_file = true + # If true, compile icu into a standalone static library. Currently this is + # only useful on Chrome OS. + icu_disable_thin_archive = false +} + +pkg_config("system_icui18n") { + packages = [ "icu-i18n" ] + if (is_win) { + extra_args = ["--full-path-libs"] # Workaround the WinSDK having an older version of ICU + } +} + +pkg_config("system_icuuc") { + packages = [ "icu-uc" ] + if (is_win) { + extra_args = ["--full-path-libs"] # Workaround the WinSDK having an older version of ICU + } +} + +group("icu") { + public_deps = [ + ":icui18n", + ":icuuc", + ] +} + +config("icu_config") { + defines = [ + "USING_SYSTEM_ICU=1", + ] + if(is_win){ + if(!is_component_build) { + ldflags = ["/ignore:4099"] # needed on CI builds + } + defines += [ "UCHAR_TYPE=wchar_t" ] + } + else{ + defines += [ "UCHAR_TYPE=uint16_t" ] + } + if (icu_use_data_file) { + defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE" ] + } else { + defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC" ] + } +} + +source_set("icui18n") { + public_configs = [ + ":icu_config", + ":system_icui18n" + ] +} + +source_set("icuuc") { + public_configs = [ + ":icu_config", + ":system_icuuc" + ] +} + +source_set("icudata") { + public_configs = [ + ":icu_config", + ] +} diff --git a/cmake/ports/v8/portfile.cmake b/cmake/ports/v8/portfile.cmake new file mode 100644 index 0000000000..bec0c2366d --- /dev/null +++ b/cmake/ports/v8/portfile.cmake @@ -0,0 +1,198 @@ + +set(pkgver "9.1.269.39") + +set(ENV{DEPOT_TOOLS_WIN_TOOLCHAIN} 0) + +get_filename_component(GIT_PATH ${GIT} DIRECTORY) +vcpkg_find_acquire_program(PYTHON2) +get_filename_component(PYTHON2_PATH ${PYTHON2} DIRECTORY) +vcpkg_find_acquire_program(GN) +get_filename_component(GN_PATH ${GN} DIRECTORY) +vcpkg_find_acquire_program(NINJA) +get_filename_component(NINJA_PATH ${NINJA} DIRECTORY) + +vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin") +vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin") +vcpkg_add_to_path(PREPEND "${GIT_PATH}") +vcpkg_add_to_path(PREPEND "${PYTHON2_PATH}") +vcpkg_add_to_path(PREPEND "${GN_PATH}") +vcpkg_add_to_path(PREPEND "${NINJA_PATH}") +if(WIN32) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES pkg-config) + vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") +endif() + +set(VCPKG_KEEP_ENV_VARS PATH;DEPOT_TOOLS_WIN_TOOLCHAIN) + +function(v8_fetch) + set(oneValueArgs DESTINATION URL REF SOURCE) + set(multipleValuesArgs PATCHES) + cmake_parse_arguments(V8 "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN}) + + if(NOT DEFINED V8_DESTINATION) + message(FATAL_ERROR "DESTINATION must be specified.") + endif() + + if(NOT DEFINED V8_URL) + message(FATAL_ERROR "The git url must be specified") + endif() + + if(NOT DEFINED V8_REF) + message(FATAL_ERROR "The git ref must be specified.") + endif() + + if(EXISTS ${V8_SOURCE}/${V8_DESTINATION}) + vcpkg_execute_required_process( + COMMAND ${GIT} reset --hard + WORKING_DIRECTORY ${V8_SOURCE}/${V8_DESTINATION} + LOGNAME build-${TARGET_TRIPLET}) + else() + vcpkg_execute_required_process( + COMMAND ${GIT} clone --depth 1 ${V8_URL} ${V8_DESTINATION} + WORKING_DIRECTORY ${V8_SOURCE} + LOGNAME build-${TARGET_TRIPLET}) + vcpkg_execute_required_process( + COMMAND ${GIT} fetch --depth 1 origin ${V8_REF} + WORKING_DIRECTORY ${V8_SOURCE}/${V8_DESTINATION} + LOGNAME build-${TARGET_TRIPLET}) + vcpkg_execute_required_process( + COMMAND ${GIT} checkout FETCH_HEAD + WORKING_DIRECTORY ${V8_SOURCE}/${V8_DESTINATION} + LOGNAME build-${TARGET_TRIPLET}) + endif() + foreach(PATCH ${V8_PATCHES}) + vcpkg_execute_required_process( + COMMAND ${GIT} apply ${PATCH} + WORKING_DIRECTORY ${V8_SOURCE}/${V8_DESTINATION} + LOGNAME build-${TARGET_TRIPLET}) + endforeach() +endfunction() + +vcpkg_from_git( + OUT_SOURCE_PATH SOURCE_PATH + URL https://chromium.googlesource.com/v8/v8.git + REF 7d3d62c91f69a702e5aa54c6b4dbbaa883683717 + PATCHES ${CURRENT_PORT_DIR}/v8.patch +) + +message(STATUS "Fetching submodules") +v8_fetch( + DESTINATION build + URL https://chromium.googlesource.com/chromium/src/build.git + REF fd86d60f33cbc794537c4da2ef7e298d7f81138e + SOURCE ${SOURCE_PATH} + PATCHES ${CURRENT_PORT_DIR}/build.patch) +v8_fetch( + DESTINATION third_party/zlib + URL https://chromium.googlesource.com/chromium/src/third_party/zlib.git + REF 156be8c52f80cde343088b4a69a80579101b6e67 + SOURCE ${SOURCE_PATH}) +v8_fetch( + DESTINATION base/trace_event/common + URL https://chromium.googlesource.com/chromium/src/base/trace_event/common.git + REF dab187b372fc17e51f5b9fad8201813d0aed5129 + SOURCE ${SOURCE_PATH}) +v8_fetch( + DESTINATION third_party/googletest/src + URL https://chromium.googlesource.com/external/github.com/google/googletest.git + REF 10b1902d893ea8cc43c69541d70868f91af3646b + SOURCE ${SOURCE_PATH}) +v8_fetch( + DESTINATION third_party/jinja2 + URL https://chromium.googlesource.com/chromium/src/third_party/jinja2.git + REF b41863e42637544c2941b574c7877d3e1f663e25 + SOURCE ${SOURCE_PATH}) +v8_fetch( + DESTINATION third_party/markupsafe + URL https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git + REF 8f45f5cfa0009d2a70589bcda0349b8cb2b72783 + SOURCE ${SOURCE_PATH}) + +vcpkg_execute_required_process( + COMMAND ${PYTHON2} build/util/lastchange.py -o build/util/LASTCHANGE + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME build-${TARGET_TRIPLET} +) + +file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party/icu") +configure_file("${CURRENT_PORT_DIR}/zlib.gn" "${SOURCE_PATH}/third_party/zlib/BUILD.gn" COPYONLY) +configure_file("${CURRENT_PORT_DIR}/icu.gn" "${SOURCE_PATH}/third_party/icu/BUILD.gn" COPYONLY) +file(WRITE "${SOURCE_PATH}/build/config/gclient_args.gni" "checkout_google_benchmark = false\n") +if(WIN32) + string(REGEX REPLACE "\\\\+$" "" WindowsSdkDir $ENV{WindowsSdkDir}) + file(APPEND "${SOURCE_PATH}/build/config/gclient_args.gni" "windows_sdk_path = \"${WindowsSdkDir}\"\n") +endif() + +if(UNIX) + set(UNIX_CURRENT_INSTALLED_DIR ${CURRENT_INSTALLED_DIR}) + set(LIBS "-ldl -lpthread") + set(REQUIRES ", gmodule-2.0, gobject-2.0, gthread-2.0") +elseif(WIN32) + execute_process(COMMAND cygpath "${CURRENT_INSTALLED_DIR}" OUTPUT_VARIABLE UNIX_CURRENT_INSTALLED_DIR) + string(STRIP ${UNIX_CURRENT_INSTALLED_DIR} UNIX_CURRENT_INSTALLED_DIR) + set(LIBS "-lWinmm -lDbgHelp") +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(is_component_build true) + set(v8_monolithic false) + set(v8_use_external_startup_data true) + set(targets :v8_libbase :v8_libplatform :v8) +else() + set(is_component_build false) + set(v8_monolithic true) + set(v8_use_external_startup_data false) + set(targets :v8_monolith) +endif() + +message(STATUS "Generating v8 build files. Please wait...") + +vcpkg_configure_gn( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS "is_component_build=${is_component_build} target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\" v8_monolithic=${v8_monolithic} v8_use_external_startup_data=${v8_use_external_startup_data} use_sysroot=false is_clang=false use_custom_libcxx=false v8_enable_verify_heap=false icu_use_data_file=false" + OPTIONS_DEBUG "is_debug=true enable_iterator_debugging=true pkg_config_libdir=\"${UNIX_CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig\"" + OPTIONS_RELEASE "is_debug=false enable_iterator_debugging=false pkg_config_libdir=\"${UNIX_CURRENT_INSTALLED_DIR}/lib/pkgconfig\"" +) + +message(STATUS "Building v8. Please wait...") + +vcpkg_install_gn( + SOURCE_PATH "${SOURCE_PATH}" + TARGETS ${targets} +) + +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(CFLAGS "-DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH") +endif() + +file(INSTALL "${SOURCE_PATH}/include" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN "*.h") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(PREFIX ${CURRENT_PACKAGES_DIR}) + configure_file("${CURRENT_PORT_DIR}/v8.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/v8.pc" @ONLY) + configure_file("${CURRENT_PORT_DIR}/v8_libbase.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/v8_libbase.pc" @ONLY) + configure_file("${CURRENT_PORT_DIR}/v8_libplatform.pc.in" "{CURRENT_PACKAGES_DIR}/lib/pkgconfig/v8_libplatform.pc" @ONLY) + file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/snapshot_blob.bin" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") + + set(PREFIX ${CURRENT_PACKAGES_DIR}/debug) + configure_file("${CURRENT_PORT_DIR}/v8.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/v8.pc" @ONLY) + configure_file("${CURRENT_PORT_DIR}/v8_libbase.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/v8_libbase.pc" @ONLY) + configure_file("${CURRENT_PORT_DIR}/v8_libplatform.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/v8_libplatform.pc" @ONLY) + configure_file("${CURRENT_PORT_DIR}/V8Config-shared.cmake" "${CURRENT_PACKAGES_DIR}/share/v8/V8Config.cmake" @ONLY) + file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/snapshot_blob.bin" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") +else() + set(PREFIX ${CURRENT_PACKAGES_DIR}) + configure_file("${CURRENT_PORT_DIR}/v8_monolith.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/v8_monolith.pc" @ONLY) + set(PREFIX ${CURRENT_PACKAGES_DIR}/debug) + configure_file("${CURRENT_PORT_DIR}/v8_monolith.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/v8_monolith.pc" @ONLY) + configure_file("${CURRENT_PORT_DIR}/V8Config-static.cmake" "${CURRENT_PACKAGES_DIR}/share/v8/V8Config.cmake" @ONLY) +endif() + + +vcpkg_copy_pdbs() + +# v8 libraries are listed as SYSTEM_LIBRARIES because the pc files reference each other. +vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m dl pthread Winmm DbgHelp v8_libbase v8_libplatform v8) + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/cmake/ports/v8/v8.patch b/cmake/ports/v8/v8.patch new file mode 100644 index 0000000000..7b41c8d3e6 --- /dev/null +++ b/cmake/ports/v8/v8.patch @@ -0,0 +1,241 @@ +diff --git a/BUILD.gn b/BUILD.gn +index d2bfb6129d..c5ab18ee44 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -5366,6 +5366,7 @@ if (is_component_build) { + + public_deps = [ + ":v8_base", ++ ":v8_initializers", + ":v8_snapshot", + ] + +diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h +index 72b8fbc8a8..3ebfc23f1f 100644 +--- a/src/codegen/code-stub-assembler.h ++++ b/src/codegen/code-stub-assembler.h +@@ -303,7 +303,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; + // it's possible to add JavaScript-specific useful CodeAssembler "macros" + // without modifying files in the compiler directory (and requiring a review + // from a compiler directory OWNER). +-class V8_EXPORT_PRIVATE CodeStubAssembler ++class V8_EXPORT CodeStubAssembler + : public compiler::CodeAssembler, + public TorqueGeneratedExportedMacrosAssembler { + public: +diff --git a/src/common/globals.h b/src/common/globals.h +index f51c3210f8..5291285337 100644 +--- a/src/common/globals.h ++++ b/src/common/globals.h +@@ -1364,7 +1364,7 @@ class BinaryOperationFeedback { + // This is distinct from BinaryOperationFeedback on purpose, because the + // feedback that matters differs greatly as well as the way it is consumed. + class CompareOperationFeedback { +- enum { ++ enum : uint32_t { + kSignedSmallFlag = 1 << 0, + kOtherNumberFlag = 1 << 1, + kBooleanFlag = 1 << 2, +@@ -1378,7 +1378,7 @@ class CompareOperationFeedback { + }; + + public: +- enum Type { ++ enum Type : uint32_t { + kNone = 0, + + kBoolean = kBooleanFlag, +diff --git a/src/compiler/node-cache.h b/src/compiler/node-cache.h +index 8e1d3d4eae..c55d8329de 100644 +--- a/src/compiler/node-cache.h ++++ b/src/compiler/node-cache.h +@@ -29,7 +29,7 @@ class Node; + // nodes such as constants, parameters, etc. + template , + typename Pred = std::equal_to > +-class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) NodeCache final { ++class V8_EXPORT_PRIVATE NodeCache final { + public: + explicit NodeCache(Zone* zone) : map_(zone) {} + ~NodeCache() = default; +diff --git a/src/heap/paged-spaces-inl.h b/src/heap/paged-spaces-inl.h +index e135e30efc..0c055247bc 100644 +--- a/src/heap/paged-spaces-inl.h ++++ b/src/heap/paged-spaces-inl.h +@@ -19,7 +19,7 @@ namespace internal { + // ----------------------------------------------------------------------------- + // PagedSpaceObjectIterator + +-HeapObject PagedSpaceObjectIterator::Next() { ++inline HeapObject PagedSpaceObjectIterator::Next() { + do { + HeapObject next_obj = FromCurrentPage(); + if (!next_obj.is_null()) return next_obj; +diff --git a/src/heap/paged-spaces.h b/src/heap/paged-spaces.h +index 621d92aa89..a8592a5b4d 100644 +--- a/src/heap/paged-spaces.h ++++ b/src/heap/paged-spaces.h +@@ -45,7 +45,7 @@ class V8_EXPORT_PRIVATE PagedSpaceObjectIterator : public ObjectIterator { + // Advance to the next object, skipping free spaces and other fillers and + // skipping the special garbage section of which there is one per space. + // Returns nullptr when the iteration has ended. +- inline HeapObject Next() override; ++ HeapObject Next() override; + + private: + // Fast (inlined) path of next(). +diff --git a/src/objects/feedback-vector.cc b/src/objects/feedback-vector.cc +index a77ea5d265..0cddb92a02 100644 +--- a/src/objects/feedback-vector.cc ++++ b/src/objects/feedback-vector.cc +@@ -114,9 +114,9 @@ Handle FeedbackMetadata::New(LocalIsolate* isolate, + return metadata; + } + +-template Handle FeedbackMetadata::New( ++template V8_EXPORT Handle FeedbackMetadata::New( + Isolate* isolate, const FeedbackVectorSpec* spec); +-template Handle FeedbackMetadata::New( ++template V8_EXPORT Handle FeedbackMetadata::New( + LocalIsolate* isolate, const FeedbackVectorSpec* spec); + + bool FeedbackMetadata::SpecDiffersFrom( +diff --git a/src/objects/fixed-array-inl.h b/src/objects/fixed-array-inl.h +index cca6d40070..d6d36ff59f 100644 +--- a/src/objects/fixed-array-inl.h ++++ b/src/objects/fixed-array-inl.h +@@ -88,7 +88,7 @@ bool FixedArray::is_the_hole(Isolate* isolate, int index) { + return get(isolate, index).IsTheHole(isolate); + } + +-void FixedArray::set(int index, Smi value) { ++inline V8_EXPORT_PRIVATE void FixedArray::set(int index, Smi value) { + DCHECK_NE(map(), GetReadOnlyRoots().fixed_cow_array_map()); + DCHECK_LT(static_cast(index), static_cast(length())); + DCHECK(Object(value).IsSmi()); +diff --git a/src/objects/fixed-array.h b/src/objects/fixed-array.h +index 98c5d8d5b5..bd5303e44c 100644 +--- a/src/objects/fixed-array.h ++++ b/src/objects/fixed-array.h +@@ -132,7 +132,7 @@ class FixedArray + inline bool is_the_hole(Isolate* isolate, int index); + + // Setter that doesn't need write barrier. +- inline void set(int index, Smi value); ++ inline V8_EXPORT_PRIVATE void set(int index, Smi value); + // Setter with explicit barrier mode. + inline void set(int index, Object value, WriteBarrierMode mode); + +diff --git a/src/snapshot/snapshot-utils.cc b/src/snapshot/snapshot-utils.cc +index eb2372372c..7defadb4b1 100644 +--- a/src/snapshot/snapshot-utils.cc ++++ b/src/snapshot/snapshot-utils.cc +@@ -5,7 +5,7 @@ + #include "src/snapshot/snapshot-utils.h" + + #include "src/sanitizer/msan.h" +-#include "third_party/zlib/zlib.h" ++#include "zlib.h" + + namespace v8 { + namespace internal { +diff --git a/src/wasm/function-body-decoder-impl.h b/src/wasm/function-body-decoder-impl.h +index d37f718681..3a409e1d76 100644 +--- a/src/wasm/function-body-decoder-impl.h ++++ b/src/wasm/function-body-decoder-impl.h +@@ -2013,7 +2013,7 @@ class WasmDecoder : public Decoder { + } + + // TODO(clemensb): This is only used by the interpreter; move there. +- V8_EXPORT_PRIVATE std::pair StackEffect(const byte* pc) { ++ std::pair StackEffect(const byte* pc) { + WasmOpcode opcode = static_cast(*pc); + // Handle "simple" opcodes with a fixed signature first. + const FunctionSig* sig = WasmOpcodes::Signature(opcode); +diff --git a/test/cctest/BUILD.gn b/test/cctest/BUILD.gn +index ffa4e3a136..a279faee9b 100644 +--- a/test/cctest/BUILD.gn ++++ b/test/cctest/BUILD.gn +@@ -493,6 +493,10 @@ v8_source_set("cctest_sources") { + # C4309: 'static_cast': truncation of constant value + cflags += [ "/wd4309" ] + ++ if(!is_clang) { ++ cflags += [ "/wd4789" ] ++ } ++ + # MSVS wants this for gay-{precision,shortest}.cc. + cflags += [ "/bigobj" ] + +diff --git a/tools/debug_helper/BUILD.gn b/tools/debug_helper/BUILD.gn +index 2256df1f55..29e27c6af9 100644 +--- a/tools/debug_helper/BUILD.gn ++++ b/tools/debug_helper/BUILD.gn +@@ -100,10 +100,12 @@ v8_component("v8_debug_helper") { + "../..:v8_libbase", + "../..:v8_shared_internal_headers", + "../..:v8_tracing", ++ "../..:v8", + ] + + configs = [ ":internal_config" ] + if (v8_enable_i18n_support) { ++ public_deps = [ "//third_party/icu" ] + configs += [ "//third_party/icu:icu_config" ] + } + +diff --git a/tools/v8windbg/BUILD.gn b/tools/v8windbg/BUILD.gn +index 5618d2d945..71568f1670 100644 +--- a/tools/v8windbg/BUILD.gn ++++ b/tools/v8windbg/BUILD.gn +@@ -6,7 +6,7 @@ import("../../gni/v8.gni") + + config("v8windbg_config") { + # Required for successful compilation of SDK header file DbgModel.h. +- cflags_cc = [ "/Zc:twoPhase-" ] ++ cflags_cc = [ "/Zc:twoPhase-", "/std:c++latest" ] + + include_dirs = [ "../.." ] + } +diff --git a/tools/v8windbg/base/dbgext.h b/tools/v8windbg/base/dbgext.h +index 8b36a8f361..f8d9f0d64e 100644 +--- a/tools/v8windbg/base/dbgext.h ++++ b/tools/v8windbg/base/dbgext.h +@@ -9,6 +9,7 @@ + #error Unicode not defined + #endif + ++#include + #include + #include + #include +diff --git a/tools/v8windbg/src/v8-debug-helper-interop.h b/tools/v8windbg/src/v8-debug-helper-interop.h +index f7d78c5dd3..1c70e54e7a 100644 +--- a/tools/v8windbg/src/v8-debug-helper-interop.h ++++ b/tools/v8windbg/src/v8-debug-helper-interop.h +@@ -5,10 +5,11 @@ + #ifndef V8_TOOLS_V8WINDBG_SRC_V8_DEBUG_HELPER_INTEROP_H_ + #define V8_TOOLS_V8WINDBG_SRC_V8_DEBUG_HELPER_INTEROP_H_ + +-#include +- ++#include ++#include + #include + ++#include + #include + #include + #include +diff --git a/tools/v8windbg/test/debug-callbacks.h b/tools/v8windbg/test/debug-callbacks.h +index 8855d6ffbc..ed2b0f62e9 100644 +--- a/tools/v8windbg/test/debug-callbacks.h ++++ b/tools/v8windbg/test/debug-callbacks.h +@@ -9,6 +9,7 @@ + #error Unicode not defined + #endif + ++#include + #include + #include + #include diff --git a/cmake/ports/v8/v8.pc.in b/cmake/ports/v8/v8.pc.in new file mode 100644 index 0000000000..5f57217256 --- /dev/null +++ b/cmake/ports/v8/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: @pkgver@ +Requires: zlib, icu-uc, icu-i18n, v8_libbase = @pkgver@ +Libs: -L${libdir} -lv8 +Cflags: -I${includedir} @CFLAGS@ diff --git a/cmake/ports/v8/v8_libbase.pc.in b/cmake/ports/v8/v8_libbase.pc.in new file mode 100644 index 0000000000..ad472abf9b --- /dev/null +++ b/cmake/ports/v8/v8_libbase.pc.in @@ -0,0 +1,10 @@ +prefix=@PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: v8 +Description: V8 JavaScript Engine - Base library +Version: @pkgver@ +Libs: -L${libdir} -lv8_libbase +Cflags: -I${includedir} @CFLAGS@ diff --git a/cmake/ports/v8/v8_libplatform.pc.in b/cmake/ports/v8/v8_libplatform.pc.in new file mode 100644 index 0000000000..19c54ba798 --- /dev/null +++ b/cmake/ports/v8/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: @pkgver@ +Libs: -L${libdir} -lv8_libplatform +Cflags: -I${includedir} @CFLAGS@ diff --git a/cmake/ports/v8/v8_monolith.pc.in b/cmake/ports/v8/v8_monolith.pc.in new file mode 100644 index 0000000000..b23c661e81 --- /dev/null +++ b/cmake/ports/v8/v8_monolith.pc.in @@ -0,0 +1,11 @@ +prefix=@PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: v8 +Description: V8 JavaScript Engine +Version: @pkgver@ +Requires: zlib, icu-uc, icu-i18n @REQUIRES@ +Libs: -L${libdir} -lv8_monolith @LIBS@ +Cflags: -I${includedir} @CFLAGS@ diff --git a/cmake/ports/v8/vcpkg.json b/cmake/ports/v8/vcpkg.json new file mode 100644 index 0000000000..eae65fcd0c --- /dev/null +++ b/cmake/ports/v8/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "v8", + "version": "9.1.269.39", + "port-version": 4, + "description": "Google Chrome's JavaScript engine", + "homepage": "https://v8.dev", + "license": "BSD-3-Clause", + "supports": "!(arm | arm64 | uwp | osx | linux)", + "dependencies": [ + { + "name": "glib", + "platform": "linux" + }, + "icu", + { + "name": "pthread", + "platform": "linux" + }, + { + "name": "vcpkg-tool-python2", + "host": true + }, + "zlib" + ] +} diff --git a/cmake/ports/v8/zlib.gn b/cmake/ports/v8/zlib.gn new file mode 100644 index 0000000000..570d0e22a3 --- /dev/null +++ b/cmake/ports/v8/zlib.gn @@ -0,0 +1,21 @@ +import("//build/config/linux/pkg_config.gni") + +pkg_config("system_zlib") { + packages = [ "zlib" ] + defines = [ "USE_SYSTEM_ZLIB=1" ] +} + +config("zlib_config") { + if(is_win && !is_component_build) { + ldflags = ["/ignore:4099"] # needed on VCPKG CI builds + } + configs = [ + ":system_zlib", + ] +} + +source_set("zlib") { + public_configs = [ + ":system_zlib", + ] +}