New patch from Andrew Luo JDK-8215445-branch
authorerikj
Mon, 17 Dec 2018 09:35:15 -0800
branchJDK-8215445-branch
changeset 57075 168830ded68a
parent 57074 12615de8335e
child 57081 a55844323727
New patch from Andrew Luo 1. Got rid of EXECUTABLE_SUFFIX in favor of EXE_SUFFIX, which had to move earlier in the sequence 2. Use instead of .exe literal per Magnus' feedback 3. Added information about WSL versioning to build, similar to Cygwin 4. Updated building.md and building.html with WSL build instructions
doc/building.html
doc/building.md
make/autoconf/basics.m4
make/autoconf/basics_windows.m4
make/autoconf/boot-jdk.m4
make/autoconf/spec.gmk.in
make/autoconf/toolchain.m4
--- a/doc/building.html	Fri Dec 14 17:12:14 2018 -0800
+++ b/doc/building.html	Mon Dec 17 09:35:15 2018 -0800
@@ -145,7 +145,7 @@
 <li><p>Do not check out the source code in a path which contains spaces. Chances are the build will not work. This is most likely to be an issue on Windows systems.</p></li>
 <li><p>Do not check out the source code in a path which has a very long name or is nested many levels deep. Chances are you will hit an OS limitation during the build.</p></li>
 <li><p>Put the source code on a local disk, not a network share. If possible, use an SSD. The build process is very disk intensive, and having slow disk access will significantly increase build times. If you need to use a network share for the source code, see below for suggestions on how to keep the build artifacts on a local disk.</p></li>
-<li><p>On Windows, extra care must be taken to make sure the <a href="#cygwin">Cygwin</a> environment is consistent. It is recommended that you follow this procedure:</p>
+<li><p>On Windows, if using <a href="#cygwin">Cygwin</a>, extra care must be taken to make sure the environment is consistent. It is recommended that you follow this procedure:</p>
 <ul>
 <li><p>Create the directory that is going to contain the top directory of the JDK clone by using the <code>mkdir</code> command in the Cygwin bash shell. That is, do <em>not</em> create it using Windows Explorer. This will ensure that it will have proper Cygwin attributes, and that it's children will inherit those attributes.</p></li>
 <li><p>Do not put the JDK clone in a path under your Cygwin home directory. This is especially important if your user name contains spaces and/or mixed upper and lower case letters.</p></li>
@@ -201,8 +201,11 @@
 <h3 id="windows">Windows</h3>
 <p>Windows XP is not a supported platform, but all newer Windows should be able to build the JDK.</p>
 <p>On Windows, it is important that you pay attention to the instructions in the <a href="#special-considerations">Special Considerations</a>.</p>
-<p>Windows is the only non-POSIX OS supported by the JDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. Currently, the only supported such layer is Cygwin. (Msys is no longer supported due to a too old bash; msys2 and the new Windows Subsystem for Linux (WSL) would likely be possible to support in a future version but that would require effort to implement.)</p>
+<p>Windows is the only non-POSIX OS supported by the JDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. Currently, the only supported such layers are Windows Subsystem for Linux (WSL) and Cygwin. (Msys is no longer supported due to a too old bash; msys2 would likely be possible to support in a future version but that would require effort to implement.)</p>
 <p>Internally in the build system, all paths are represented as Unix-style paths, e.g. <code>/cygdrive/c/hg/jdk9/Makefile</code> rather than <code>C:\hg\jdk9\Makefile</code>. This rule also applies to input to the build system, e.g. in arguments to <code>configure</code>. So, use <code>--with-msvcr-dll=/cygdrive/c/msvcr100.dll</code> rather than <code>--with-msvcr-dll=c:\msvcr100.dll</code>. For details on this conversion, see the section on <a href="#fixpath">Fixpath</a>.</p>
+<h4 id="windows-subsystem-for-linux-wsl">Windows Subsystem for Linux (WSL)</h4>
+<p>Only Windows 10 1803 or newer is supported due to a dependency on the wslpath utility and support for environment variable sharing through WSLENV.</p>
+<p>You may build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass <code>--build=x86_64-unknown-linux-gnu</code> and <code>--host=x86_64-unknown-linux-gnu</code> to <code>configure</code>.</p>
 <h4 id="cygwin">Cygwin</h4>
 <p>A functioning <a href="http://www.cygwin.com/">Cygwin</a> environment is thus required for building the JDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.</p>
 <p><strong>Note:</strong> Cygwin has a model of continuously updating all packages without any easy way to install or revert to a specific version of a package. This means that whenever you add or update a package in Cygwin, you might (inadvertently) update tools that are used by the JDK build process, and that can cause unexpected build problems.</p>
