This eliminates the with_ipv6 FLAVOR in favor of a different approach. ipv6 support will be compiled into the default packages, however I have set preferIPv4Stack to default to true. The result should be no change for ipv4 users but would allow the use of ipv6 by setting some properties. Here's what I put in the DESCR:
NOTE: ipv4 to ipv6 address mapping is disabled on OpenBSD. This means the jdk can only use ipv4 addresses or ipv6 addresses but not both at the same time. By default ipv4 addresses are enabled. To use ipv6 addresses set the following properties when you start java: -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Stack=true -Djava.net.preferIPv6Addresses=true Testing that I have not broken ipv4 use cases would be greatly appreciated. Testing ipv6 works with the three properties would get bonus points. Thanks, -Kurt Index: Makefile =================================================================== RCS file: /cvs/ports/devel/jdk/1.8/Makefile,v retrieving revision 1.15 diff -u -p -u -p -r1.15 Makefile --- Makefile 23 Feb 2017 13:11:42 -0000 1.15 +++ Makefile 23 Feb 2017 18:26:37 -0000 @@ -12,7 +12,7 @@ PKGNAME= jdk-${V} PKGNAME-main= jdk-${V} PKGNAME-jre= jre-${V} EPOCH= 0 -REVISION= 0 +REVISION= 1 DIST_SUBDIR= jdk DISTNAME= openjdk-8u121b13-bsd-port-20170201 @@ -23,7 +23,6 @@ CATEGORIES= devel/jdk java MULTI_PACKAGES= -main -jre -FLAVORS= with_ipv6 PSEUDO_FLAVORS= native_bootstrap FLAVOR?= @@ -107,10 +106,6 @@ MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/commo # MAKE_FLAGS= LOG=debug MAKE_ENV= DEFAULT_LIBPATH="/usr/lib:${X11BASE}/lib:${LOCALBASE}/lib" \ COMPILER_WARNINGS_FATAL=false - -.if !${FLAVOR:Mwith_ipv6} -MAKE_ENV+= DONT_ENABLE_IPV6=yes -.endif JDKHOME= jdk-1.8.0 JREHOME= jre-1.8.0 Index: patches/patch-jdk_src_share_native_java_lang_System_c =================================================================== RCS file: patches/patch-jdk_src_share_native_java_lang_System_c diff -N patches/patch-jdk_src_share_native_java_lang_System_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-jdk_src_share_native_java_lang_System_c 23 Feb 2017 18:26:37 -0000 @@ -0,0 +1,14 @@ +$OpenBSD$ +--- jdk/src/share/native/java/lang/System.c.orig Wed Feb 1 16:16:31 2017 ++++ jdk/src/share/native/java/lang/System.c Thu Feb 23 11:54:01 2017 +@@ -300,6 +300,10 @@ Java_java_lang_System_initProperties(JNIEnv *env, jcla + } + #endif + ++#ifdef __OpenBSD__ ++ PUTPROP(props, "java.net.preferIPv4Stack", sprops->java_net_preferIPv4Stack); ++#endif ++ + /* !!! DO NOT call PUTPROP_ForPlatformNString before this line !!! + * !!! I18n properties have not been set up yet !!! + */ Index: patches/patch-jdk_src_share_native_java_lang_java_props_h =================================================================== RCS file: patches/patch-jdk_src_share_native_java_lang_java_props_h diff -N patches/patch-jdk_src_share_native_java_lang_java_props_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-jdk_src_share_native_java_lang_java_props_h 23 Feb 2017 18:26:37 -0000 @@ -0,0 +1,13 @@ +$OpenBSD$ +--- jdk/src/share/native/java/lang/java_props.h.orig Wed Feb 1 16:16:31 2017 ++++ jdk/src/share/native/java/lang/java_props.h Thu Feb 23 11:54:01 2017 +@@ -91,6 +91,9 @@ typedef struct { + + char *desktop; /* Desktop name. */ + ++#ifdef __OpenBSD__ ++ char *java_net_preferIPv4Stack; /* prefer IPv4 on OpenBSD. */ ++#endif + #ifdef MACOSX + // These are for proxy-related information. + // Note that if these platform-specific extensions get out of hand we should make a new Index: patches/patch-jdk_src_solaris_native_java_lang_java_props_md_c =================================================================== RCS file: patches/patch-jdk_src_solaris_native_java_lang_java_props_md_c diff -N patches/patch-jdk_src_solaris_native_java_lang_java_props_md_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-jdk_src_solaris_native_java_lang_java_props_md_c 23 Feb 2017 18:26:37 -0000 @@ -0,0 +1,14 @@ +$OpenBSD$ +--- jdk/src/solaris/native/java/lang/java_props_md.c.orig Wed Feb 1 16:16:32 2017 ++++ jdk/src/solaris/native/java/lang/java_props_md.c Thu Feb 23 11:54:01 2017 +@@ -471,6 +471,10 @@ GetJavaProperties(JNIEnv *env) + sprops.awt_toolkit = "sun.awt.X11.XToolkit"; + #endif + ++#ifdef __OpenBSD__ ++ sprops.java_net_preferIPv4Stack = "true"; ++#endif ++ + /* This is used only for debugging of font problems. */ + v = getenv("JAVA2D_FONTPATH"); + sprops.font_dir = v ? v : NULL; Index: pkg/DESCR-jre =================================================================== RCS file: /cvs/ports/devel/jdk/1.8/pkg/DESCR-jre,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 DESCR-jre --- pkg/DESCR-jre 17 Jun 2015 17:12:27 -0000 1.1.1.1 +++ pkg/DESCR-jre 23 Feb 2017 18:26:37 -0000 @@ -8,16 +8,17 @@ It is not a development environment and tools such as compilers and debuggers. For development tools, use the OpenJDK SDK, Standard Edition. +NOTE: +ipv4 to ipv6 address mapping is disabled on OpenBSD. This means the +jre can only use ipv4 addresses or ipv6 addresses but not both at +the same time. By default ipv4 addresses are enabled. To use ipv6 +addresses set the following properties when you start java: + +-Djava.net.preferIPv4Stack=false +-Djava.net.preferIPv6Stack=true +-Djava.net.preferIPv6Addresses=true + Flavors: native_bootstrap Bootstrap the jdk using a previously built and installed devel/jdk/1.8 package. - - with_ipv6 - Build the jdk/jre with ipv6 support. When the jdk/jre is built - with this flavor, java will create only ipv6 sockets by default. - Since ipv4 to ipv6 address mapping is disabled on OpenBSD, - using ipv4 addresses will fail. Consequently, you may only - use ipv6 addresses or you can start java with - -Djava.net.preferIPv4Stack=true and can only use ipv4 - addresses. Index: pkg/DESCR-main =================================================================== RCS file: /cvs/ports/devel/jdk/1.8/pkg/DESCR-main,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 DESCR-main --- pkg/DESCR-main 17 Jun 2015 17:12:27 -0000 1.1.1.1 +++ pkg/DESCR-main 23 Feb 2017 18:26:37 -0000 @@ -5,16 +5,17 @@ The OpenJDK SDK software includes tools testing programs written in the Java programming language and running on the Java platform. +NOTE: +ipv4 to ipv6 address mapping is disabled on OpenBSD. This means the +jdk can only use ipv4 addresses or ipv6 addresses but not both at +the same time. By default ipv4 addresses are enabled. To use ipv6 +addresses set the following properties when you start java: + +-Djava.net.preferIPv4Stack=false +-Djava.net.preferIPv6Stack=true +-Djava.net.preferIPv6Addresses=true + Flavors: native_bootstrap Bootstrap the jdk using a previously built and installed devel/jdk/1.8 package. - - with_ipv6 - Build the jdk/jre with ipv6 support. When the jdk/jre is built - with this flavor, java will create only ipv6 sockets by default. - Since ipv4 to ipv6 address mapping is disabled on OpenBSD, - using ipv4 addresses will fail. Consequently, you may only - use ipv6 addresses or you can start java with - -Djava.net.preferIPv4Stack=true and can only use ipv4 - addresses.