Repository navigation
Conversation
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD and DragonFly BSD, so that a bazel built
from source with scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and DRAGONFLY and counts them POSIX-compatible;
AutoCpuConverter, ConfigExpander, ConstraintConstants, JniLoader and
BazelRuleClassProvider gain the matching arms (default shell, PATH,
the @platforms//os constraint, the libunix_jni.so load).
- src/conditions gains netbsd and dragonfly config_settings, used by the
C++ client, the native JNI library, singlejar and the sandbox stub to
pick the BSD sources the way freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; neither NetBSD nor
DragonFly offers a way for a process to find its own executable, so both
fall back to argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual
JDK location on each.
- unix_jni_bsd.cc: DragonFly's libc defines only the _file extattr
variants, not the _link ones called here, so HAVE_EXTATTR stays off
there; sysctlbyname(3) is present. NetBSD leaves both off for now.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid.
- md5.h, singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: both are
<sys/endian.h> / err.h platforms like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
DragonFly's config_settings reference @platforms//os:dragonfly, which is
added by bazelbuild/platforms#143; until that is released the DragonFly
selects will not resolve on other platforms. NetBSD needs nothing new
from platforms (os:netbsd already exists). The jni_md_header targets come
from a companion rules_java change (bazelbuild/rules_java#381).
Bootstrapped from source and run on NetBSD 11.0/amd64. Also bootstrapped
and run on DragonFly 6.4 with platforms#143 applied, on which the whole
abseil test suite passes; that host is no longer available to re-verify
the exact form of this change.
single_version_override で当てている四枚は、どれも upstream へ出してある。 名前が platforms_netbsd.patch のままだと、その PR が入ったかどうかが名前から 引けず、マージされた後も抱え続けることになる。番号を名前にすると、当てる 先が直った瞬間に当て物が当たらなくなって build が止まるので、そこで気づける。 platforms-pr142-pr143 bazelbuild/platforms#142 と #143 rules_java-pr381 bazelbuild/rules_java#381 rules_go-pr4711 bazel-contrib/rules_go#4711 (9/9 merged) zstd_jni-netbsd upstream に出していない rules_go#4711 は master に入っているが、最新の release は v0.63.0 (8/16) で まだ含まれていない。ここは 0.59.0 を pin しているので、版を上げられるように なったら当て物ごと落とせる。 名前は MODULE.bazel と toolchain_local/BUILD の exports_files の二箇所で 効くので、両方を書き換えた。どの PR がどれかは BUILD のコメントに置いた。 当て物の本体には書いていない。bazel の patch 実装が先頭の地の文を読み飛ばす かを確かめていないので、賭けないことにした。
|
Unless we cherrypick bazelbuild/bazel#31069 to all supported Bazel versions, this will break everyone using this target with a If you'd like to get this in sooner, we should to update to a |
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar and the sandbox stub to pick the BSD
sources the way freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64.
The :jni target 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, whose JDK ships include/netbsd/jni_md.h just as the others do, so that Bazel's native code builds against the right header when it is bootstrapped there. The config_setting is defined here rather than taken from @bazel_tools//src/conditions, so that it resolves with every Bazel version rather than only those carrying bazelbuild/bazel#31069. @platforms//os:netbsd has been in the platforms module since 0.0.11, which this module already depends on. DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms release yet (bazelbuild/platforms#143), so it will follow in a separate change.
647927c to
0231dcb
Compare
|
Right -- dropped the @bazel_tools//src/conditions reference. The DragonFly is out of this PR for now, since @platforms//os:dragonfly |
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- package-bazel.sh keeps a #!/bin/bash line that has to be rewritten;
NetBSD has neither /bin/bash nor the /usr/local/bin/bash the other BSDs
use, since pkgsrc installs it as /usr/pkg/bin/bash.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The select arms
above have not been exercised end to end: until this change is in, host
detection does not put @platforms//os:netbsd on the autodetected platform,
so a config_setting on it resolves to the default arm.
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- process-wrapper-legacy.cc: the child-subreaper cleanup calls
TerminateAndWaitForAll, which only process-tools-linux.cc defines, so the
guard that already excludes Darwin and OpenBSD has to exclude NetBSD too.
- package-bazel.sh keeps a #!/bin/bash line that has to be rewritten;
NetBSD has neither /bin/bash nor the /usr/local/bin/bash the other BSDs
use, since pkgsrc installs it as /usr/pkg/bin/bash.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The C++ targets
the selects route were then built and run there with a platform carrying
@platforms//os:netbsd, which is what this change puts on the autodetected
one: process-wrapper passes an exit code through, times out on schedule,
and cleans up a child that escaped the process group -- the last of those
is the KERN_PROC2 path above.
Bazel's own Java does not build on NetBSD yet, for a reason outside this
change: BUILD pins the java toolchain to remotejdk_25 and .bazelrc asks
for language version 25, while pkgsrc stops at openjdk21, so javac says
"invalid source release: 25". That is what scripts/bootstrap is for.
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- unix_jni.h: the stat64 selection is written as the list of platforms that
do not have it, and NetBSD would be the fourth name on that list. What
the condition means is "is this glibc", so it says that instead. glibc
keeps the 64-bit struct stat under its own name; everything else this is
built against -- macOS, the BSDs, musl -- has had a 64-bit off_t in
struct stat all along, and musl 1.2.4 dropped the stat64 aliases
altogether, so this also fixes the build against musl.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- process-wrapper-legacy.cc: the child-subreaper cleanup calls
TerminateAndWaitForAll, which only process-tools-linux.cc defines, so the
guard that already excludes Darwin and OpenBSD has to exclude NetBSD too.
- package-bazel.sh keeps a #!/bin/bash line that has to be rewritten;
NetBSD has neither /bin/bash nor the /usr/local/bin/bash the other BSDs
use, since pkgsrc installs it as /usr/pkg/bin/bash.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The C++ targets
the selects route were then built and run there with a platform carrying
@platforms//os:netbsd, which is what this change puts on the autodetected
one: process-wrapper passes an exit code through, times out on schedule,
and cleans up a child that escaped the process group -- the last of those
is the KERN_PROC2 path above.
Bazel's own Java does not build on NetBSD yet, for a reason outside this
change: BUILD pins the java toolchain to remotejdk_25 and .bazelrc asks
for language version 25, while pkgsrc stops at openjdk21, so javac says
"invalid source release: 25". That is what scripts/bootstrap is for.
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- unix_jni.h: the stat64 selection is written as the list of platforms that
do not have it, and NetBSD would be the fourth name on that list. What
the condition means is "is this glibc", so it says that instead. glibc
keeps the 64-bit struct stat under its own name; everything else this is
built against -- macOS, the BSDs, musl -- has had a 64-bit off_t in
struct stat all along, and musl 1.2.4 dropped the stat64 aliases
altogether, so this also fixes the build against musl.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- process-wrapper-legacy.cc: the child-subreaper cleanup calls
TerminateAndWaitForAll, which only process-tools-linux.cc defines, so the
guard that already excludes Darwin and OpenBSD has to exclude NetBSD too.
- package-bazel.sh keeps a #!/bin/bash line that has to be rewritten;
NetBSD has neither /bin/bash nor the /usr/local/bin/bash the other BSDs
use, since pkgsrc installs it as /usr/pkg/bin/bash.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The C++ targets
the selects route were then built and run there with a platform carrying
@platforms//os:netbsd, which is what this change puts on the autodetected
one: process-wrapper passes an exit code through, times out on schedule,
and cleans up a child that escaped the process group -- the last of those
is the KERN_PROC2 path above.
Bazel's own Java does not build on NetBSD yet, for a reason outside this
change: BUILD pins the java toolchain to remotejdk_25 and .bazelrc asks
for language version 25, while pkgsrc stops at openjdk21, so javac says
"invalid source release: 25". That is what scripts/bootstrap is for.
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do. BUILD.tools, the copy of that file which
ships inside the bazel binary, gains the same setting: it already
carries freebsd and openbsd, and without netbsd the selects in the
embedded tools fall through to their linux defaults.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- unix_jni.h: the stat64 selection is written as the list of platforms that
do not have it, and NetBSD would be the fourth name on that list. What
the condition means is "is this glibc", so it says that instead. glibc
keeps the 64-bit struct stat under its own name; everything else this is
built against -- macOS, the BSDs, musl -- has had a 64-bit off_t in
struct stat all along, and musl 1.2.4 dropped the stat64 aliases
altogether, so this also fixes the build against musl.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- process-wrapper-legacy.cc: the child-subreaper cleanup calls
TerminateAndWaitForAll, which only process-tools-linux.cc defines, so the
guard that already excludes Darwin and OpenBSD has to exclude NetBSD too.
- package-bazel.sh keeps a #!/bin/bash line that has to be rewritten;
NetBSD has neither /bin/bash nor the /usr/local/bin/bash the other BSDs
use, since pkgsrc installs it as /usr/pkg/bin/bash.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The C++ targets
the selects route were then built and run there with a platform carrying
@platforms//os:netbsd, which is what this change puts on the autodetected
one: process-wrapper passes an exit code through, times out on schedule,
and cleans up a child that escaped the process group -- the last of those
is the KERN_PROC2 path above.
Bazel's own Java does not build on NetBSD yet, for a reason outside this
change: BUILD pins the java toolchain to remotejdk_25 and .bazelrc asks
for language version 25, while pkgsrc stops at openjdk21, so javac says
"invalid source release: 25". That is what scripts/bootstrap is for.
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do. BUILD.tools, the copy of that file which
ships inside the bazel binary, gains the same setting: it already
carries freebsd and openbsd, and without netbsd the selects in the
embedded tools fall through to their linux defaults.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- unix_jni.h: the stat64 selection is written as the list of platforms that
do not have it, and NetBSD would be the fourth name on that list. What
the condition means is "is this glibc", so it says that instead. glibc
keeps the 64-bit struct stat under its own name; everything else this is
built against -- macOS, the BSDs, musl -- has had a 64-bit off_t in
struct stat all along, and musl 1.2.4 dropped the stat64 aliases
altogether, so this also fixes the build against musl.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- process-wrapper-legacy.cc: the child-subreaper cleanup calls
TerminateAndWaitForAll, which only process-tools-linux.cc defines, so the
guard that already excludes Darwin and OpenBSD has to exclude NetBSD too.
- package-bazel.sh keeps a #!/bin/bash line that has to be rewritten;
NetBSD has neither /bin/bash nor the /usr/local/bin/bash the other BSDs
use, since pkgsrc installs it as /usr/pkg/bin/bash.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The C++ targets
the selects route were then built and run there with a platform carrying
@platforms//os:netbsd, which is what this change puts on the autodetected
one: process-wrapper passes an exit code through, times out on schedule,
and cleans up a child that escaped the process group -- the last of those
is the KERN_PROC2 path above.
Bazel's own Java does not build on NetBSD yet, for a reason outside this
change: BUILD pins the java toolchain to remotejdk_25 and .bazelrc asks
for language version 25, while pkgsrc stops at openjdk21, so javac says
"invalid source release: 25". That is what scripts/bootstrap is for.
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- unix_jni.h: the stat64 selection is written as the list of platforms that
do not have it, and NetBSD would be the fourth name on that list. What
the condition means is "is this glibc", so it says that instead. glibc
keeps the 64-bit struct stat under its own name; everything else this is
built against -- macOS, the BSDs, musl -- has had a 64-bit off_t in
struct stat all along, and musl 1.2.4 dropped the stat64 aliases
altogether, so this also fixes the build against musl.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- process-wrapper-legacy.cc: the child-subreaper cleanup calls
TerminateAndWaitForAll, which only process-tools-linux.cc defines, so the
guard that already excludes Darwin and OpenBSD has to exclude NetBSD too.
- package-bazel.sh keeps a #!/bin/bash line that has to be rewritten;
NetBSD has neither /bin/bash nor the /usr/local/bin/bash the other BSDs
use, since pkgsrc installs it as /usr/pkg/bin/bash.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The C++ targets
the selects route were then built and run there with a platform carrying
@platforms//os:netbsd, which is what this change puts on the autodetected
one: process-wrapper passes an exit code through, times out on schedule,
and cleans up a child that escaped the process group -- the last of those
is the KERN_PROC2 path above.
Bazel's own Java does not build on NetBSD yet, for a reason outside this
change: BUILD pins the java toolchain to remotejdk_25 and .bazelrc asks
for language version 25, while pkgsrc stops at openjdk21, so javac says
"invalid source release: 25". That is what scripts/bootstrap is for.
Bazel already builds and runs on FreeBSD and OpenBSD; this extends the
same host support to NetBSD, so that a bazel built from source with
scripts/bootstrap runs natively there.
The changes are the same shape as the existing FreeBSD/OpenBSD ones:
- OS.java learns NETBSD and counts it POSIX-compatible; AutoCpuConverter,
ConfigExpander, ConstraintConstants, JniLoader and BazelRuleClassProvider
gain the matching arms (default shell, PATH, the @platforms//os
constraint, the libunix_jni.so load).
- src/conditions gains a netbsd config_setting, used by the C++ client,
the native JNI library, singlejar, process-tools, the sandbox stub and
the packaging rules to pick the BSD sources and settings the way
freebsd/openbsd already do.
- blaze_util_bsd.cc: NetBSD dropped statfs(2), so WarnFilesystemType uses
statvfs(2), which carries f_fstypename all the same; NetBSD offers no
way for a process to find its own executable, so it falls back to
argv[0] like OpenBSD. STANDARD_JAVABASE points at the usual JDK
location.
- unix_jni.h: the stat64 selection is written as the list of platforms that
do not have it, and NetBSD would be the fourth name on that list. What
the condition means is "is this glibc", so it says that instead. glibc
keeps the 64-bit struct stat under its own name; everything else this is
built against -- macOS, the BSDs, musl -- has had a 64-bit off_t in
struct stat all along, and musl 1.2.4 dropped the stat64 aliases
altogether, so this also fixes the build against musl.
- process-tools-darwin.cc: NetBSD exposes process listings through
KERN_PROC2 and struct kinfo_proc2, whose pid is in p_pid. The linux
variant is not usable here: it reads /proc/thread-self/children, which
NetBSD does not have.
- process-wrapper-legacy.cc: the child-subreaper cleanup calls
TerminateAndWaitForAll, which only process-tools-linux.cc defines, so the
guard that already excludes Darwin and OpenBSD has to exclude NetBSD too.
- md5.h and singlejar/{diag.h,zip_headers.h,mapped_file_posix.inc}: NetBSD
is a <sys/endian.h> / err.h platform like the other BSDs.
- md5_netbsd.sh doubles md5(1) the way md5_openbsd.sh does, since NetBSD
has neither md5sum nor GNU coreutils.
The jni_md_header target comes from a companion rules_java change
(bazelbuild/rules_java#381).
DragonFly BSD needs @platforms//os:dragonfly, which is not in a platforms
release yet (bazelbuild/platforms#143), so it will follow in a separate
change once that lands.
Bootstrapped from source and run on NetBSD 11.0/amd64. The C++ targets
the selects route were then built and run there with a platform carrying
@platforms//os:netbsd, which is what this change puts on the autodetected
one: process-wrapper passes an exit code through, times out on schedule,
and cleans up a child that escaped the process group -- the last of those
is the KERN_PROC2 path above.
Bazel's own Java does not build on NetBSD yet, for a reason outside this
change: BUILD pins the java toolchain to remotejdk_25 and .bazelrc asks
for language version 25, while pkgsrc stops at openjdk21, so javac says
"invalid source release: 25". That is what scripts/bootstrap is for.
The :jni target 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, whose JDK ships
include/netbsd/jni_md.h just as the others do, so that Bazel's native
code builds against the right header when it is bootstrapped there.
The config_setting is defined here rather than taken from
@bazel_tools//src/conditions, so that it resolves with every Bazel
version rather than only those carrying bazelbuild/bazel#31069.
@platforms//os:netbsd has been in the platforms module since 0.0.11,
which this module already depends on.
DragonFly BSD needs @platforms//os:dragonfly, which is not in a
platforms release yet (bazelbuild/platforms#143), so it will follow in a
separate change.