--- a/doc/building.md	Fri Dec 14 17:12:14 2018 -0800
+++ b/doc/building.md	Mon Dec 17 09:35:15 2018 -0800
@@ -75,8 +75,8 @@
     network share for the source code, see below for suggestions on how to keep
     the build artifacts on a local disk.
 
-  * On Windows, extra care must be taken to make sure the [Cygwin](#cygwin)
-    environment is consistent. It is recommended that you follow this
+  * On Windows, if using [Cygwin](#cygwin), extra care must be taken to make sure
+    the environment is consistent. It is recommended that you follow this
     procedure:
 
       * Create the directory that is going to contain the top directory of the
@@ -174,10 +174,10 @@
 
 Windows is the only non-POSIX OS supported by the JDK, and as such, requires
 some extra care. A POSIX support layer is required to build on Windows.
-Currently, the only supported such layer is Cygwin. (Msys is no longer
-supported due to a too old bash; msys2 and the new Windows Subsystem for Linux
-(WSL) would likely be possible to support in a future version but that would
-require effort to implement.)
+Currently, the only supported such layers are Windows Subsystem for Linux (WSL)
+and Cygwin. (Msys is no longer supported due to a too old bash; msys2 would 
+likely be possible to support in a future version but that would require effort
+to implement.)
 
 Internally in the build system, all paths are represented as Unix-style paths,
 e.g. `/cygdrive/c/hg/jdk9/Makefile` rather than `C:\hg\jdk9\Makefile`. This
@@ -186,6 +186,17 @@
 `--with-msvcr-dll=c:\msvcr100.dll`. For details on this conversion, see the section
 on [Fixpath](#fixpath).
 
+#### Windows Subsystem for Linux (WSL)
+
+Only Windows 10 1803 or newer is supported due to a dependency on the wslpath utility
+and support for environment variable sharing through WSLENV.
+
+You may build both Windows and Linux binaries from WSL. To build Windows binaries,
+you must use a Windows boot JDK (located in a Windows-accessible directory). To build 
+Linux binaries, you must use a Linux boot JDK. The default behavior is to build for
+Windows. To build for Linux, pass `--build=x86_64-unknown-linux-gnu` and 
+`--host=x86_64-unknown-linux-gnu` to `configure`.
+
 #### Cygwin
 
 A functioning [Cygwin](http://www.cygwin.com/) environment is thus required for
--- a/make/autoconf/basics.m4	Fri Dec 14 17:12:14 2018 -0800
+++ b/make/autoconf/basics.m4	Mon Dec 17 09:35:15 2018 -0800
@@ -616,6 +616,7 @@
   BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
   BASIC_PATH_PROGS(NICE, nice)
   BASIC_PATH_PROGS(PANDOC, pandoc)
+  BASIC_PATH_PROGS(LSB_RELEASE, lsb_release)
 
   BASIC_PATH_PROGS(CMD, [cmd.exe /mnt/c/Windows/System32/cmd.exe])
 ])
@@ -638,13 +639,14 @@
 
   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
     PATH_SEP=";"
+    EXE_SUFFIX=".exe"
     BASIC_CHECK_PATHS_WINDOWS
   else
     PATH_SEP=":"
-    EXECUTABLE_SUFFIX=""
+    EXE_SUFFIX=""
   fi
   AC_SUBST(PATH_SEP)
-  AC_SUBST(EXECUTABLE_SUFFIX)
+  AC_SUBST(EXE_SUFFIX)
 
   # We get the top-level directory from the supporting wrappers.
   AC_MSG_CHECKING([for top-level directory])
--- a/make/autoconf/basics_windows.m4	Fri Dec 14 17:12:14 2018 -0800
+++ b/make/autoconf/basics_windows.m4	Mon Dec 17 09:35:15 2018 -0800
@@ -464,7 +464,6 @@
     if test "x$test_cygdrive_prefix" = x; then
       AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.])
     fi
-    EXECUTABLE_SUFFIX=""
   elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
     AC_MSG_CHECKING([msys release])
     MSYS_VERSION=`$UNAME -r`
@@ -479,9 +478,26 @@
     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
     AC_MSG_RESULT([$MSYS_ROOT_PATH])
     WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
-    EXECUTABLE_SUFFIX=""
   elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
