add dev-lang/php-5.6.40
[portage-squeep] / dev-lang / php / files / php-5.6-intl-detect-icu-via-pkg-config.patch
1 Based on the following upstream commits:
2
3 https://github.com/php/php-src/commit/9a8e7b571896f39f83cb000fdb7c466b6d328d52
4 https://github.com/php/php-src/pull/3701
5 https://github.com/php/php-src/commit/2bd299f7318492fd7e5cafffa562d76ba60e69d4
6
7 --- a/acinclude.m4
8 +++ b/acinclude.m4
9 @@ -2201,49 +2201,16 @@ dnl
10 dnl Common setup macro for ICU
11 dnl
12 AC_DEFUN([PHP_SETUP_ICU],[
13 - PHP_ARG_WITH(icu-dir,,
14 - [ --with-icu-dir=DIR Specify where ICU libraries and headers can be found], DEFAULT, no)
15 + PKG_CHECK_MODULES([ICU], [icu-io >= 50.1])
16
17 - if test "$PHP_ICU_DIR" = "no"; then
18 - PHP_ICU_DIR=DEFAULT
19 - fi
20 -
21 - if test "$PHP_ICU_DIR" = "DEFAULT"; then
22 - dnl Try to find icu-config
23 - AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
24 - else
25 - ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
26 - fi
27 -
28 - AC_MSG_CHECKING([for location of ICU headers and libraries])
29 -
30 - dnl Trust icu-config to know better what the install prefix is..
31 - icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
32 - if test "$?" != "0" || test -z "$icu_install_prefix"; then
33 - AC_MSG_RESULT([not found])
34 - AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
35 - else
36 - AC_MSG_RESULT([$icu_install_prefix])
37 -
38 - dnl Check ICU version
39 - AC_MSG_CHECKING([for ICU 4.0 or greater])
40 - icu_version_full=`$ICU_CONFIG --version`
41 - ac_IFS=$IFS
42 - IFS="."
43 - set $icu_version_full
44 - IFS=$ac_IFS
45 - icu_version=`expr [$]1 \* 1000 + [$]2`
46 - AC_MSG_RESULT([found $icu_version_full])
47 + PHP_EVAL_INCLINE($ICU_CFLAGS)
48 + PHP_EVAL_LIBLINE($ICU_LIBS, $1)
49
50 - if test "$icu_version" -lt "4000"; then
51 - AC_MSG_ERROR([ICU version 4.0 or later is required])
52 - fi
53 + ICU_CFLAGS="$ICU_CFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
54 + ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
55
56 - ICU_VERSION=$icu_version
57 - ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
58 - ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
59 - PHP_EVAL_INCLINE($ICU_INCS)
60 - PHP_EVAL_LIBLINE($ICU_LIBS, $1)
61 + if test "$PKG_CONFIG icu-io --atleast-version=60"; then
62 + ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
63 fi
64 ])
65
66 --- a/ext/intl/config.m4
67 +++ b/ext/intl/config.m4
68 @@ -9,18 +9,10 @@ if test "$PHP_INTL" != "no"; then
69 PHP_SETUP_ICU(INTL_SHARED_LIBADD)
70 PHP_SUBST(INTL_SHARED_LIBADD)
71 PHP_REQUIRE_CXX()
72 - if test "$icu_version" -ge "4002"; then
73 - icu_spoof_src=" spoofchecker/spoofchecker_class.c \
74 - spoofchecker/spoofchecker.c\
75 - spoofchecker/spoofchecker_create.c\
76 - spoofchecker/spoofchecker_main.c"
77 - else
78 - icu_spoof_src=""
79 - fi
80 + INTL_COMMON_FLAGS="$ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
81 PHP_NEW_EXTENSION(intl, php_intl.c \
82 intl_error.c \
83 intl_convert.c \
84 - intl_convertcpp.cpp \
85 collator/collator.c \
86 collator/collator_class.c \
87 collator/collator_sort.c \
88 @@ -32,8 +24,6 @@ if test "$PHP_INTL" != "no"; then
89 collator/collator_is_numeric.c \
90 collator/collator_error.c \
91 common/common_error.c \
92 - common/common_enum.cpp \
93 - common/common_date.cpp \
94 converter/converter.c \
95 formatter/formatter.c \
96 formatter/formatter_main.c \
97 @@ -53,17 +43,12 @@ if test "$PHP_INTL" != "no"; then
98 dateformat/dateformat_attr.c \
99 dateformat/dateformat_data.c \
100 dateformat/dateformat_format.c \
101 - dateformat/dateformat_format_object.cpp \
102 dateformat/dateformat_parse.c \
103 - dateformat/dateformat_create.cpp \
104 - dateformat/dateformat_attrcpp.cpp \
105 - dateformat/dateformat_helpers.cpp \
106 msgformat/msgformat.c \
107 msgformat/msgformat_attr.c \
108 msgformat/msgformat_class.c \
109 msgformat/msgformat_data.c \
110 msgformat/msgformat_format.c \
111 - msgformat/msgformat_helpers.cpp \
112 msgformat/msgformat_parse.c \
113 grapheme/grapheme_string.c \
114 grapheme/grapheme_util.c \
115 @@ -73,6 +58,20 @@ if test "$PHP_INTL" != "no"; then
116 transliterator/transliterator.c \
117 transliterator/transliterator_class.c \
118 transliterator/transliterator_methods.c \
119 + idn/idn.c \
120 + spoofchecker/spoofchecker_class.c \
121 + spoofchecker/spoofchecker.c\
122 + spoofchecker/spoofchecker_create.c\
123 + spoofchecker/spoofchecker_main.c, $ext_shared,,$INTL_COMMON_FLAGS,cxx)
124 +
125 + PHP_INTL_CPP_SOURCES="intl_convertcpp.cpp \
126 + common/common_enum.cpp \
127 + common/common_date.cpp \
128 + dateformat/dateformat_format_object.cpp \
129 + dateformat/dateformat_create.cpp \
130 + dateformat/dateformat_attrcpp.cpp \
131 + dateformat/dateformat_helpers.cpp \
132 + msgformat/msgformat_helpers.cpp \
133 timezone/timezone_class.cpp \
134 timezone/timezone_methods.cpp \
135 calendar/calendar_class.cpp \
136 @@ -83,9 +82,15 @@ if test "$PHP_INTL" != "no"; then
137 breakiterator/breakiterator_methods.cpp \
138 breakiterator/rulebasedbreakiterator_methods.cpp \
139 breakiterator/codepointiterator_internal.cpp \
140 - breakiterator/codepointiterator_methods.cpp \
141 - idn/idn.c \
142 - $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings)
143 + breakiterator/codepointiterator_methods.cpp"
144 +
145 + PHP_INTL_CPP_FLAGS="$ICU_CXXFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
146 + if test "$ext_shared" = "no"; then
147 + PHP_ADD_SOURCES(PHP_EXT_DIR(intl), $PHP_INTL_CPP_SOURCES, $PHP_INTL_CPP_FLAGS)
148 + else
149 + PHP_ADD_SOURCES_X(PHP_EXT_DIR(intl), $PHP_INTL_CPP_SOURCES, $PHP_INTL_CPP_FLAGS, shared_objects_intl, yes)
150 + fi
151 +
152 PHP_ADD_BUILD_DIR($ext_builddir/collator)
153 PHP_ADD_BUILD_DIR($ext_builddir/converter)
154 PHP_ADD_BUILD_DIR($ext_builddir/common)