Skip to content

Commit bddef71

Browse files
committedJun 2, 2022
8287724: Fix various issues with msys2
Reviewed-by: erikj
1 parent 6ff2d89 commit bddef71

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed
 

‎make/autoconf/boot-jdk.m4

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -126,16 +126,18 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
126126
AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
127127
[
128128
if test "x$with_boot_jdk" != x; then
129-
if test -d "$with_boot_jdk"; then
130-
BOOT_JDK=$with_boot_jdk
129+
BOOT_JDK_ARG="$with_boot_jdk"
130+
UTIL_FIXUP_PATH(BOOT_JDK_ARG)
131+
if test -d "$BOOT_JDK_ARG"; then
132+
BOOT_JDK=$BOOT_JDK_ARG
131133
BOOT_JDK_FOUND=maybe
132-
elif test -f "$with_boot_jdk"; then
133-
case "$with_boot_jdk" in
134+
elif test -f "$BOOT_JDK_ARG"; then
135+
case "$BOOT_JDK_ARG" in
134136
*.tar.gz )
135137
BOOT_JDK_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/boot-jdk
136138
$RM -rf $BOOT_JDK_SUPPORT_DIR
137139
$MKDIR -p $BOOT_JDK_SUPPORT_DIR
138-
$GUNZIP -c $with_boot_jdk | $TAR xf - -C $BOOT_JDK_SUPPORT_DIR
140+
$GUNZIP -c $BOOT_JDK_ARG | $TAR xf - -C $BOOT_JDK_SUPPORT_DIR
139141
140142
# Try to find javac to determine BOOT_JDK path
141143
BOOT_JDK_JAVAC_PATH=`$FIND $BOOT_JDK_SUPPORT_DIR | $GREP "/bin/javac"`

‎make/autoconf/platform.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
218218
VAR_OS=windows
219219
VAR_OS_ENV=windows.wsl
220220
;;
221-
*msys*)
221+
*msys* | *mingw*)
222222
VAR_OS=windows
223223
VAR_OS_ENV=windows.msys2
224224
;;

‎make/scripts/fixpath.sh

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
44
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
#
66
# This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,14 @@
2828
# available, or extract values automatically from the environment if missing.
2929
# This is robust, but slower.
3030
function setup() {
31+
32+
# Make regexp tests case insensitive
33+
shopt -s nocasematch
34+
# Prohibit msys2 from meddling with paths
35+
export MSYS2_ARG_CONV_EXCL="*"
36+
# Make sure WSL gets a copy of the path
37+
export WSLENV=PATH/l
38+
3139
while getopts "e:p:r:t:c:qmi" opt; do
3240
case "$opt" in
3341
e) PATHTOOL="$OPTARG" ;;
@@ -87,13 +95,6 @@ function setup() {
8795
wintemp_win="$($CMD /q /c echo %TEMP% 2>/dev/null | tr -d \\n\\r)"
8896
WINTEMP="$($PATHTOOL -u "$wintemp_win")"
8997
fi
90-
91-
# Make regexp tests case insensitive
92-
shopt -s nocasematch
93-
# Prohibit msys2 from meddling with paths
94-
export MSYS2_ARG_CONV_EXCL="*"
95-
# Make sure WSL gets a copy of the path
96-
export WSLENV=PATH/l
9798
}
9899

99100
# Cleanup handling
@@ -299,6 +300,19 @@ function convert_path() {
299300
if [[ $arg =~ ^([^/]*|-[^:=]*[:=]|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then
300301
prefix="${BASH_REMATCH[1]}"
301302
winpath="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}"
303+
304+
# If the thing in its entirety points to an existing path, use that instead of thinking
305+
# we have a prefix. This can only happen if the top-level directory has a single-letter name.
306+
if [[ ${#prefix} -eq 2 && "${prefix:0:1}" == "/" ]]; then
307+
possiblepath="${BASH_REMATCH[1]}/${BASH_REMATCH[3]}${BASH_REMATCH[4]}"
308+
if [[ -e "$possiblepath" || -e "$(dirname $possiblepath)" || -e "$(echo $possiblepath | cut -d / -f 1-5)" ]] ; then
309+
prefix=
310+
drivepart="${possiblepath:1:1}"
311+
pathpart="${possiblepath:2}"
312+
winpath="$drivepart:$pathpart"
313+
fi
314+
fi
315+
302316
# Change slash to backslash (or vice versa if mixed mode)
303317
if [[ $MIXEDMODE != true ]]; then
304318
winpath="${winpath//'/'/'\'}"

0 commit comments

Comments
 (0)
Please sign in to comment.