zig include root: it depends on the OS
Previously the toolchain wrappers used to assume the zig_lib_dir is always in "lib". However, it depends on the OS: macos-x86_64 and linux-aarch64 have it in "lib/zig". Update the wrapper scripts to reflect that.
This commit is contained in:
parent
359cb0fe6d
commit
e5eff0c911
@ -125,9 +125,9 @@ set ZIG_GLOBAL_CACHE_DIR=%ZIG_LOCAL_CACHE_DIR%
|
|||||||
_ZIG_TOOL_WRAPPER_CACHE_KNOWN = """#!/bin/sh
|
_ZIG_TOOL_WRAPPER_CACHE_KNOWN = """#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
if [ -d external/zig_sdk/lib ]; then
|
if [ -d external/zig_sdk/lib ]; then
|
||||||
ZIG_LIB_DIR=external/zig_sdk/lib
|
ZIG_LIB_DIR=external/zig_sdk/{zig_include_root}
|
||||||
else
|
else
|
||||||
ZIG_LIB_DIR="$(dirname "$0")/../../lib"
|
ZIG_LIB_DIR="$(dirname "$0")/../../{zig_include_root}"
|
||||||
fi
|
fi
|
||||||
export ZIG_LIB_DIR
|
export ZIG_LIB_DIR
|
||||||
export ZIG_LOCAL_CACHE_DIR="{cache_prefix}/bazel-zig-cc"
|
export ZIG_LOCAL_CACHE_DIR="{cache_prefix}/bazel-zig-cc"
|
||||||
@ -139,9 +139,9 @@ exec "{zig}" "{zig_tool}" {maybe_target} "$@"
|
|||||||
_ZIG_TOOL_WRAPPER_CACHE_GUESS = """#!/bin/sh
|
_ZIG_TOOL_WRAPPER_CACHE_GUESS = """#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
if [ -d external/zig_sdk/lib ]; then
|
if [ -d external/zig_sdk/lib ]; then
|
||||||
ZIG_LIB_DIR=external/zig_sdk/lib
|
ZIG_LIB_DIR=external/zig_sdk/{zig_include_root}
|
||||||
else
|
else
|
||||||
ZIG_LIB_DIR="$(dirname "$0")/../../lib"
|
ZIG_LIB_DIR="$(dirname "$0")/../../{zig_include_root}"
|
||||||
fi
|
fi
|
||||||
if [ -n "$TMPDIR" ]; then
|
if [ -n "$TMPDIR" ]; then
|
||||||
_cache_prefix=$TMPDIR
|
_cache_prefix=$TMPDIR
|
||||||
@ -180,13 +180,14 @@ fi
|
|||||||
eval set -- "$saved"
|
eval set -- "$saved"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _zig_tool_wrapper(zig_tool, zig, is_windows, cache_prefix, zigtarget):
|
def _zig_tool_wrapper(zig_tool, zig, is_windows, cache_prefix, zigtarget, zig_include_root):
|
||||||
kwargs = dict(
|
kwargs = dict(
|
||||||
zig = str(zig).replace("/", "\\") + ".exe" if is_windows else zig,
|
zig = str(zig).replace("/", "\\") + ".exe" if is_windows else zig,
|
||||||
zig_tool = zig_tool,
|
zig_tool = zig_tool,
|
||||||
cache_prefix = cache_prefix,
|
cache_prefix = cache_prefix,
|
||||||
maybe_gohack = _ZIG_TOOL_GOHACK if (zig_tool == "c++" and not is_windows) else "",
|
maybe_gohack = _ZIG_TOOL_GOHACK if (zig_tool == "c++" and not is_windows) else "",
|
||||||
maybe_target = "-target {}".format(zigtarget) if zig_tool == "c++" else "",
|
maybe_target = "-target {}".format(zigtarget) if zig_tool == "c++" else "",
|
||||||
|
zig_include_root = zig_include_root,
|
||||||
)
|
)
|
||||||
|
|
||||||
if is_windows:
|
if is_windows:
|
||||||
@ -271,6 +272,7 @@ def _zig_repository_impl(repository_ctx):
|
|||||||
os == "windows",
|
os == "windows",
|
||||||
repository_ctx.os.environ.get("BAZEL_ZIG_CC_CACHE_PREFIX", ""),
|
repository_ctx.os.environ.get("BAZEL_ZIG_CC_CACHE_PREFIX", ""),
|
||||||
zigtarget = target_config.zigtarget,
|
zigtarget = target_config.zigtarget,
|
||||||
|
zig_include_root = zig_include_root,
|
||||||
)
|
)
|
||||||
|
|
||||||
repository_ctx.file(
|
repository_ctx.file(
|
||||||
|
Loading…
Reference in New Issue
Block a user