My diffs on some of the common/autoconf/*.m4 files for OpenBSD

Bryan C. Everly bryan at bceassociates.com
Thu May 14 18:05:10 UTC 2015


Hi all,

My OCA was approved and I'd like to propose some diffs to build autoconf
files that helped me get pretty far in building jdk8.  I'm not sure what
the official process is but I'll throw them below in this email and
hopefully someone can point me to the right way to submit diffs for the
project.

For common/autoconf/platform.m4, I created a new variable called
OPENJDK_TARGET_OS_VENDOR for OpenBSD:

diff -r 36cd3cebf1de common/autoconf/platform.m4
--- a/common/autoconf/platform.m4 Tue May 05 18:06:47 2015 -0700
+++ b/common/autoconf/platform.m4 Thu May 14 14:00:29 2015 -0400
@@ -141,6 +141,12 @@
       AC_MSG_ERROR([unsupported operating system $1])
       ;;
   esac
+  # Check to see if this is OpenBSD and set a VAR_OS_VENDOR if it is
+  case "$1" in
+    *openbsd*)
+      VAR_OS_VENDOR=openbsd
+    ;;
+  esac
 ])

 # Expects $host_os $host_cpu $build_os and $build_cpu
@@ -186,6 +192,7 @@
   PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
   # ... and setup our own variables. (Do this explicitely to facilitate
searching)
   OPENJDK_TARGET_OS="$VAR_OS"
+  OPENJDK_TARGET_OS_VENDOR="$VAR_OS_VENDOR"
   OPENJDK_TARGET_OS_API="$VAR_OS_API"
   OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
   OPENJDK_TARGET_CPU="$VAR_CPU"
@@ -193,6 +200,7 @@
   OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
   OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
   AC_SUBST(OPENJDK_TARGET_OS)
+  AC_SUBST(OPENJDK_TARGET_OS_VENDOR)
   AC_SUBST(OPENJDK_TARGET_OS_API)
   AC_SUBST(OPENJDK_TARGET_CPU)
   AC_SUBST(OPENJDK_TARGET_CPU_ARCH)

For common/autoconf/toolchain.m4, I use this new variable to add the
location for some OpenBSD includes and libraries in as compiler and linker
flags:

diff -r 36cd3cebf1de common/autoconf/toolchain.m4
--- a/common/autoconf/toolchain.m4 Tue May 05 18:06:47 2015 -0700
+++ b/common/autoconf/toolchain.m4 Thu May 14 14:02:05 2015 -0400
@@ -560,6 +560,10 @@
     if test "x$OPENJDK_TARGET_OS" = xbsd || test "x$OPENJDK_TARGET_OS" =
xmacosx; then
       SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
     fi
+    if test "x$OPEN_JDK_TARGET_OS_VENDOR" = xopenbsd; then
+      CFLAGS_JDK="${CFLAGS_JDK} -I/usr/local/include"
+      LDFLAGS_JDK="-L/usr/local/lib"
+    fi
   else
     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
       # If it is not gcc, then assume it is the Oracle Solaris Studio
Compiler

For common/autoconf/libraries.m4, I also use this new variable to turn off
both ALSA and PULSE (just for OpenBSD).  I also add a test for how to find
the header files for CUPS:

diff -r 36cd3cebf1de common/autoconf/libraries.m4
--- a/common/autoconf/libraries.m4 Tue May 05 18:06:47 2015 -0700
+++ b/common/autoconf/libraries.m4 Thu May 14 14:03:09 2015 -0400
@@ -72,8 +72,14 @@

   if test "x$OPENJDK_TARGET_OS" = xbsd; then
     AC_MSG_CHECKING([what is not needed on BSD?])
-    PULSE_NOT_NEEDED=yes
-    AC_MSG_RESULT([pulse])
+    if test "x$OPENJDK_TARGET_OS_VENDOR" = xopenbsd; then
+      ALSA_NOT_NEEDED=yes
+      PULSE_NOT_NEEDED=yes
+      AC_MSG_RESULT([alsa pulse])
+    else
+      PULSE_NOT_NEEDED=yes
+      AC_MSG_RESULT([pulse])
+    fi
   fi

   if test "x$OPENJDK" = "xfalse"; then
@@ -249,6 +255,10 @@
         # A CSW package seems to be installed!
         CUPS_FOUND=yes
         CUPS_CFLAGS="-I/opt/csw/include"
+      elif test -s /usr/local/include/cups/cups.h; then
+        # Standard location for OpenBSD
+        CUPS_FOUND=yes
+        CUPS_CFLAGS="-I/usr/local/include"
       fi
       AC_MSG_RESULT([$CUPS_FOUND])
     fi

Thanks to everyone who helped get me this far.  Essentially, you apply the
diffs, run autoconf in the common/autoconf directory, rerun sh ./configure
in the root of the project, do a make clean and a make and you'll get to
where I did.

Just as an FYI, I am running OpenBSD 5.7 (latest version) and tracking
STABLE.

Thanks,
Bryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/bsd-port-dev/attachments/20150514/cbfb6b88/attachment.html>


More information about the bsd-port-dev mailing list