Skip to content

Commit

Permalink
8287724: Fix various issues with msys2
Browse files Browse the repository at this point in the history
Reviewed-by: clanger
Backport-of: 2e21c87
  • Loading branch information
gdams committed Nov 25, 2022
1 parent 99b722d commit af27be3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
14 changes: 8 additions & 6 deletions make/autoconf/boot-jdk.m4
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -126,16 +126,18 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
[
if test "x$with_boot_jdk" != x; then
if test -d "$with_boot_jdk"; then
BOOT_JDK=$with_boot_jdk
BOOT_JDK_ARG="$with_boot_jdk"
UTIL_FIXUP_PATH(BOOT_JDK_ARG)
if test -d "$BOOT_JDK_ARG"; then
BOOT_JDK=$BOOT_JDK_ARG
BOOT_JDK_FOUND=maybe
elif test -f "$with_boot_jdk"; then
case "$with_boot_jdk" in
elif test -f "$BOOT_JDK_ARG"; then
case "$BOOT_JDK_ARG" in
*.tar.gz )
BOOT_JDK_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/boot-jdk
$RM -rf $BOOT_JDK_SUPPORT_DIR
$MKDIR -p $BOOT_JDK_SUPPORT_DIR
$GUNZIP -c $with_boot_jdk | $TAR xf - -C $BOOT_JDK_SUPPORT_DIR
$GUNZIP -c $BOOT_JDK_ARG | $TAR xf - -C $BOOT_JDK_SUPPORT_DIR
# Try to find javac to determine BOOT_JDK path
BOOT_JDK_JAVAC_PATH=`$FIND $BOOT_JDK_SUPPORT_DIR | $GREP "/bin/javac"`
Expand Down
2 changes: 1 addition & 1 deletion make/autoconf/platform.m4
Expand Up @@ -194,7 +194,7 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
VAR_OS=windows
VAR_OS_ENV=windows.cygwin
;;
*msys*)
*msys* | *mingw*)
VAR_OS=windows
VAR_OS_ENV=windows.msys2
;;
Expand Down
30 changes: 22 additions & 8 deletions make/scripts/fixpath.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,6 +28,14 @@
# available, or extract values automatically from the environment if missing.
# This is robust, but slower.
function setup() {

# Make regexp tests case insensitive
shopt -s nocasematch
# Prohibit msys2 from meddling with paths
export MSYS2_ARG_CONV_EXCL="*"
# Make sure WSL gets a copy of the path
export WSLENV=PATH/l

while getopts "e:p:r:t:c:qmi" opt; do
case "$opt" in
e) PATHTOOL="$OPTARG" ;;
Expand Down Expand Up @@ -87,13 +95,6 @@ function setup() {
wintemp_win="$($CMD /q /c echo %TEMP% 2>/dev/null | tr -d \\n\\r)"
WINTEMP="$($PATHTOOL -u "$wintemp_win")"
fi

# Make regexp tests case insensitive
shopt -s nocasematch
# Prohibit msys2 from meddling with paths
export MSYS2_ARG_CONV_EXCL="*"
# Make sure WSL gets a copy of the path
export WSLENV=PATH/l
}

# Cleanup handling
Expand Down Expand Up @@ -296,6 +297,19 @@ function convert_path() {
if [[ $arg =~ ^([^/]*|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then
prefix="${BASH_REMATCH[1]}"
winpath="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}"
# If the thing in its entirety points to an existing path, use that instead of thinking
# we have a prefix. This can only happen if the top-level directory has a single-letter name.
if [[ ${#prefix} -eq 2 && "${prefix:0:1}" == "/" ]]; then
possiblepath="${BASH_REMATCH[1]}/${BASH_REMATCH[3]}${BASH_REMATCH[4]}"
if [[ -e "$possiblepath" || -e "$(dirname $possiblepath)" || -e "$(echo $possiblepath | cut -d / -f 1-5)" ]] ; then
prefix=
drivepart="${possiblepath:1:1}"
pathpart="${possiblepath:2}"
winpath="$drivepart:$pathpart"
fi
fi
# Change slash to backslash (or vice versa if mixed mode)
if [[ $MIXEDMODE != true ]]; then
winpath="${winpath//'/'/'\'}"
Expand Down

1 comment on commit af27be3

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.