From 46978b2543e1515c4dcac0e936585aaeed67007a Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Wed, 16 Aug 2023 13:14:14 +0200 Subject: [PATCH] Clean up the environment variables set for mozjs (#30106) mozjs from the repository now has a simplified interface for setting these. --- Cargo.lock | 4 ++-- python/servo/command_base.py | 31 ++++++++----------------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 910e8e4c197..dd4158caf11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3860,7 +3860,7 @@ checksum = "903970ae2f248d7275214cf8f387f8ba0c4ea7e3d87a320e85493db60ce28616" [[package]] name = "mozjs" version = "0.14.1" -source = "git+https://github.com/servo/mozjs#64711ec2e6dc4595df691bffc7f1e5052ab86c8d" +source = "git+https://github.com/servo/mozjs#821687091d68e9f98809a60a9111f6d612c0bdb9" dependencies = [ "cc", "lazy_static", @@ -3873,7 +3873,7 @@ dependencies = [ [[package]] name = "mozjs_sys" version = "0.68.2" -source = "git+https://github.com/servo/mozjs#64711ec2e6dc4595df691bffc7f1e5052ab86c8d" +source = "git+https://github.com/servo/mozjs#821687091d68e9f98809a60a9111f6d612c0bdb9" dependencies = [ "bindgen", "cc", diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 3890d3b69c7..0b51070b4f3 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -466,40 +466,25 @@ class CommandBase(object): env, cross_compilation_target=self.cross_compile_target, check_installation=is_build) - extra_path = [] effective_target = self.cross_compile_target or servo.platform.host_triple() if "msvc" in effective_target: - extra_path += [path.join(self.msvc_package_dir("llvm"), "bin")] - env.setdefault("CC", "clang-cl.exe") - env.setdefault("CXX", "clang-cl.exe") + util.append_paths_to_env(env, "PATH", path.join(self.msvc_package_dir("llvm"), "bin")) - # Link moztools, used for building SpiderMonkey - moztools_paths = [ - path.join(self.msvc_package_dir("moztools"), "bin"), - path.join(self.msvc_package_dir("moztools"), "msys", "bin"), - ] - # In certain cases we need to ensure that tools with conflicting MSYS versions - # can be placed in the PATH ahead of the moztools directories. - moztools_path_prepend = env.get("MOZTOOLS_PATH_PREPEND", None) - if moztools_path_prepend: - moztools_paths.insert(0, moztools_path_prepend) - env["MOZTOOLS_PATH"] = os.pathsep.join(moztools_paths) - # Link autoconf 2.13, used for building SpiderMonkey - env["AUTOCONF"] = path.join(self.msvc_package_dir("moztools"), "msys", "local", "bin", "autoconf-2.13") - # Link LLVM + # These two environment variables are necessary for building mozjs. It would + # be nice to be able to set them in the cargo configuration somehow, but they + # are platform-dependent. env["LIBCLANG_PATH"] = path.join(self.msvc_package_dir("llvm"), "lib") + env["MOZILLA_BUILD"] = path.join(self.msvc_package_dir("moztools")) - if not os.environ.get("NATIVE_WIN32_PYTHON"): - env["NATIVE_WIN32_PYTHON"] = sys.executable # Always build harfbuzz from source env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true" if sys.platform != "win32": env.setdefault("CC", "clang") env.setdefault("CXX", "clang++") - - if extra_path: - util.append_paths_to_env(env, "PATH", extra_path) + else: + env.setdefault("CC", "clang-cl.exe") + env.setdefault("CXX", "clang-cl.exe") if self.config["build"]["incremental"]: env["CARGO_INCREMENTAL"] = "1"