zeek | 782120c | 2022-03-22 21:22:19 +0800 | [diff] [blame] | 1 | load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair") |
| 2 | |
Matthias Maennich | b7b30f4 | 2021-05-21 14:10:52 +0100 | [diff] [blame] | 3 | package(default_visibility = ["//visibility:public"]) |
| 4 | |
| 5 | [filegroup( |
| 6 | name = platform, |
| 7 | srcs = glob([ |
| 8 | "common/**", |
| 9 | "%s/bin/*" % platform, |
| 10 | "%s/lib64/*" % platform, |
Yifan Hong | 3cf2f9e | 2022-04-27 16:02:50 -0700 | [diff] [blame] | 11 | "path/%s/*" % platform, |
Matthias Maennich | b7b30f4 | 2021-05-21 14:10:52 +0100 | [diff] [blame] | 12 | ]), |
| 13 | ) for platform in ("linux-x86", "darwin")] |
Jingwen Chen | 1977a48 | 2022-01-13 14:41:41 +0000 | [diff] [blame] | 14 | |
zeek | 782120c | 2022-03-22 21:22:19 +0800 | [diff] [blame] | 15 | py_runtime( |
| 16 | name = "python2", |
| 17 | files = ["linux-x86/bin/py2-cmd"], |
| 18 | interpreter = "linux-x86/bin/py2-cmd", |
| 19 | python_version = "PY2", |
| 20 | ) |
Jingwen Chen | 1977a48 | 2022-01-13 14:41:41 +0000 | [diff] [blame] | 21 | |
Jingwen Chen | 1977a48 | 2022-01-13 14:41:41 +0000 | [diff] [blame] | 22 | py_runtime( |
| 23 | name = "python3", |
| 24 | files = ["linux-x86/bin/py3-cmd"], |
| 25 | interpreter = "linux-x86/bin/py3-cmd", |
| 26 | python_version = "PY3", |
| 27 | ) |
zeek | 782120c | 2022-03-22 21:22:19 +0800 | [diff] [blame] | 28 | |
| 29 | py_runtime_pair( |
| 30 | name = "py_runtime_pair", |
| 31 | py2_runtime = ":python2", |
| 32 | py3_runtime = ":python3", |
| 33 | ) |
| 34 | |
| 35 | toolchain( |
| 36 | name = "py_toolchain", |
| 37 | toolchain = ":py_runtime_pair", |
| 38 | toolchain_type = "@bazel_tools//tools/python:toolchain_type", |
| 39 | ) |
Trevor Radcliffe | 96821e7 | 2022-04-14 22:11:15 +0000 | [diff] [blame] | 40 | |
| 41 | sh_binary( |
| 42 | name = "flex", |
| 43 | srcs = select({ |
| 44 | "//build/bazel/platforms/os:darwin": ["darwin-x86/bin/flex"], |
| 45 | "//build/bazel/platforms/os:linux": ["linux-x86/bin/flex"], |
| 46 | "//build/bazel/platforms/os_arch:linux_musl_x86": ["linux_musl-x86/bin/flex"], |
Sam Delmerico | eea3b93 | 2022-11-18 10:57:02 -0500 | [diff] [blame] | 47 | }), |
| 48 | target_compatible_with = select({ |
| 49 | "//build/bazel/platforms/os:darwin": [], |
| 50 | "//build/bazel/platforms/os:linux": [], |
| 51 | "//build/bazel/platforms/os_arch:linux_musl_x86": [], |
| 52 | "//conditions:default": ["@platforms//:incompatible"], |
| 53 | }), |
Trevor Radcliffe | 96821e7 | 2022-04-14 22:11:15 +0000 | [diff] [blame] | 54 | ) |
| 55 | |
| 56 | sh_binary( |
| 57 | name = "m4", |
| 58 | srcs = select({ |
| 59 | "//build/bazel/platforms/os:darwin": ["darwin-x86/bin/m4"], |
| 60 | "//build/bazel/platforms/os:linux": ["linux-x86/bin/m4"], |
| 61 | "//build/bazel/platforms/os_arch:linux_musl_x86": ["linux_musl-x86/bin/m4"], |
Sam Delmerico | eea3b93 | 2022-11-18 10:57:02 -0500 | [diff] [blame] | 62 | }), |
| 63 | target_compatible_with = select({ |
| 64 | "//build/bazel/platforms/os:darwin": [], |
| 65 | "//build/bazel/platforms/os:linux": [], |
| 66 | "//build/bazel/platforms/os_arch:linux_musl_x86": [], |
| 67 | "//conditions:default": ["@platforms//:incompatible"], |
| 68 | }), |
Trevor Radcliffe | 96821e7 | 2022-04-14 22:11:15 +0000 | [diff] [blame] | 69 | ) |
Spandan Das | d5b4f78 | 2023-05-10 02:05:21 +0000 | [diff] [blame] | 70 | |
| 71 | sh_binary( |
| 72 | name = "bison", |
| 73 | srcs = select({ |
| 74 | "//build/bazel/platforms/os:darwin": ["darwin-x86/bin/bison"], |
| 75 | "//build/bazel/platforms/os:linux": ["linux-x86/bin/bison"], |
| 76 | "//build/bazel/platforms/os_arch:linux_musl_x86": ["linux_musl-x86/bin/bison"], |
| 77 | }), |
| 78 | target_compatible_with = select({ |
| 79 | "//build/bazel/platforms/os:darwin": [], |
| 80 | "//build/bazel/platforms/os:linux": [], |
| 81 | "//build/bazel/platforms/os_arch:linux_musl_x86": [], |
| 82 | "//conditions:default": ["@platforms//:incompatible"], |
| 83 | }), |
| 84 | ) |
| 85 | |
| 86 | # Additional runfiles required by bison |
| 87 | filegroup( |
| 88 | name = "bison.runfiles", |
| 89 | srcs = glob([ |
| 90 | "common/bison/**", |
| 91 | ]), |
| 92 | ) |