WIP: use relative paths for tools
This commit is contained in:
parent
f6b16c386f
commit
ab59c18d60
@ -110,7 +110,7 @@ toolchain(
|
|||||||
generator_location = "toolchain/BUILD:7:19",
|
generator_location = "toolchain/BUILD:7:19",
|
||||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||||
target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64", "@zig_sdk//libc:unconstrained"],
|
target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64", "@zig_sdk//libc:unconstrained"],
|
||||||
toolchain = "@zig_sdk//private:aarch64-linux-musl_cc",
|
toolchain = "@zig_sdk//:aarch64-linux-musl_cc",
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
load("@bazel-zig-cc//toolchain:defs.bzl", "declare_files")
|
load("@bazel-zig-cc//toolchain:defs.bzl", "declare_files")
|
||||||
|
load("@bazel-zig-cc//toolchain/private:cc_toolchains.bzl", "declare_cc_toolchains")
|
||||||
|
|
||||||
package(
|
package(
|
||||||
default_visibility = ["//visibility:public"],
|
default_visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
declare_files(
|
declare_files(
|
||||||
os = {os},
|
os = {os},
|
||||||
zig_include_root = {zig_include_root},
|
zig_include_root = {zig_include_root},
|
||||||
@ -15,3 +14,9 @@ exports_files([
|
|||||||
"glibc-hacks/fcntl.map",
|
"glibc-hacks/fcntl.map",
|
||||||
"glibc-hacks/glibchack-fcntl.h",
|
"glibc-hacks/glibchack-fcntl.h",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
declare_cc_toolchains(
|
||||||
|
os = {os},
|
||||||
|
absolute_path = {absolute_path},
|
||||||
|
zig_include_root = {zig_include_root},
|
||||||
|
)
|
||||||
|
@ -186,14 +186,14 @@ def _zig_repository_impl(repository_ctx):
|
|||||||
|
|
||||||
for dest, src in {
|
for dest, src in {
|
||||||
"BUILD": "//toolchain:BUILD.sdk.bazel",
|
"BUILD": "//toolchain:BUILD.sdk.bazel",
|
||||||
"private/BUILD": "//toolchain/private:BUILD.sdk.bazel",
|
# "private/BUILD": "//toolchain/private:BUILD.sdk.bazel",
|
||||||
}.items():
|
}.items():
|
||||||
repository_ctx.template(
|
repository_ctx.template(
|
||||||
dest,
|
dest,
|
||||||
Label(src),
|
Label(src),
|
||||||
executable = False,
|
executable = False,
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"{absolute_path}": _quote(str(repository_ctx.path(""))),
|
"{absolute_path}": _quote("external/zig_sdk"),
|
||||||
"{os}": _quote(os),
|
"{os}": _quote(os),
|
||||||
"{zig_include_root}": _quote(zig_include_root),
|
"{zig_include_root}": _quote(zig_include_root),
|
||||||
},
|
},
|
||||||
@ -246,6 +246,7 @@ def filegroup(name, **kwargs):
|
|||||||
return ":" + name
|
return ":" + name
|
||||||
|
|
||||||
def declare_files(os, zig_include_root):
|
def declare_files(os, zig_include_root):
|
||||||
|
filegroup(name = "all", srcs = native.glob(["**"]))
|
||||||
filegroup(name = "empty")
|
filegroup(name = "empty")
|
||||||
if os == "windows":
|
if os == "windows":
|
||||||
native.exports_files(["zig.exe"], visibility = ["//visibility:public"])
|
native.exports_files(["zig.exe"], visibility = ["//visibility:public"])
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
load("@bazel-zig-cc//toolchain/private:cc_toolchains.bzl", "declare_cc_toolchains")
|
|
||||||
|
|
||||||
declare_cc_toolchains(
|
|
||||||
os = {os},
|
|
||||||
absolute_path = {absolute_path},
|
|
||||||
zig_include_root = {zig_include_root},
|
|
||||||
)
|
|
@ -29,7 +29,7 @@ def declare_cc_toolchains(os, absolute_path, zig_include_root):
|
|||||||
absolute_tool_paths[name] = path
|
absolute_tool_paths[name] = path
|
||||||
continue
|
continue
|
||||||
tool_path = zig_tool_path(os).format(zig_tool = path)
|
tool_path = zig_tool_path(os).format(zig_tool = path)
|
||||||
absolute_tool_paths[name] = "%s/%s" % (absolute_path, tool_path)
|
absolute_tool_paths[name] = tool_path
|
||||||
|
|
||||||
linkopts = target_config.linkopts
|
linkopts = target_config.linkopts
|
||||||
dynamic_library_linkopts = target_config.dynamic_library_linkopts
|
dynamic_library_linkopts = target_config.dynamic_library_linkopts
|
||||||
@ -53,18 +53,20 @@ def declare_cc_toolchains(os, absolute_path, zig_include_root):
|
|||||||
compiler = "clang",
|
compiler = "clang",
|
||||||
abi_version = "unknown",
|
abi_version = "unknown",
|
||||||
abi_libc_version = "unknown",
|
abi_libc_version = "unknown",
|
||||||
|
# visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
|
||||||
native.cc_toolchain(
|
native.cc_toolchain(
|
||||||
name = zigtarget + "_cc",
|
name = zigtarget + "_cc",
|
||||||
toolchain_identifier = zigtarget + "-toolchain",
|
toolchain_identifier = zigtarget + "-toolchain",
|
||||||
toolchain_config = ":%s_cc_config" % zigtarget,
|
toolchain_config = ":%s_cc_config" % zigtarget,
|
||||||
all_files = "@zig_sdk//:zig",
|
all_files = "@zig_sdk//:all",
|
||||||
ar_files = "@zig_sdk//:zig",
|
ar_files = "@zig_sdk//:all",
|
||||||
compiler_files = "@zig_sdk//:zig",
|
compiler_files = "@zig_sdk//:all",
|
||||||
linker_files = "@zig_sdk//:zig",
|
linker_files = "@zig_sdk//:all",
|
||||||
dwp_files = "@zig_sdk//:empty",
|
dwp_files = "@zig_sdk//:empty",
|
||||||
objcopy_files = "@zig_sdk//:empty",
|
objcopy_files = "@zig_sdk//:empty",
|
||||||
strip_files = "@zig_sdk//:empty",
|
strip_files = "@zig_sdk//:empty",
|
||||||
supports_param_files = 0,
|
supports_param_files = 0,
|
||||||
|
# visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
@ -32,7 +32,7 @@ def _declare_toolchain(gotarget, zigtarget, target_compatible_with):
|
|||||||
name = gotarget,
|
name = gotarget,
|
||||||
exec_compatible_with = None,
|
exec_compatible_with = None,
|
||||||
target_compatible_with = target_compatible_with,
|
target_compatible_with = target_compatible_with,
|
||||||
toolchain = "@zig_sdk//private:%s_cc" % zigtarget,
|
toolchain = "@zig_sdk//:%s_cc" % zigtarget,
|
||||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,6 +41,6 @@ def _declare_toolchain(gotarget, zigtarget, target_compatible_with):
|
|||||||
name = zigtarget,
|
name = zigtarget,
|
||||||
exec_compatible_with = None,
|
exec_compatible_with = None,
|
||||||
target_compatible_with = target_compatible_with,
|
target_compatible_with = target_compatible_with,
|
||||||
toolchain = "@zig_sdk//private:%s_cc" % zigtarget,
|
toolchain = "@zig_sdk//:%s_cc" % zigtarget,
|
||||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user