Clean up the environment variables set for mozjs (#30106)

mozjs from the repository now has a simplified interface for setting
these.
This commit is contained in:
Martin Robinson 2023-08-16 13:14:14 +02:00 committed by GitHub
parent d6ae8dc112
commit 46978b2543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 25 deletions

4
Cargo.lock generated
View file

@ -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",

View file

@ -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"