From 6e99377bc51b40d125c67db4513a692621dc28c6 Mon Sep 17 00:00:00 2001 From: Artemkth Date: Wed, 7 Oct 2020 20:31:25 +0000 Subject: [PATCH] ICU-20677 Fixing cygwin/MSVC build See #1398 --- icu4c/source/data/Makefile.in | 3 +-- icu4c/source/extra/scrptrun/Makefile.in | 5 +---- icu4c/source/tools/toolutil/toolutil.cpp | 13 +++++-------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/icu4c/source/data/Makefile.in b/icu4c/source/data/Makefile.in index fbc22a6d97..f020bc82a8 100644 --- a/icu4c/source/data/Makefile.in +++ b/icu4c/source/data/Makefile.in @@ -240,8 +240,7 @@ include $(top_builddir)/$(subdir)/rules.mk ifeq ($(ENABLE_SO_VERSION_DATA),1) ifeq ($(PKGDATA_MODE),dll) SO_VERSION_DATA = $(OUTTMPDIR)/icudata.res -$(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc - mkdir -p $(@D) +$(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc | $(TMP_DIR)/dirs.timestamp ifeq ($(MSYS_RC_MODE),1) rc.exe -i$(srcdir)/../common -i$(top_builddir)/common -fo$@ $(CPPFLAGS) $< else diff --git a/icu4c/source/extra/scrptrun/Makefile.in b/icu4c/source/extra/scrptrun/Makefile.in index d951f66a4b..f3f89431df 100644 --- a/icu4c/source/extra/scrptrun/Makefile.in +++ b/icu4c/source/extra/scrptrun/Makefile.in @@ -12,9 +12,6 @@ top_builddir = ../.. include $(top_builddir)/icudefs.mk -## Platform-specific setup -include @platform_make_fragment@ - ## Build directory information subdir = extra/scrptrun @@ -22,7 +19,7 @@ subdir = extra/scrptrun CLEANFILES = *~ $(DEPS) ## Target information -TARGET = srtest +TARGET = srtest$(EXEEXT) DEFS = @DEFS@ CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/common -I$(top_srcdir) diff --git a/icu4c/source/tools/toolutil/toolutil.cpp b/icu4c/source/tools/toolutil/toolutil.cpp index 9a93528e0a..7a574f41bb 100644 --- a/icu4c/source/tools/toolutil/toolutil.cpp +++ b/icu4c/source/tools/toolutil/toolutil.cpp @@ -166,14 +166,11 @@ findBasename(const char *filename) { const char *basename=uprv_strrchr(filename, U_FILE_SEP_CHAR); #if U_FILE_ALT_SEP_CHAR!=U_FILE_SEP_CHAR -#if !(U_PLATFORM == U_PF_CYGWIN && U_PLATFORM_USES_ONLY_WIN32_API) - if(basename==NULL) -#endif - { - /* Use lenient matching on Windows, which can accept either \ or / - This is useful for environments like Win32+CygWin which have both. - */ - basename=uprv_strrchr(filename, U_FILE_ALT_SEP_CHAR); + //be lenient about pathname separators on Windows, like official implementation of C++17 std::filesystem in MSVC + //would be convenient to merge this loop with the one above, but alas, there is no such solution in the standard library + const char *alt_basename=uprv_strrchr(filename, U_FILE_ALT_SEP_CHAR); + if(alt_basename>basename) { + basename=alt_basename; } #endif