Skip to content

Commit

Permalink
8079087: Add support for Cygwin 2.0
Browse files Browse the repository at this point in the history
8176033: New cygwin grep does not match \r as newline
8179675: Build with error on windows with new Cygwin grep

Reviewed-by: iris, tbell
Backport-of: a90ed05109da57e35b9c158cd9aac893f04a6af5
  • Loading branch information
erikj79 committed Apr 29, 2022
1 parent 3740d05 commit a30a007
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
10 changes: 5 additions & 5 deletions common/autoconf/basics_windows.m4
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, 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 @@ -312,17 +312,17 @@ AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
WINDOWS_ENV_VENDOR='cygwin'
WINDOWS_ENV_VERSION="$CYGWIN_VERSION"
CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.`
if test "x$CYGWIN_VERSION_OK" = x; then
CYGWIN_VERSION_OLD=`$ECHO $CYGWIN_VERSION | $GREP -e '^1\.[0-6]'`
if test "x$CYGWIN_VERSION_OLD" != x; then
AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade.])
AC_MSG_ERROR([Cannot continue])
fi
if test "x$CYGPATH" = x; then
AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
fi
AC_MSG_CHECKING([cygwin root directory as unix-style path])
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
# The cmd output ends with Windows line endings (CR/LF)
cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'`
# Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
Expand Down
12 changes: 6 additions & 6 deletions common/autoconf/generated-configure.sh
Expand Up @@ -3228,7 +3228,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.


#
# Copyright (c) 2011, 2012, 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 @@ -3873,7 +3873,7 @@ fi
#CUSTOM_AUTOCONF_INCLUDE

# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1649266272
DATE_WHEN_GENERATED=1650317207

###############################################################################
#
Expand Down Expand Up @@ -7247,8 +7247,8 @@ $as_echo "$CYGWIN_VERSION" >&6; }
WINDOWS_ENV_VENDOR='cygwin'
WINDOWS_ENV_VERSION="$CYGWIN_VERSION"

CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.`
if test "x$CYGWIN_VERSION_OK" = x; then
CYGWIN_VERSION_OLD=`$ECHO $CYGWIN_VERSION | $GREP -e '^1\.0-6'`
if test "x$CYGWIN_VERSION_OLD" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade." >&5
$as_echo "$as_me: Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade." >&6;}
as_fn_error $? "Cannot continue" "$LINENO" 5
Expand All @@ -7258,8 +7258,8 @@ $as_echo "$as_me: Your cygwin is too old. You are running $CYGWIN_VERSION, but a
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin root directory as unix-style path" >&5
$as_echo_n "checking cygwin root directory as unix-style path... " >&6; }
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
# The cmd output ends with Windows line endings (CR/LF)
cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'`
# Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_ROOT_PATH" >&5
Expand Down
15 changes: 10 additions & 5 deletions jdk/make/CreateJars.gmk
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2013, 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 @@ -265,7 +265,10 @@ $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents: $(BUILD_TOOLS) $(IMAGES_OU
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
$(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
# Cygwin grep does not match $ as end of line if there are windows line
# endings in the input.
$(TR) -d '\r' < $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents \
| $(GREP) -e '\.class$$' > $@.tmp
ifneq ($(PROFILE), )
# # Add back classes from excluded packages (fixing the $ substitution in the process)
for type in $(subst \$$,\, $(RT_JAR_INCLUDE_TYPES)) ; do \
Expand All @@ -277,9 +280,11 @@ $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
$(GREP) -v -e '\.class$$' \
-e '/_the\.*' -e '^_the\.*' -e '\\_the\.*' -e 'javac_state' \
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
# Cygwin grep does not match $ as end of line if there are windows line
# endings in the input.
$(TR) -d '\r' < $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents \
| $(GREP) -v -e '\.class$$' \
-e '/_the\.*' -e '^_the\.*' -e '\\_the\.*' -e 'javac_state' > $@.tmp
ifneq ($(PROFILE), )
# # Strip out all META-INF/services/ entries
$(GREP) -v -e 'META-INF/services/' $@.tmp > $@.tmp2
Expand Down

1 comment on commit a30a007

@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.