-    EXECUTABLE_SUFFIX=".exe"
+    AC_MSG_CHECKING([Windows version])
+    # m4 replaces [ and ] so we use @<:@ and @:>@ instead
+    WINDOWS_VERSION=`$CMD /c ver.exe | $EGREP -o '(@<:@0-9@:>@+\.)+@<:@0-9@:>@+'`
+    AC_MSG_RESULT([$WINDOWS_VERSION])
+
+    AC_MSG_CHECKING([WSL kernel version])
+    WSL_KERNEL_VERSION=`$UNAME -v`
+    AC_MSG_RESULT([$WSL_KERNEL_VERSION])
+
+    AC_MSG_CHECKING([WSL kernel release])
+    WSL_KERNEL_RELEASE=`$UNAME -r`
+    AC_MSG_RESULT([$WSL_KERNEL_RELEASE])
+	
+    AC_MSG_CHECKING([WSL distribution])
+    WSL_DISTRIBUTION=`$LSB_RELEASE -d | sed 's/Description:\t//'`
+    AC_MSG_RESULT([$WSL_DISTRIBUTION])
+
+    WINDOWS_ENV_VENDOR='WSL'
+    WINDOWS_ENV_VERSION="$WSL_DISTRIBUTION $WSL_KERNEL_VERSION $WSL_KERNEL_RELEASE (on Windows build $WINDOWS_VERSION)"
   else
     AC_MSG_ERROR([Unknown Windows environment. Neither cygwin, msys, nor wsl was detected.])
   fi
--- a/make/autoconf/boot-jdk.m4	Fri Dec 14 17:12:14 2018 -0800
+++ b/make/autoconf/boot-jdk.m4	Mon Dec 17 09:35:15 2018 -0800
@@ -63,18 +63,18 @@
     # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
     if test "x$BOOT_JDK_FOUND" = xmaybe; then
       # Do we have a bin/java?
-      if test ! -x "$BOOT_JDK/bin/java$EXECUTABLE_SUFFIX"; then
+      if test ! -x "$BOOT_JDK/bin/java$EXE_SUFFIX"; then
         AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring])
         BOOT_JDK_FOUND=no
       else
         # Do we have a bin/javac?
