Prefer to find icu via pkg-config instead of icu-config. Honor the CXXFLAGS that are indicated by either of those tools. Work around new ICU requirement that a namespace be used by specifying the flag that overrides that requirement. Includes relevant parts of the following upstream commits: Fix typo https://github.com/php/php-src/commit/50b38322b96416b0a5609591a52178f6100768da Fix #73956 Link use CC instead of CXX https://github.com/php/php-src/commit/6af22d0d3ed224d89be1d1e9e53ff7e2e2e5439d Fixed bug #76153 Intl compilation fails with icu4c 61.1 https://github.com/php/php-src/commit/710284cbc4a54cac0a9ec4ea29a7486e0d99a33b Fix clang build, ref buf #76153 https://github.com/php/php-src/commit/8b104d789317d96f6d3e23e635f0ca288c0a23ee Fix shared ext/intl compilation https://github.com/php/php-src/commit/2bd299f7318492fd7e5cafffa562d76ba60e69d4 Rename var https://github.com/php/php-src/commit/ed5aabe8b78d8487ffc6091e0670753d59bb7f5a Group common flags https://github.com/php/php-src/commit/09d7ffabcd99fe9b99c4206f321fecc506635072 --- ext/intl/collator/collator.h.orig +++ ext/intl/collator/collator.h @@ -16,7 +16,7 @@ */ #ifndef COLLATOR_COLLATOR_H -#define CCOLLATOR_COLLATOR_H +#define COLLATOR_COLLATOR_H #include --- ext/intl/config.m4.orig 2019-01-09 03:54:13.000000000 -0600 +++ ext/intl/config.m4 2019-10-22 17:47:47.000000000 -0500 @@ -9,6 +9,7 @@ PHP_SETUP_ICU(INTL_SHARED_LIBADD) PHP_SUBST(INTL_SHARED_LIBADD) PHP_REQUIRE_CXX() + INTL_COMMON_FLAGS="$ICU_INCS -Wno-write-strings" if test "$icu_version" -ge "4002"; then icu_spoof_src=" spoofchecker/spoofchecker_class.c \ spoofchecker/spoofchecker.c\ @@ -20,7 +21,6 @@ PHP_NEW_EXTENSION(intl, php_intl.c \ intl_error.c \ intl_convert.c \ - intl_convertcpp.cpp \ collator/collator.c \ collator/collator_class.c \ collator/collator_sort.c \ @@ -32,8 +32,6 @@ collator/collator_is_numeric.c \ collator/collator_error.c \ common/common_error.c \ - common/common_enum.cpp \ - common/common_date.cpp \ converter/converter.c \ formatter/formatter.c \ formatter/formatter_main.c \ @@ -53,17 +51,12 @@ dateformat/dateformat_attr.c \ dateformat/dateformat_data.c \ dateformat/dateformat_format.c \ - dateformat/dateformat_format_object.cpp \ dateformat/dateformat_parse.c \ - dateformat/dateformat_create.cpp \ - dateformat/dateformat_attrcpp.cpp \ - dateformat/dateformat_helpers.cpp \ msgformat/msgformat.c \ msgformat/msgformat_attr.c \ msgformat/msgformat_class.c \ msgformat/msgformat_data.c \ msgformat/msgformat_format.c \ - msgformat/msgformat_helpers.cpp \ msgformat/msgformat_parse.c \ grapheme/grapheme_string.c \ grapheme/grapheme_util.c \ @@ -73,6 +66,17 @@ transliterator/transliterator.c \ transliterator/transliterator_class.c \ transliterator/transliterator_methods.c \ + idn/idn.c \ + $icu_spoof_src, $ext_shared,,$INTL_COMMON_FLAGS,cxx) + + PHP_INTL_CXX_SOURCES="intl_convertcpp.cpp \ + common/common_enum.cpp \ + common/common_date.cpp \ + dateformat/dateformat_format_object.cpp \ + dateformat/dateformat_create.cpp \ + dateformat/dateformat_attrcpp.cpp \ + dateformat/dateformat_helpers.cpp \ + msgformat/msgformat_helpers.cpp \ timezone/timezone_class.cpp \ timezone/timezone_methods.cpp \ calendar/calendar_class.cpp \ @@ -83,9 +87,14 @@ breakiterator/breakiterator_methods.cpp \ breakiterator/rulebasedbreakiterator_methods.cpp \ breakiterator/codepointiterator_internal.cpp \ - breakiterator/codepointiterator_methods.cpp \ - idn/idn.c \ - $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings) + breakiterator/codepointiterator_methods.cpp" + PHP_INTL_CXX_FLAGS="$INTL_COMMON_FLAGS $ICU_CXXFLAGS" + if test "$ext_shared" = "no"; then + PHP_ADD_SOURCES(PHP_EXT_DIR(intl), $PHP_INTL_CXX_SOURCES, $PHP_INTL_CXX_FLAGS) + else + PHP_ADD_SOURCES_X(PHP_EXT_DIR(intl), $PHP_INTL_CXX_SOURCES, $PHP_INTL_CXX_FLAGS, shared_objects_intl, yes) + fi + PHP_ADD_BUILD_DIR($ext_builddir/collator) PHP_ADD_BUILD_DIR($ext_builddir/converter) PHP_ADD_BUILD_DIR($ext_builddir/common)