8317340: Windows builds are not reproducible if MS VS compiler install path differs

Reviewed-by: erikj
This commit is contained in:
Andrew Leonard 2023-10-03 14:00:00 +00:00
parent 3bcfac18c3
commit 353d139682
2 changed files with 28 additions and 0 deletions

View File

@ -843,6 +843,17 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
FILE_MACRO_CFLAGS=
]
)
if test "x$FILE_MACRO_CFLAGS" != x; then
# Add -pathmap for all VS system include paths using Windows
# full Long path name that is generated by the compiler
for ipath in ${$3SYSROOT_CFLAGS}; do
if test "x${ipath:0:2}" == "x-I"; then
ipath_path=${ipath#"-I"}
UTIL_FIXUP_WIN_LONG_PATH(ipath_path)
FILE_MACRO_CFLAGS="$FILE_MACRO_CFLAGS -pathmap:\"$ipath_path\"=vsi"
fi
done
fi
fi
AC_MSG_CHECKING([how to prevent absolute paths in output])

View File

@ -118,6 +118,23 @@ AC_DEFUN([UTIL_FIXUP_PATH],
fi
])
##############################################################################
# Fixup path to be a Windows full long path
AC_DEFUN([UTIL_FIXUP_WIN_LONG_PATH],
[
# Only process if variable expands to non-empty
path="[$]$1"
if test "x$path" != x; then
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
win_path=$($PATHTOOL -wl "$path")
if test "x$win_path" != "x$path"; then
$1="$win_path"
fi
fi
fi
])
###############################################################################
# Check if the given file is a unix-style or windows-style executable, that is,
# if it expects paths in unix-style or windows-style.