Add support for QNX Neutrino.
This patch incorporates a change to source/common/putil.c
fetched from upstream.
In addition, it undefines 'si_value' in source/common/ucnvmbcs.c to
avoid a collision with 'si_value' defined on some platforms.
Patch by:
Eli Fidler <efidler@blackberry.com>,
Jeff Rogers <jrogers@blackberry.com>,
Cosmin Truta <ctruta@blackberry.com>.
The original CL is at https://codereview.chromium.org/141063008/
README.chromium was slightly updated to refer to the upstream change for
si_value.
TBR=mark@chromium.org
BUG=NONE
TEST=icu is built properly on qnx. After DEPS roll, net_unittests:*IDN* and base_unittests:*String* all pass on qnx.
Review URL: https://codereview.chromium.org/195973005
git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/icu46@257503 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/README.chromium b/README.chromium
index 5492e9d..cbd019b 100644
--- a/README.chromium
+++ b/README.chromium
@@ -284,7 +284,7 @@
22. Fix time zone handling and compilation on iOS.
- patches/ios_timezone.patch
- upstream bugs : http://bugs.icu-project.org/trac/ticket/9051
- - http://bugs.icu-project.org/trac/ticket/8661
+ http://bugs.icu-project.org/trac/ticket/8661
23. Fix a buffer overflow in utext
- patches/utext.patch
@@ -303,3 +303,14 @@
27. Change export of U_ICUDATA_ENTRY_POINT from U_IMPORT to U_EXPORT.
- patches/declspec.patch
+
+28. Add support for QNX Neutrino.
+ - patches/platform.qnx.patch:
+ Add source/common/unicode/pqnx.h.
+ - patches/si_value.undef.patch:
+ Work around an all-lowercase macro defined in <signal.h>.
+ Upstream took a different approach:
+ http://bugs.icu-project.org/trac/ticket/9935
+ - patches/xopen_source.patch:
+ Set _XOPEN_SOURCE to 600 as in the upstream changeset:
+ http://bugs.icu-project.org/trac/changeset/30418
diff --git a/icu.gyp b/icu.gyp
index 883defd..c2ce2fe 100644
--- a/icu.gyp
+++ b/icu.gyp
@@ -29,7 +29,7 @@
],
}],
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
- or OS=="netbsd" or OS=="mac" or OS=="android") and \
+ or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
(target_arch=="arm" or target_arch=="ia32" or \
target_arch=="mipsel")', {
'target_conditions': [
@@ -124,14 +124,16 @@
], # conditions
'target_conditions': [
[ 'OS == "win" or OS == "mac" or OS == "ios" or '
- '(OS == "android" and (_toolset == "target" or host_os != "linux"))', {
+ '(OS == "android" and (_toolset != "host" or host_os != "linux")) or '
+ '(OS == "qnx" and (_toolset == "host" and host_os != "linux"))', {
'sources!': ['linux/icudt46l_dat.S'],
}],
[ 'OS != "android" or _toolset == "host"', {
'sources!': ['android/icudt46l_dat.S'],
}],
[ 'OS != "mac" and OS != "ios" and '
- '(OS != "android" or _toolset != "host" or host_os != "mac")', {
+ '((OS != "android" and OS != "qnx") or '
+ '_toolset != "host" or host_os != "mac")', {
'sources!': ['mac/icudt46l_dat.S'],
}],
], # target_conditions
@@ -361,7 +363,16 @@
'-licuuc',
],
},
- },{ # OS!="android"
+ }],
+ ['OS=="qnx"', {
+ 'link_settings': {
+ 'libraries': [
+ '-licui18n',
+ '-licuuc',
+ ],
+ },
+ }],
+ ['OS!="android" and OS!="qnx"', {
'link_settings': {
'ldflags': [
'<!@(icu-config --ldflags)',
diff --git a/patches/platform.qnx.patch b/patches/platform.qnx.patch
new file mode 100644
index 0000000..2fdb79a
--- /dev/null
+++ b/patches/platform.qnx.patch
@@ -0,0 +1,35 @@
+diff --git a/source/common/unicode/pandroid.h b/source/common/unicode/pqnx.h
+--- a/source/common/unicode/pandroid.h
++++ b/source/common/unicode/pqnx.h
+@@ -45,8 +45,8 @@
+ #ifndef CYGWINMSVC
+
+ /** Define the platform we're on. */
+-#ifndef U_LINUX
+-#define U_LINUX
++#ifndef U_QNX
++#define U_QNX
+ #endif
+
+ /**
+@@ -331,7 +331,7 @@
+ # ifdef __cplusplus
+ # define U_INLINE inline
+ # else
+-# define U_INLINE inline
++# define U_INLINE __inline__
+ # endif
+ #endif
+
+diff --git a/source/common/unicode/ptypes.h b/source/common/unicode/ptypes.h
+--- a/source/common/unicode/ptypes.h
++++ b/source/common/unicode/ptypes.h
+@@ -34,6 +34,8 @@
+ # include "unicode/pfreebsd.h"
+ #elif defined(__OpenBSD__)
+ # include "unicode/popenbsd.h"
++#elif defined(__QNXNTO__)
++# include "unicode/pqnx.h"
+ #else
+ # include "unicode/platform.h"
+ #endif
diff --git a/patches/si_value.undef.patch b/patches/si_value.undef.patch
new file mode 100644
index 0000000..988872a
--- /dev/null
+++ b/patches/si_value.undef.patch
@@ -0,0 +1,14 @@
+--- source/common/ucnvmbcs.c
++++ source/common/ucnvmbcs.c
+@@ -56,6 +56,11 @@
+ #include "cmemory.h"
+ #include "cstring.h"
+
++/* si_value is defined as a macro in some POSIX implementations' standard headers. */
++#ifdef si_value
++#undef si_value
++#endif
++
+ /* control optimizations according to the platform */
+ #define MBCS_UNROLL_SINGLE_TO_BMP 1
+ #define MBCS_UNROLL_SINGLE_FROM_BMP 0
diff --git a/patches/xopen_source.patch b/patches/xopen_source.patch
new file mode 100644
index 0000000..964951c
--- /dev/null
+++ b/patches/xopen_source.patch
@@ -0,0 +1,28 @@
+--- source/common/putil.c
++++ source/common/putil.c
+@@ -37,15 +37,17 @@
+ ******************************************************************************
+ */
+
+-/* Define _XOPEN_SOURCE for Solaris and friends. */
+-/* NetBSD needs it to be >= 4 */
+-#if !defined(_XOPEN_SOURCE)
+-#if __STDC_VERSION__ >= 199901L
+-/* It is invalid to compile an XPG3, XPG4, XPG4v2 or XPG5 application using c99 on Solaris */
+-#define _XOPEN_SOURCE 600
++/* Define _XOPEN_SOURCE for access to POSIX functions. */
++#ifdef _XOPEN_SOURCE
++ /* Use the predefined value. */
+ #else
+-#define _XOPEN_SOURCE 4
+-#endif
++ /*
++ * Version 6.0:
++ * The Open Group Base Specifications Issue 6 (IEEE Std 1003.1, 2004 Edition)
++ * also known as
++ * SUSv3 = Open Group Single UNIX Specification, Version 3 (UNIX03)
++ */
++# define _XOPEN_SOURCE 600
+ #endif
+
+ /* Make sure things like readlink and such functions work.
diff --git a/source/common/putil.c b/source/common/putil.c
index 3a1cea4..4f071cd 100644
--- a/source/common/putil.c
+++ b/source/common/putil.c
@@ -37,15 +37,17 @@
******************************************************************************
*/
-/* Define _XOPEN_SOURCE for Solaris and friends. */
-/* NetBSD needs it to be >= 4 */
-#if !defined(_XOPEN_SOURCE)
-#if __STDC_VERSION__ >= 199901L
-/* It is invalid to compile an XPG3, XPG4, XPG4v2 or XPG5 application using c99 on Solaris */
-#define _XOPEN_SOURCE 600
+/* Define _XOPEN_SOURCE for access to POSIX functions. */
+#ifdef _XOPEN_SOURCE
+ /* Use the predefined value. */
#else
-#define _XOPEN_SOURCE 4
-#endif
+ /*
+ * Version 6.0:
+ * The Open Group Base Specifications Issue 6 (IEEE Std 1003.1, 2004 Edition)
+ * also known as
+ * SUSv3 = Open Group Single UNIX Specification, Version 3 (UNIX03)
+ */
+# define _XOPEN_SOURCE 600
#endif
/* Make sure things like readlink and such functions work.
diff --git a/source/common/ucnvmbcs.c b/source/common/ucnvmbcs.c
index 538a18c..259f31e 100644
--- a/source/common/ucnvmbcs.c
+++ b/source/common/ucnvmbcs.c
@@ -56,6 +56,11 @@
#include "cmemory.h"
#include "cstring.h"
+/* si_value is defined as a macro in some POSIX implementations' standard headers. */
+#ifdef si_value
+#undef si_value
+#endif
+
/* control optimizations according to the platform */
#define MBCS_UNROLL_SINGLE_TO_BMP 1
#define MBCS_UNROLL_SINGLE_FROM_BMP 0
diff --git a/source/common/unicode/ptypes.h b/source/common/unicode/ptypes.h
index e2336e0..82bf0e3 100644
--- a/source/common/unicode/ptypes.h
+++ b/source/common/unicode/ptypes.h
@@ -34,6 +34,8 @@
# include "unicode/pfreebsd.h"
#elif defined(__OpenBSD__)
# include "unicode/popenbsd.h"
+#elif defined(__QNXNTO__)
+# include "unicode/pqnx.h"
#else
# include "unicode/platform.h"
#endif