mirror of
https://github.com/darlinghq/darling-openjdk.git
synced 2024-11-30 07:40:37 +00:00
8216278: Fix devkit and basic Jib support on WSL
Reviewed-by: tbell
This commit is contained in:
parent
301d0140ec
commit
1880cd5077
@ -999,7 +999,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
MAKE_EXPECTED_ENV='msys'
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
MAKE_EXPECTED_ENV='x86_64-pc-linux-gnu'
|
||||
MAKE_EXPECTED_ENV='x86_64-.*-linux-gnu'
|
||||
else
|
||||
AC_MSG_ERROR([Unknown Windows environment])
|
||||
fi
|
||||
|
@ -272,7 +272,26 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
|
||||
eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
|
||||
eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
|
||||
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
|
||||
VS_PATH="$TOOLCHAIN_PATH:$PATH"
|
||||
|
||||
# The TOOLCHAIN_PATH from a devkit is in Unix format. In WSL we need a
|
||||
# windows version of the complete VS_PATH as VS_PATH_WINDOWS
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# Convert the toolchain path
|
||||
OLDIFS="$IFS"
|
||||
IFS=":"
|
||||
VS_PATH_WINDOWS=""
|
||||
for i in $TOOLCHAIN_PATH; do
|
||||
path=$i
|
||||
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([path])
|
||||
VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$path"
|
||||
done
|
||||
IFS="$OLDIFS"
|
||||
# Append the current path from Windows env
|
||||
WINDOWS_PATH="`$CMD /c echo %PATH%`"
|
||||
VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$WINDOWS_PATH"
|
||||
else
|
||||
VS_PATH="$TOOLCHAIN_PATH:$PATH"
|
||||
fi
|
||||
|
||||
# Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it
|
||||
# can still be exported as INCLUDE for compiler invocations without
|
||||
@ -450,6 +469,34 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
|
||||
. $VS_ENV_TMP_DIR/set-vs-env.sh
|
||||
# Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
|
||||
# also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
|
||||
|
||||
# In WSL, the extracted VS_PATH is Windows style. This needs to be
|
||||
# rewritten as Unix style and the Windows style version is saved
|
||||
# in VS_PATH_WINDOWS.
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=";"
|
||||
# Convert VS_PATH to unix style
|
||||
VS_PATH_WINDOWS="$VS_PATH"
|
||||
VS_PATH=""
|
||||
for i in $VS_PATH_WINDOWS; do
|
||||
path=$i
|
||||
# Only process non-empty elements
|
||||
if test "x$path" != x; then
|
||||
IFS="$OLDIFS"
|
||||
# Check that directory exists before calling fixup_path
|
||||
testpath=$path
|
||||
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
|
||||
if test -d "$testpath"; then
|
||||
BASIC_FIXUP_PATH([path])
|
||||
BASIC_APPEND_TO_PATH(VS_PATH, $path)
|
||||
fi
|
||||
IFS=";"
|
||||
fi
|
||||
done
|
||||
IFS="$OLDIFS"
|
||||
fi
|
||||
|
||||
else
|
||||
# We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
|
||||
AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
|
||||
@ -483,29 +530,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
|
||||
AC_SUBST(VS_INCLUDE)
|
||||
AC_SUBST(VS_LIB)
|
||||
|
||||
# Convert VS_INCLUDE into SYSROOT_CFLAGS
|
||||
OLDIFS="$IFS"
|
||||
IFS=";"
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# Convert VS_PATH to unix style
|
||||
VS_PATH_WINDOWS="$VS_PATH"
|
||||
VS_PATH=""
|
||||
for i in $VS_PATH_WINDOWS; do
|
||||
path=$i
|
||||
# Only process non-empty elements
|
||||
if test "x$path" != x; then
|
||||
IFS="$OLDIFS"
|
||||
# Check that directory exists before calling fixup_path
|
||||
testpath=$path
|
||||
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
|
||||
if test -d "$testpath"; then
|
||||
BASIC_FIXUP_PATH([path])
|
||||
BASIC_APPEND_TO_PATH(VS_PATH, $path)
|
||||
fi
|
||||
IFS=";"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Convert VS_INCLUDE into SYSROOT_CFLAGS
|
||||
for i in $VS_INCLUDE; do
|
||||
ipath=$i
|
||||
# Only process non-empty elements
|
||||
|
@ -386,7 +386,9 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
target_cpu: "x64",
|
||||
dependencies: ["devkit", "graphviz", "pandoc", "graalunit_lib"],
|
||||
configure_args: concat(common.configure_args_64bit,
|
||||
"--enable-full-docs", "--with-zlib=system"),
|
||||
"--enable-full-docs", "--with-zlib=system",
|
||||
(isWsl(input) ? [ "--host=x86_64-unknown-linux-gnu",
|
||||
"--build=x86_64-unknown-linux-gnu" ] : [])),
|
||||
default_make_targets: ["docs-bundles"],
|
||||
},
|
||||
|
||||
@ -833,6 +835,13 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
|
||||
var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
|
||||
+ "-" + input.build_cpu;
|
||||
var boot_jdk_ext = (input.build_os == "windows" ? ".zip" : ".tar.gz")
|
||||
// If running in WSL and building for Windows, it will look like Linux,
|
||||
// but we need a Windows boot JDK.
|
||||
if (isWsl(input) && input.target_os == "windows") {
|
||||
boot_jdk_platform = "windows-" + input.build_cpu;
|
||||
boot_jdk_ext = ".zip";
|
||||
}
|
||||
|
||||
var makeBinDir = (input.build_os == "windows"
|
||||
? input.get("gnumake", "install_path") + "/cygwin/bin"
|
||||
@ -846,8 +855,7 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
version: common.boot_jdk_version,
|
||||
build_number: "28",
|
||||
file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
|
||||
+ boot_jdk_platform + "_bin"
|
||||
+ (input.build_os == "windows" ? ".zip" : ".tar.gz"),
|
||||
+ boot_jdk_platform + "_bin" + boot_jdk_ext,
|
||||
configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
|
||||
environment_path: common.boot_jdk_home + "/bin"
|
||||
},
|
||||
@ -941,7 +949,7 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
organization: common.organization,
|
||||
ext: "tar.gz",
|
||||
revision: "2.3.1+1.0",
|
||||
module: "pandoc-" + input.target_platform,
|
||||
module: "pandoc-" + input.build_platform,
|
||||
configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc",
|
||||
environment_path: input.get("pandoc", "install_path") + "/pandoc"
|
||||
},
|
||||
@ -1181,3 +1189,13 @@ var getVersionNumbers = function () {
|
||||
}
|
||||
return version_numbers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if running in Windows Subsystem for Linux. Jib does not yet
|
||||
* detect wsl as osenv, so fall back on linux with version containing Microsoft.
|
||||
*/
|
||||
var isWsl = function (input) {
|
||||
return ( input.build_osenv == "wsl"
|
||||
|| (input.build_os == "linux"
|
||||
&& java.lang.System.getProperty("os.version").contains("Microsoft")));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user