mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add support for $CARGO_HOME in servobuild
This commit is contained in:
parent
4f3feed2be
commit
cfdad335bd
2 changed files with 25 additions and 3 deletions
|
@ -51,6 +51,13 @@ class CommandBase(object):
|
|||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
def resolverelative(category, key):
|
||||
# Allow ~
|
||||
self.config[category][key] = path.expanduser(self.config[category][key])
|
||||
# Resolve relative paths
|
||||
self.config[category][key] = path.join(context.topdir,
|
||||
self.config[category][key])
|
||||
|
||||
if not hasattr(self.context, "bootstrapped"):
|
||||
self.context.bootstrapped = False
|
||||
|
||||
|
@ -64,8 +71,13 @@ class CommandBase(object):
|
|||
self.config.setdefault("tools", {})
|
||||
self.config["tools"].setdefault("cache-dir",
|
||||
path.join(context.topdir, ".servo"))
|
||||
# Allow "~" in cache-dir
|
||||
context.sharedir = path.expanduser(self.config["tools"]["cache-dir"])
|
||||
resolverelative("tools", "cache-dir")
|
||||
|
||||
self.config["tools"].setdefault("cargo-home-dir",
|
||||
path.join(context.topdir, ".cargo"))
|
||||
resolverelative("tools", "cargo-home-dir")
|
||||
|
||||
context.sharedir = self.config["tools"]["cache-dir"]
|
||||
|
||||
self.config["tools"].setdefault("system-rust", False)
|
||||
self.config["tools"].setdefault("system-cargo", False)
|
||||
|
@ -126,6 +138,10 @@ class CommandBase(object):
|
|||
if extra_path:
|
||||
env["PATH"] = "%s%s%s" % (
|
||||
os.pathsep.join(extra_path), os.pathsep, env["PATH"])
|
||||
|
||||
if "CARGO_HOME" not in env:
|
||||
env["CARGO_HOME"] = self.config["tools"]["cargo-home-dir"]
|
||||
|
||||
if extra_lib:
|
||||
if sys.platform == "darwin":
|
||||
env["DYLD_LIBRARY_PATH"] = "%s%s%s" % \
|
||||
|
|
|
@ -2,11 +2,17 @@
|
|||
# Be sure to set the cache-dir correctly, otherwise extra snapshots
|
||||
# may get downloaded
|
||||
|
||||
# Paths starting with "./" are relative to the repo root
|
||||
|
||||
# Tool options
|
||||
[tools]
|
||||
# Where Rust compiler snapshots and other downloads will be stored. Can be
|
||||
# shared by multiple Servo reposities. Defaults to <servo-repo>/.servo
|
||||
cache-dir = "~/.servo"
|
||||
cache-dir = "./.servo"
|
||||
|
||||
# Where cargo stores all of its clones Defaults to <servo-repo>/.cargo
|
||||
cargo-home-dir = "./.cargo"
|
||||
|
||||
# If system-rust is true, will use rustc/rustdoc from the path, or if
|
||||
# rust-root is specified, will make sure that rust-root is in the path
|
||||
# when building. Similarly for Cargo. This takes care of PATH as well as
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue