From 1017301e38bd4b3da4e5d8d41b8e9da7d268c85a Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 25 Dec 2023 01:13:38 +0800 Subject: [PATCH] Patch icu and remove patch.sh --- deps/build.py | 31 ++++++++++++++++++++++++++----- deps/patch.sh | 6 ------ 2 files changed, 26 insertions(+), 11 deletions(-) delete mode 100644 deps/patch.sh diff --git a/deps/build.py b/deps/build.py index 0c77e071..6ce75a39 100755 --- a/deps/build.py +++ b/deps/build.py @@ -76,6 +76,31 @@ v8_enable_verify_heap=false """ +def patch_icu(file_path= os.path.join(v8_path, "third_party/icu/BUILD.gn"), replace_str="\"standard__\""): + print (file_path) + try: + # Read the content of the file + with open(file_path, 'r') as file: + file_content = file.read() + + # Replace the specified string + file_content = file_content.replace("\"standard\"", replace_str) + + # Write the modified content back to the file + with open(file_path, 'w') as file: + file.write(file_content) + + # Remove the specified directory + git_dir = os.path.join(v8_path, "third_party/icu/.git") + print (git_dir) + if os.path.exists(git_dir): + os.system(f"rm -rf {git_dir}") + + print("Patch icu success") + + except Exception as e: + print(f"Error patching icu: {e}") + def v8deps(): spec = "solutions = %s" % gclient_sln env = os.environ.copy() @@ -86,11 +111,7 @@ def v8deps(): # if arch is arm64 and os is linux apply patch # fix aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mmark-bti-property’ if args.arch == "arm64" and is_linux: - patch_script_path = "./patch.sh" - subprocess.check_call(cmd([patch_script_path]), - cwd=deps_path, - env=env) - + patch_icu() def cmd(args): return ["cmd", "/c"] + args if is_windows else args diff --git a/deps/patch.sh b/deps/patch.sh deleted file mode 100644 index f85a0c33..00000000 --- a/deps/patch.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -file_path="./v8/third_party/icu/BUILD.gn" -replace_str="\"standard__\"" -sed -i "s/\"standard\"/$replace_str/" $file_path -rm -rf "./v8/third_party/icu/.git/" -echo "Patch icu success" \ No newline at end of file