Use the correct path separator on Windows
This commit is contained in:
parent
baa4470ebb
commit
ca3d90d793
|
@ -132,13 +132,12 @@ class BuildEnv:
|
|||
def get_env(self, *, cross_comp_flags, cross_compilers, cross_path):
|
||||
env = self.configInfo.get_env()
|
||||
pkgconfig_path = pj(self.install_dir, self.libprefix, "pkgconfig")
|
||||
env["PKG_CONFIG_PATH"] = ":".join([env["PKG_CONFIG_PATH"], pkgconfig_path])
|
||||
env["PKG_CONFIG_PATH"].append(pkgconfig_path)
|
||||
|
||||
env["PATH"] = ":".join([escape_path(pj(self.install_dir, "bin")), env["PATH"]])
|
||||
env["PATH"].insert(0, pj(self.install_dir, "bin"))
|
||||
|
||||
env["LD_LIBRARY_PATH"] = ":".join(
|
||||
env["LD_LIBRARY_PATH"].extend(
|
||||
[
|
||||
env["LD_LIBRARY_PATH"],
|
||||
pj(self.install_dir, "lib"),
|
||||
pj(self.install_dir, self.libprefix),
|
||||
]
|
||||
|
@ -170,7 +169,7 @@ class BuildEnv:
|
|||
if cross_compilers:
|
||||
self.configInfo.set_compiler(env)
|
||||
if cross_path:
|
||||
env["PATH"] = ":".join(self.configInfo.get_bin_dir() + [env["PATH"]])
|
||||
env["PATH"][0:0] = self.configInfo.get_bin_dir()
|
||||
return env
|
||||
|
||||
@property
|
||||
|
|
|
@ -76,18 +76,15 @@ class ArmConfigInfo(ConfigInfo):
|
|||
|
||||
def get_env(self):
|
||||
env = super().get_env()
|
||||
env["LD_LIBRARY_PATH"] = ":".join(
|
||||
[
|
||||
pj(self.root_path, self.arch_full, "lib64"),
|
||||
pj(self.root_path, "lib"),
|
||||
env["LD_LIBRARY_PATH"],
|
||||
]
|
||||
)
|
||||
env["LD_LIBRARY_PATH"][0:0] = [
|
||||
pj(self.root_path, self.arch_full, "lib64"),
|
||||
pj(self.root_path, "lib"),
|
||||
]
|
||||
env["PKG_CONFIG_LIBDIR"] = pj(self.root_path, "lib", "pkgconfig")
|
||||
env["QEMU_LD_PREFIX"] = pj(self.root_path, self.arch_full, "libc")
|
||||
env["QEMU_SET_ENV"] = "LD_LIBRARY_PATH={}".format(
|
||||
":".join(
|
||||
[pj(self.root_path, self.arch_full, "lib"), env["LD_LIBRARY_PATH"]]
|
||||
[pj(self.root_path, self.arch_full, "lib"), str(env["LD_LIBRARY_PATH"])]
|
||||
)
|
||||
)
|
||||
return env
|
||||
|
|
|
@ -161,18 +161,16 @@ def MixedMixin(static_name):
|
|||
|
||||
def get_env(self):
|
||||
env = super().get_env()
|
||||
env["PATH"] = ":".join(
|
||||
[pj(self.static_buildEnv.install_dir, "bin")] + [env["PATH"]]
|
||||
)
|
||||
env["PATH"].insert(0, pj(self.static_buildEnv.install_dir, "bin"))
|
||||
pkgconfig_path = pj(
|
||||
self.static_buildEnv.install_dir,
|
||||
self.static_buildEnv.libprefix,
|
||||
"pkgconfig",
|
||||
)
|
||||
env["PKG_CONFIG_PATH"] = ":".join([env["PKG_CONFIG_PATH"], pkgconfig_path])
|
||||
env["PKG_CONFIG_PATH"].append(pkgconfig_path)
|
||||
env["CPPFLAGS"] = " ".join(
|
||||
[
|
||||
"-I" + pj(self.static_buildEnv.install_dir, "include"),
|
||||
"-I" + pj(self.static_buildEnv.install_dir, "include"),
|
||||
env["CPPFLAGS"],
|
||||
]
|
||||
)
|
||||
|
|
|
@ -73,27 +73,22 @@ class MuslConfigInfo(ConfigInfo):
|
|||
|
||||
def get_env(self):
|
||||
env = super().get_env()
|
||||
env["LD_LIBRARY_PATH"] = ":".join(
|
||||
[
|
||||
pj(self.root_path, self.arch_full, "lib64"),
|
||||
pj(self.root_path, "lib"),
|
||||
env["LD_LIBRARY_PATH"],
|
||||
]
|
||||
)
|
||||
env["LD_LIBRARY_PATH"][0:0] = [
|
||||
pj(self.root_path, self.arch_full, "lib64"),
|
||||
pj(self.root_path, "lib"),
|
||||
]
|
||||
env["PKG_CONFIG_LIBDIR"] = pj(self.root_path, "lib", "pkgconfig")
|
||||
env["QEMU_LD_PREFIX"] = pj(self.root_path, self.arch_full, "libc")
|
||||
env["QEMU_SET_ENV"] = "LD_LIBRARY_PATH={}".format(
|
||||
":".join(
|
||||
[pj(self.root_path, self.arch_full, "lib"), env["LD_LIBRARY_PATH"]]
|
||||
[pj(self.root_path, self.arch_full, "lib"), str(env["LD_LIBRARY_PATH"])]
|
||||
)
|
||||
)
|
||||
return env
|
||||
|
||||
def set_comp_flags(self, env):
|
||||
super().set_comp_flags(env)
|
||||
env["LD_LIBRARY_PATH"] = ":".join(
|
||||
[pj(self.root_path, self.arch_full, "lib"), env["LD_LIBRARY_PATH"]]
|
||||
)
|
||||
env["LD_LIBRARY_PATH"].insert(0, pj(self.root_path, self.arch_full, "lib"))
|
||||
env["CFLAGS"] = (
|
||||
" -fPIC -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 "
|
||||
+ env["CFLAGS"]
|
||||
|
|
|
@ -79,9 +79,8 @@ class WasmConfigInfo(ConfigInfo):
|
|||
|
||||
def get_env(self):
|
||||
env = super().get_env()
|
||||
env["PATH"] = ":".join(
|
||||
env["PATH"].extend(
|
||||
[
|
||||
env["PATH"],
|
||||
self.install_path,
|
||||
pj(self.install_path, "upstream", "emscripten"),
|
||||
pj(self.install_path, "node", "14.18.2_64bit", "bin"),
|
||||
|
|
|
@ -46,7 +46,5 @@ class LibMagic(Dependency):
|
|||
cross_comp_flags=True, cross_compilers=True, cross_path=True
|
||||
)
|
||||
libmagic_native_builder = get_target_step("libmagic", "native_static")
|
||||
env["PATH"] = ":".join(
|
||||
[pj(libmagic_native_builder.build_path, "src"), env["PATH"]]
|
||||
)
|
||||
env["PATH"].insert(0, pj(libmagic_native_builder.build_path, "src"))
|
||||
run_command(command, self.build_path, context, env=env)
|
||||
|
|
|
@ -63,9 +63,33 @@ class DefaultEnv(Defaultdict):
|
|||
def __getitem__(self, name):
|
||||
if name == b"PATH":
|
||||
raise KeyError
|
||||
if name in ["PATH", "PKG_CONFIG_PATH", "LD_LIBRARY_PATH"]:
|
||||
item = super().__getitem__(name)
|
||||
if isinstance(item, PathArray):
|
||||
return item
|
||||
else:
|
||||
item = PathArray(item)
|
||||
self[name] = item
|
||||
return item
|
||||
return super().__getitem__(name)
|
||||
|
||||
|
||||
def get_separator():
|
||||
return ";" if neutralEnv("distname") == "Windows" else ":"
|
||||
|
||||
|
||||
class PathArray(list):
|
||||
def __init__(self, value):
|
||||
self.separator = get_separator()
|
||||
if not value:
|
||||
super().__init__([])
|
||||
else:
|
||||
super().__init__(value.split(self.separator))
|
||||
|
||||
def __str__(self):
|
||||
return self.separator.join(self)
|
||||
|
||||
|
||||
def remove_duplicates(iterable, key_function=None):
|
||||
seen = set()
|
||||
if key_function is None:
|
||||
|
@ -309,6 +333,7 @@ def run_command(command, cwd, context, *, env=None, input=None):
|
|||
print("run command '{}'".format(command), file=log)
|
||||
print("current directory is '{}'".format(cwd), file=log)
|
||||
print("env is :", file=log)
|
||||
env = {k: str(v) for k, v in env.items()}
|
||||
for k, v in env.items():
|
||||
print(" {} : {!r}".format(k, v), file=log)
|
||||
|
||||
|
|
Loading…
Reference in New Issue