rules_foreign_cc/examples/third_party/bison/BUILD.bison.bazel

45 lines
1.0 KiB
Plaintext
Raw Normal View History

load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
package(default_visibility = ["//visibility:public"])
filegroup(
name = "all_srcs",
srcs = glob(
include = ["**"],
exclude = ["*.bazel"],
),
)
# I tested and this builds for me on macOS and Linux, did not check Windows
configure_make(
name = "bison",
build_data = [
"@m4",
],
env = select({
"@platforms//os:linux": {
"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4",
},
"@platforms//os:macos": {
"AR": "",
"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4",
},
"//conditions:default": {},
}),
lib_source = ":all_srcs",
out_binaries = [
"bison",
"yacc",
],
# Bison depends on m4sugar.m4 in the "share" directory at runtime
out_data_dirs = ["share"],
out_static_libs = ["liby.a"],
)
filegroup(
name = "gen_dir",
srcs = [":bison"],
output_group = "gen_dir",
visibility = ["//visibility:public"],
)