On Tue, 10 Mar 2026 19:24:33 GMT, Antonio Vieiro <[email protected]> wrote:

>> This basically allows configure to complete and set up a configuration 
>> suitable for building the BSD port for supported platforms (FreeBSD, OpenBSD 
>> and NetBSD.)
>> 
>> The flag `_BSDONLY_SOURCE` is defined for all the BSD's _except_ for Apple 
>> MacOS, while the existing `_ALLBSD_SOURCE` _includes_ Apple MacOS.
>> 
>> For the BSD's we set the `OPENJDK_TARGET_OS_ENV` variable to distinct values 
>> reflecting the BSD variant being built. This is used to distinguish build 
>> flags, library locations and what libraries and modules to include for the 
>> various builds.
>> 
>> As an example, FreeBSD includes the ALSA library, and should build the 
>> Serviceability Agent, while the other BSD's do not.
>> 
>> This work was sponsored by: The FreeBSD Foundation
>
> A happy FreeBSD user passed by, was delighted to see that this PR didn't 
> break any build on other platforms, that even the tests were passing on 
> those, and decided to give this a try on his system.
> 
> So he installed some stuff with `pkg install bash autoconf gmake zip alsa-lib 
> cups fontconfig openjdk25` 
> 
> And then ran the following command:
> 
> 
> $ bash configure --with-toolchain-type=clang 
> --with-alsa-include=/usr/local/include/alsa 
> --with-cups-include=/usr/local/include 
> --with-fontconfig-include=/usr/local/include
> 
> (Noting that `configure` was not executable)
> 
> To get the following output:
> 
> 
> FREEBSD:~/bsd-port $ bash configure --with-toolchain-type=clang 
> --with-alsa-include=/usr/local/include/alsa 
> --with-cups-include=/usr/local/include 
> --with-fontconfig-include=/usr/local/includ
> e
> configure: Configuration created at Tue Mar 10 20:12:50 CET 2026.
> checking for basename... /usr/bin/basename
> checking for dirname... /usr/bin/dirname
> checking for file... /usr/bin/file
> checking for ldd... /usr/bin/ldd
> checking for echo... echo [builtin]
> checking for tr... /usr/bin/tr
> checking for uname... /usr/bin/uname
> checking for wc... /usr/bin/wc
> checking for grep that handles long lines and -e... /usr/bin/grep
> checking for egrep... /usr/bin/grep -E
> checking for a sed that does not truncate output... /usr/bin/sed
> checking for locale... /usr/bin/locale
> checking for cygpath... [not found]
> checking for wslpath... [not found]
> checking for cmd.exe... [not found]
> checking for lsb_release... [not found]
> checking build system type... x86_64-unknown-freebsd15.0
> checking host system type... x86_64-unknown-freebsd15.0
> checking target system type... x86_64-unknown-freebsd15.0
> checking openjdk-build os-cpu... bsd-x86_64
> ...[blah, stripped for brevity]
> ====================================================
> A new configuration has been successfully created in
> /home/antonio/bsd-port/build/bsd-x86_64-server-release
> using configure arguments '--with-toolchain-type=clang 
> --with-alsa-include=/usr/local/include/alsa 
> --with-cups-include=/usr/local/include 
> --with-fontconfig-include=/usr/local/include'.
> 
> Configuration summary:
> * Name:           bsd-x86_64-server-release
> * Debug level:    release
> * HS debug level: product
> * JVM variants:   server
> * JVM features:   server: 'cds compiler1 compiler2 dtrace epsilongc g1gc jfr 
> jni-check jvmci jvmti management parallelgc serialgc services shenandoahgc 
> vm-structs' 
> * OpenJDK target: OS: bsd, CPU architecture: x86, address length: 64
> * Version string: 27-internal-...

@vieiro Thanks for verifying that the configuration passes :) 

And you're right, this is just the first step, so in itself not enough to build 
for FreeBSD yet. You will find a complete port for the current mainline in the 
[battleblow/jdk](https://github.com/battleblow/jdk/) repo. By now this passes 
all tier1 tests on AMD64, and all but one on Aarch64. (Except for a handful 
more if running on ZFS, as ZFS is not (yet?) able to give the guarantees 
required by `posix_fallocate(3)`.

We also do have OpenJDK for FreeBSD in the ports tree and in pkg. Up to and 
including the latest OpenJDK 25.

-------------

PR Comment: https://git.openjdk.org/bsd-port/pull/4#issuecomment-4037951503

Reply via email to