Skip to content

Commit

Permalink
[v8] Update to Stable version 10.1.124.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwizatz committed May 19, 2022
1 parent 8f1d60f commit 513b571
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 111 deletions.
109 changes: 61 additions & 48 deletions ports/v8/build.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index d96064894..7fbb2e696 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -140,7 +140,8 @@ declare_args() {
(current_cpu != "s390x" && current_cpu != "s390" &&
current_cpu != "ppc64" && current_cpu != "ppc" &&
current_cpu != "mips" && current_cpu != "mips64" &&
- current_cpu != "riscv64")
+ current_cpu != "riscv64") ||
+ (getenv("CXX") == "clang" || getenv("CXX") == "clang++")

# Allows the path to a custom target toolchain to be injected as a single
# argument, and set as the default toolchain.
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
index 1904a2559..e66586c88 100644
index c411ee37c..fa92ce42f 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") {
@@ -1930,8 +1930,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) {
+ if (is_clang) {
+ common_optimize_on_cflags += [
+ "/Ob2", # Both explicit and auto inlining.
+ "/Ob2", # Both explicit and auto inlining.
+ ]
+ } else {
+ common_optimize_on_cflags += [
Expand All @@ -31,7 +37,7 @@ index 1904a2559..e66586c88 100644
"/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
index 5adf70cc3..05110c05b 100644
--- a/config/linux/pkg-config.py
+++ b/config/linux/pkg-config.py
@@ -41,6 +41,11 @@ from optparse import OptionParser
Expand All @@ -43,23 +49,25 @@ index 5adf70cc3..dab159f98 100755
+# 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):
@@ -105,11 +110,34 @@ 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")
+ 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")
+ 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(1) + matchobj.group(2) + '.lib'
+ return matchobj.group(0)
+
+
Expand All @@ -68,7 +76,7 @@ index 5adf70cc3..dab159f98 100755
+ # 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]
+ return [flag_regex.sub(FlagReplace, flag) for flag in flags]
+
+
def main():
Expand All @@ -79,40 +87,44 @@ index 5adf70cc3..dab159f98 100755
+ if "linux" not in sys.platform and 'win32' not in sys.platform:
print("[[],[],[],[],[]]")
return 0
@@ -128,6 +154,9 @@ def main():

@@ -128,6 +156,13 @@ 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',
+ 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')
+ 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():
@@ -144,6 +179,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():
@@ -203,7 +242,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():
@@ -220,7 +259,10 @@ def main():
continue;

if flag[:2] == '-l':
- libs.append(RewritePath(flag[2:], prefix, sysroot))
+ library = RewritePath(flag[2:], prefix, sysroot)
Expand All @@ -122,23 +134,23 @@ index 5adf70cc3..dab159f98 100755
elif flag[:2] == '-L':
lib_dirs.append(RewritePath(flag[2:], prefix, sysroot))
elif flag[:2] == '-I':
@@ -237,6 +273,14 @@ def main():
@@ -237,6 +279,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)
+ 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
index 635fd8dde..026102624 100644
--- a/config/linux/pkg_config.gni
+++ b/config/linux/pkg_config.gni
@@ -45,6 +45,9 @@ declare_args() {
Expand All @@ -149,12 +161,12 @@ index 428e44ac0..a0d2175ee 100644
+ # 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 != "") {
@@ -88,6 +91,17 @@ if (host_pkg_config != "") {
host_pkg_config_args = pkg_config_args
}

+if (pkg_config_libdir != "") {
+ pkg_config_args += [
+ "--pkg_config_libdir",
Expand All @@ -170,18 +182,19 @@ index 428e44ac0..a0d2175ee 100644
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
index 02a36642b..63ea8b6c6 100644
--- a/util/lastchange.py
+++ b/util/lastchange.py
@@ -192,7 +192,10 @@ def GetGitTopDirectory(source_dir):
@@ -192,7 +192,11 @@ 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()
+ 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):
29 changes: 21 additions & 8 deletions ports/v8/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@

set(pkgver "9.1.269.39")
set(pkgver "10.1.124.12")

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(PYTHON3)
get_filename_component(PYTHON3_PATH ${PYTHON3} 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)

if(WIN32)
# The Windows embeddable pachage for Python3
# does not contain a python3.exe file or symlink,
# so we need to create one.
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/bin")
vcpkg_execute_required_process(
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON3} python3.exe
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/bin"
LOGNAME build-${TARGET_TRIPLET}
)
endif()

vcpkg_add_to_path(PREPEND "${CURRENT_BUILDTREES_DIR}/bin")
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 "${PYTHON3_PATH}")
vcpkg_add_to_path(PREPEND "${GN_PATH}")
vcpkg_add_to_path(PREPEND "${NINJA_PATH}")
if(WIN32)
Expand Down Expand Up @@ -71,15 +84,15 @@ endfunction()
vcpkg_from_git(
OUT_SOURCE_PATH SOURCE_PATH
URL https://chromium.googlesource.com/v8/v8.git
REF 7d3d62c91f69a702e5aa54c6b4dbbaa883683717
REF e5f13e0cd10e245d822f856d17b347c77ccc7593
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
REF f7d8d1eb990dab66c85e0f160c8f7300ac8f4fc2
SOURCE ${SOURCE_PATH}
PATCHES ${CURRENT_PORT_DIR}/build.patch)
v8_fetch(
Expand All @@ -100,7 +113,7 @@ v8_fetch(
v8_fetch(
DESTINATION third_party/jinja2
URL https://chromium.googlesource.com/chromium/src/third_party/jinja2.git
REF b41863e42637544c2941b574c7877d3e1f663e25
REF ee69aa00ee8536f61db6a451f3858745cf587de6
SOURCE ${SOURCE_PATH})
v8_fetch(
DESTINATION third_party/markupsafe
Expand All @@ -109,7 +122,7 @@ v8_fetch(
SOURCE ${SOURCE_PATH})

vcpkg_execute_required_process(
COMMAND ${PYTHON2} build/util/lastchange.py -o build/util/LASTCHANGE
COMMAND ${PYTHON3} build/util/lastchange.py -o build/util/LASTCHANGE
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME build-${TARGET_TRIPLET}
)
Expand Down
Loading

0 comments on commit 513b571

Please sign in to comment.