-        if test ! -x "$BOOT_JDK/bin/javac$EXECUTABLE_SUFFIX"; then
+        if test ! -x "$BOOT_JDK/bin/javac$EXE_SUFFIX"; then
           AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring])
           AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXECUTABLE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $HEAD -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $HEAD -n 1`
           if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then
             AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.])
             AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".])
@@ -101,7 +101,7 @@
             AC_MSG_CHECKING([for Boot JDK])
             AC_MSG_RESULT([$BOOT_JDK])
             AC_MSG_CHECKING([Boot JDK version])
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXECUTABLE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
             AC_MSG_RESULT([$BOOT_JDK_VERSION])
           fi # end check jdk version
         fi # end check javac
@@ -335,11 +335,11 @@
   AC_SUBST(BOOT_JDK)
 
   # Setup tools from the Boot JDK.
-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java$EXECUTABLE_SUFFIX)
-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac$EXECUTABLE_SUFFIX)
-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc$EXECUTABLE_SUFFIX)
-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar$EXECUTABLE_SUFFIX)
-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner$EXECUTABLE_SUFFIX)
+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java$EXE_SUFFIX)
+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac$EXE_SUFFIX)
+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc$EXE_SUFFIX)
+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar$EXE_SUFFIX)
+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner$EXE_SUFFIX)
 
   # Finally, set some other options...
 
--- a/make/autoconf/spec.gmk.in	Fri Dec 14 17:12:14 2018 -0800
+++ b/make/autoconf/spec.gmk.in	Mon Dec 17 09:35:15 2018 -0800
@@ -123,8 +123,7 @@
   # On Windows, the Visual Studio toolchain needs the PATH to be adjusted
   # to include Visual Studio tools (this needs to be in cygwin/msys style).
   ifeq ($(OPENJDK_TARGET_OS_ENV), windows.wsl)
-    export FIXPATH_PATH:=@VS_PATH_WINDOWS@
-    export WSLENV:=$(WSLENV):FIXPATH_PATH:DEBUG_FIXPATH
+    export FIXPATH_WSL:=@FIXPATH_WSL@
   else
     export PATH:=@VS_PATH@
   endif
--- a/make/autoconf/toolchain.m4	Fri Dec 14 17:12:14 2018 -0800
+++ b/make/autoconf/toolchain.m4	Mon Dec 17 09:35:15 2018 -0800
@@ -180,7 +180,6 @@
     SHARED_LIBRARY='[$]1.dll'
     STATIC_LIBRARY='[$]1.lib'
     OBJ_SUFFIX='.obj'
-    EXE_SUFFIX='.exe'
   else
     LIBRARY_PREFIX=lib
     SHARED_LIBRARY_SUFFIX='.so'
@@ -188,7 +187,6 @@
     SHARED_LIBRARY='lib[$]1.so'
     STATIC_LIBRARY='lib[$]1.a'
     OBJ_SUFFIX='.o'
-    EXE_SUFFIX=''
     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
       # For full static builds, we're overloading the SHARED_LIBRARY
       # variables in order to limit the amount of changes required.
@@ -212,7 +210,6 @@
   AC_SUBST(SHARED_LIBRARY)
   AC_SUBST(STATIC_LIBRARY)
   AC_SUBST(OBJ_SUFFIX)
-  AC_SUBST(EXE_SUFFIX)
 ])
 
 # Determine which toolchain type to use, and make sure it is valid for this
@@ -281,13 +278,13 @@
 
   TOOLCHAIN_CC_BINARY_clang="clang"
   TOOLCHAIN_CC_BINARY_gcc="gcc"
-  TOOLCHAIN_CC_BINARY_microsoft="cl$EXECUTABLE_SUFFIX"
+  TOOLCHAIN_CC_BINARY_microsoft="cl$EXE_SUFFIX"
   TOOLCHAIN_CC_BINARY_solstudio="cc"
   TOOLCHAIN_CC_BINARY_xlc="xlc_r"
 
   TOOLCHAIN_CXX_BINARY_clang="clang++"
   TOOLCHAIN_CXX_BINARY_gcc="g++"
-  TOOLCHAIN_CXX_BINARY_microsoft="cl$EXECUTABLE_SUFFIX"
+  TOOLCHAIN_CXX_BINARY_microsoft="cl$EXE_SUFFIX"
   TOOLCHAIN_CXX_BINARY_solstudio="CC"
   TOOLCHAIN_CXX_BINARY_xlc="xlC_r"
 
@@ -706,7 +703,7 @@
     # In the Microsoft toolchain we have a separate LD command "link".
     # Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is
     # a cygwin program for something completely different.
-    AC_CHECK_PROG([LD], [link.exe],[link.exe],,, [$CYGWIN_LINK])
+    AC_CHECK_PROG([LD], [link$EXE_SUFFIX],[link$EXE_SUFFIX],,, [$CYGWIN_LINK])
     BASIC_FIXUP_EXECUTABLE(LD)
     # Verify that we indeed succeeded with this trick.
     AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
@@ -758,7 +755,7 @@
   #
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     # The corresponding ar tool is lib.exe (used to create static libraries)
-    AC_CHECK_PROG([AR], [lib.exe],[lib.exe],,,)
+    AC_CHECK_PROG([AR], [lib$EXE_SUFFIX],[lib$EXE_SUFFIX],,,)
   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
     BASIC_CHECK_TOOLS(AR, ar gcc-ar)
   else
@@ -782,12 +779,12 @@
   fi
 
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    AC_CHECK_PROG([MT], [mt.exe], [mt.exe],,, [/usr/bin/mt])
+    AC_CHECK_PROG([MT], [mt$EXE_SUFFIX], [mt$EXE_SUFFIX],,, [/usr/bin/mt])
     BASIC_FIXUP_EXECUTABLE(MT)
     # Setup the resource compiler (RC)
-    AC_CHECK_PROG([RC], [rc.exe], [rc.exe],,, [/usr/bin/rc])
+    AC_CHECK_PROG([RC], [rc$EXE_SUFFIX], [rc$EXE_SUFFIX],,, [/usr/bin/rc])
     BASIC_FIXUP_EXECUTABLE(RC)
-    AC_CHECK_PROG([DUMPBIN], [dumpbin.exe], [dumpbin.exe],,,)
+    AC_CHECK_PROG([DUMPBIN], [dumpbin$EXE_SUFFIX], [dumpbin$EXE_SUFFIX],,,)
     BASIC_FIXUP_EXECUTABLE(DUMPBIN)
     # We need to check for 'msbuild.exe' because at the place where we expect to
     # find 'msbuild.exe' there's also a directory called 'msbuild' and configure
@@ -796,7 +793,7 @@
     # Notice that we intentionally don't fix up the path to MSBUILD because we
     # will call it in a DOS shell during freetype detection on Windows (see
     # 'LIB_SETUP_FREETYPE' in "libraries.m4"
-    AC_CHECK_PROG([MSBUILD], [msbuild.exe], [msbuild.exe],,,)
+    AC_CHECK_PROG([MSBUILD], [msbuild$EXE_SUFFIX], [msbuild$EXE_SUFFIX],,,)
   fi
 
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then