From 647927c9e3cbb888ff5606558446537d3e454663 Mon Sep 17 00:00:00 2001 From: Showta Ishizaki Date: Fri, 11 Sep 2026 08:09:24 +0900 Subject: [PATCH] Add jni_md_header for NetBSD and DragonFly BSD The :jni pulls the machine-dependent jni_md.h out of the JDK per host, with a java_runtime_files target and a select arm for each platform. FreeBSD and OpenBSD are there; add NetBSD and DragonFly, whose JDKs ship include/netbsd/jni_md.h and include/dragonfly/jni_md.h just as the others do, so that bazel's native code builds against the right header when it is bootstrapped on those hosts. The @bazel_tools//src/conditions:netbsd and :dragonfly settings this selects on are added to Bazel itself in a companion change; os:dragonfly comes from bazelbuild/platforms#143. --- toolchains/BUILD | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/toolchains/BUILD b/toolchains/BUILD index 920ae5f1..b188d2d8 100644 --- a/toolchains/BUILD +++ b/toolchains/BUILD @@ -129,6 +129,16 @@ java_runtime_files( srcs = ["include/openbsd/jni_md.h"], ) +java_runtime_files( + name = "jni_md_header-dragonfly", + srcs = ["include/dragonfly/jni_md.h"], +) + +java_runtime_files( + name = "jni_md_header-netbsd", + srcs = ["include/netbsd/jni_md.h"], +) + # The Java native interface. Depend on this package if you #include . # # See test_jni in third_party/bazel/src/test/shell/bazel/bazel_java_test.sh for @@ -139,6 +149,8 @@ cc_library( "@bazel_tools//src/conditions:darwin": [":jni_md_header-darwin"], "@bazel_tools//src/conditions:freebsd": [":jni_md_header-freebsd"], "@bazel_tools//src/conditions:linux": [":jni_md_header-linux"], + "@bazel_tools//src/conditions:netbsd": [":jni_md_header-netbsd"], + "@bazel_tools//src/conditions:dragonfly": [":jni_md_header-dragonfly"], "@bazel_tools//src/conditions:openbsd": [":jni_md_header-openbsd"], "@bazel_tools//src/conditions:windows": [":jni_md_header-windows"], "//conditions:default": [], @@ -147,6 +159,8 @@ cc_library( "@bazel_tools//src/conditions:darwin": ["include/darwin"], "@bazel_tools//src/conditions:freebsd": ["include/freebsd"], "@bazel_tools//src/conditions:linux": ["include/linux"], + "@bazel_tools//src/conditions:netbsd": ["include/netbsd"], + "@bazel_tools//src/conditions:dragonfly": ["include/dragonfly"], "@bazel_tools//src/conditions:openbsd": ["include/openbsd"], "@bazel_tools//src/conditions:windows": ["include/win32"], "//conditions:default": [],