2021-02-16 15:41:58 +00:00
|
|
|
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
2021-03-11 16:52:36 +00:00
|
|
|
load("//foreign_cc/built_tools:cmake_build.bzl", "cmake_tool")
|
|
|
|
load("//foreign_cc/built_tools:make_build.bzl", "make_tool")
|
2023-06-09 10:29:12 +00:00
|
|
|
load("//foreign_cc/built_tools:meson_build.bzl", "meson_tool")
|
2021-03-11 16:52:36 +00:00
|
|
|
load("//foreign_cc/built_tools:ninja_build.bzl", "ninja_tool")
|
2022-11-09 11:54:39 +00:00
|
|
|
load("//foreign_cc/built_tools:pkgconfig_build.bzl", "pkgconfig_tool")
|
2023-06-09 10:29:12 +00:00
|
|
|
load("//toolchains:toolchains.bzl", "current_autoconf_toolchain", "current_automake_toolchain", "current_cmake_toolchain", "current_m4_toolchain", "current_make_toolchain", "current_meson_toolchain", "current_ninja_toolchain", "current_pkgconfig_toolchain")
|
2021-03-11 16:52:36 +00:00
|
|
|
load("//toolchains/native_tools:native_tools_toolchain.bzl", "native_tool_toolchain")
|
|
|
|
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "cmake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "ninja_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "make_toolchain",
|
|
|
|
)
|
|
|
|
|
2023-06-09 10:29:12 +00:00
|
|
|
toolchain_type(
|
|
|
|
name = "meson_toolchain",
|
|
|
|
)
|
|
|
|
|
2021-12-17 23:27:10 +00:00
|
|
|
toolchain_type(
|
|
|
|
name = "pkgconfig_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "m4_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "autoconf_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "automake_toolchain",
|
|
|
|
)
|
|
|
|
|
2022-03-14 14:06:22 +00:00
|
|
|
current_cmake_toolchain(
|
|
|
|
name = "current_cmake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
current_ninja_toolchain(
|
|
|
|
name = "current_ninja_toolchain",
|
|
|
|
)
|
|
|
|
|
2023-06-09 10:29:12 +00:00
|
|
|
current_meson_toolchain(
|
|
|
|
name = "current_meson_toolchain",
|
|
|
|
)
|
|
|
|
|
2022-03-14 14:06:22 +00:00
|
|
|
current_m4_toolchain(
|
|
|
|
name = "current_m4_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
current_pkgconfig_toolchain(
|
|
|
|
name = "current_pkgconfig_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
current_make_toolchain(
|
|
|
|
name = "current_make_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
current_automake_toolchain(
|
|
|
|
name = "current_automake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
current_autoconf_toolchain(
|
|
|
|
name = "current_autoconf_toolchain",
|
|
|
|
)
|
|
|
|
|
2021-03-11 16:52:36 +00:00
|
|
|
toolchain(
|
|
|
|
name = "built_cmake_toolchain",
|
|
|
|
toolchain = ":built_cmake",
|
|
|
|
toolchain_type = ":cmake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "built_ninja_toolchain",
|
|
|
|
toolchain = ":built_ninja",
|
|
|
|
toolchain_type = ":ninja_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "built_make_toolchain",
|
|
|
|
toolchain = ":built_make",
|
|
|
|
toolchain_type = ":make_toolchain",
|
|
|
|
)
|
|
|
|
|
2023-06-09 10:29:12 +00:00
|
|
|
toolchain(
|
|
|
|
name = "built_meson_toolchain",
|
|
|
|
toolchain = ":built_meson",
|
|
|
|
toolchain_type = ":meson_toolchain",
|
|
|
|
)
|
|
|
|
|
2022-11-09 11:54:39 +00:00
|
|
|
toolchain(
|
|
|
|
name = "built_pkgconfig_toolchain",
|
|
|
|
toolchain = ":built_pkgconfig",
|
|
|
|
toolchain_type = ":pkgconfig_toolchain",
|
|
|
|
)
|
|
|
|
|
2021-03-11 16:52:36 +00:00
|
|
|
# Preinstalled cmake will always be the default, if toolchain with more exact constraints
|
|
|
|
# is not defined before; registered from workspace_definitions.bzl#rules_foreign_cc_dependencies
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_cmake_toolchain",
|
|
|
|
toolchain = ":preinstalled_cmake",
|
|
|
|
toolchain_type = ":cmake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
# Preinstalled ninja will always be the default, if toolchain with more exact constraints
|
|
|
|
# is not defined before; registered from workspace_definitions.bzl#rules_foreign_cc_dependencies
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_ninja_toolchain",
|
|
|
|
toolchain = ":preinstalled_ninja",
|
|
|
|
toolchain_type = ":ninja_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
# Preinstalled make will always be the default, if toolchain with more exact constraints
|
|
|
|
# is not defined before; registered from workspace_definitions.bzl#rules_foreign_cc_dependencies
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_make_toolchain",
|
|
|
|
toolchain = ":preinstalled_make",
|
|
|
|
toolchain_type = ":make_toolchain",
|
|
|
|
)
|
2021-02-16 15:41:58 +00:00
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_make",
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "make.exe",
|
|
|
|
"//conditions:default": "make",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
|
|
|
|
2021-07-18 19:46:46 +00:00
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_nmake_toolchain",
|
|
|
|
exec_compatible_with = [
|
|
|
|
"@platforms//os:windows",
|
|
|
|
],
|
|
|
|
toolchain = ":preinstalled_nmake",
|
|
|
|
toolchain_type = ":make_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_nmake",
|
|
|
|
path = "nmake.exe",
|
|
|
|
)
|
|
|
|
|
2021-02-16 15:41:58 +00:00
|
|
|
make_tool(
|
|
|
|
name = "make_tool",
|
2021-03-15 17:17:59 +00:00
|
|
|
srcs = "@gnumake_src//:all_srcs",
|
2021-02-16 15:41:58 +00:00
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_make",
|
2022-03-14 14:06:22 +00:00
|
|
|
env = select({
|
|
|
|
"@platforms//os:windows": {"MAKE": "$(execpath :make_tool)/bin/make.exe"},
|
|
|
|
"//conditions:default": {"MAKE": "$(execpath :make_tool)/bin/make"},
|
|
|
|
}),
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "$(execpath :make_tool)/bin/make.exe",
|
|
|
|
"//conditions:default": "$(execpath :make_tool)/bin/make",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
target = ":make_tool",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_cmake",
|
2022-05-18 21:20:24 +00:00
|
|
|
env = select({
|
|
|
|
"@platforms//os:windows": {"CMAKE": "cmake.exe"},
|
|
|
|
"//conditions:default": {"CMAKE": "cmake"},
|
|
|
|
}),
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "cmake.exe",
|
|
|
|
"//conditions:default": "cmake",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cmake_tool(
|
|
|
|
name = "cmake_tool",
|
2021-03-15 17:17:59 +00:00
|
|
|
srcs = "@cmake_src//:all_srcs",
|
2021-02-16 15:41:58 +00:00
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_cmake",
|
2022-05-18 21:20:24 +00:00
|
|
|
env = select({
|
|
|
|
"@platforms//os:windows": {"CMAKE": "$(execpath :cmake_tool)/bin/cmake.exe"},
|
|
|
|
"//conditions:default": {"CMAKE": "$(execpath :cmake_tool)/bin/cmake"},
|
|
|
|
}),
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "$(execpath :cmake_tool)/bin/cmake.exe",
|
|
|
|
"//conditions:default": "$(execpath :cmake_tool)/bin/cmake",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
target = ":cmake_tool",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_ninja",
|
2022-03-14 14:06:22 +00:00
|
|
|
env = select({
|
|
|
|
"@platforms//os:windows": {"NINJA": "ninja.exe"},
|
|
|
|
"//conditions:default": {"NINJA": "ninja"},
|
|
|
|
}),
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "ninja.exe",
|
|
|
|
"//conditions:default": "ninja",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
ninja_tool(
|
|
|
|
name = "ninja_tool",
|
2021-03-15 17:17:59 +00:00
|
|
|
srcs = "@ninja_build_src//:all_srcs",
|
2021-02-16 15:41:58 +00:00
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_ninja",
|
2022-03-14 14:06:22 +00:00
|
|
|
env = select({
|
|
|
|
"@platforms//os:windows": {"NINJA": "$(execpath :ninja_tool)/bin/ninja.exe"},
|
|
|
|
"//conditions:default": {"NINJA": "$(execpath :ninja_tool)/bin/ninja"},
|
|
|
|
}),
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
2021-03-31 20:23:07 +00:00
|
|
|
"@platforms//os:windows": "$(execpath :ninja_tool)/bin/ninja.exe",
|
|
|
|
"//conditions:default": "$(execpath :ninja_tool)/bin/ninja",
|
2021-03-15 17:24:49 +00:00
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
target = ":ninja_tool",
|
2023-06-09 10:29:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_meson_toolchain",
|
|
|
|
toolchain = ":preinstalled_meson",
|
|
|
|
toolchain_type = ":meson_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_meson",
|
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "meson.exe",
|
|
|
|
"//conditions:default": "meson",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
meson_tool(
|
|
|
|
name = "meson_tool",
|
|
|
|
data = ["@meson_src//:runtime"],
|
|
|
|
main = "@meson_src//:meson.py",
|
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_meson",
|
|
|
|
env = {"MESON": "$(execpath :meson_tool)"},
|
|
|
|
path = "$(execpath :meson_tool)",
|
|
|
|
target = ":meson_tool",
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
|
|
|
|
2021-12-17 23:27:10 +00:00
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_autoconf_toolchain",
|
|
|
|
toolchain = ":preinstalled_autoconf",
|
|
|
|
toolchain_type = ":autoconf_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_autoconf",
|
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "autoconf.exe",
|
|
|
|
"//conditions:default": "autoconf",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_automake_toolchain",
|
|
|
|
toolchain = ":preinstalled_automake",
|
|
|
|
toolchain_type = ":automake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_automake",
|
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "automake.exe",
|
|
|
|
"//conditions:default": "automake",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_m4_toolchain",
|
|
|
|
toolchain = ":preinstalled_m4",
|
|
|
|
toolchain_type = ":m4_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_m4",
|
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "m4.exe",
|
|
|
|
"//conditions:default": "m4",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_pkgconfig_toolchain",
|
|
|
|
toolchain = ":preinstalled_pkgconfig",
|
|
|
|
toolchain_type = ":pkgconfig_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_pkgconfig",
|
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "pkg-config.exe",
|
|
|
|
"//conditions:default": "pkg-config",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2022-11-09 11:54:39 +00:00
|
|
|
pkgconfig_tool(
|
|
|
|
name = "pkgconfig_tool",
|
|
|
|
srcs = "@pkgconfig_src//:all_srcs",
|
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_pkgconfig",
|
|
|
|
env = select({
|
|
|
|
"@platforms//os:windows": {"PKG_CONFIG": "$(execpath :pkgconfig_tool)"},
|
|
|
|
"//conditions:default": {"PKG_CONFIG": "$(execpath :pkgconfig_tool)/bin/pkg-config"},
|
|
|
|
}),
|
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "$(execpath :pkgconfig_tool)",
|
|
|
|
"//conditions:default": "$(execpath :pkgconfig_tool)/bin/pkg-config",
|
|
|
|
}),
|
|
|
|
target = ":pkgconfig_tool",
|
|
|
|
)
|
|
|
|
|
2021-02-16 15:41:58 +00:00
|
|
|
bzl_library(
|
2023-12-21 10:42:09 +00:00
|
|
|
name = "built_toolchains",
|
|
|
|
srcs = ["built_toolchains.bzl"],
|
2021-03-11 16:52:36 +00:00
|
|
|
deps = [
|
2023-12-21 10:42:09 +00:00
|
|
|
"@bazel_tools//tools/build_defs/repo:http.bzl",
|
|
|
|
"@bazel_tools//tools/build_defs/repo:utils.bzl",
|
|
|
|
"@rules_foreign_cc//toolchains:cmake_versions",
|
2021-03-11 16:52:36 +00:00
|
|
|
],
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
2023-12-21 10:42:09 +00:00
|
|
|
|
|
|
|
bzl_library(
|
|
|
|
name = "prebuilt_toolchains",
|
|
|
|
srcs = ["prebuilt_toolchains.bzl"],
|
|
|
|
deps = [
|
|
|
|
"@bazel_tools//tools/build_defs/repo:http.bzl",
|
|
|
|
"@bazel_tools//tools/build_defs/repo:utils.bzl",
|
|
|
|
"@rules_foreign_cc//toolchains:prebuilt_toolchains_repository",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
bzl_library(
|
|
|
|
name = "toolchains",
|
|
|
|
srcs = ["toolchains.bzl"],
|
|
|
|
deps = [
|
|
|
|
":built_toolchains",
|
|
|
|
":prebuilt_toolchains",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
bzl_library(
|
|
|
|
name = "cmake_versions",
|
|
|
|
srcs = ["cmake_versions.bzl"],
|
|
|
|
)
|
|
|
|
|
|
|
|
bzl_library(
|
|
|
|
name = "prebuilt_toolchains_repository",
|
|
|
|
srcs = ["prebuilt_toolchains_repository.bzl"],
|
|
|
|
)
|