app-i18n/mozc: Initial commit - add fcitx5 support
[gentoo-zh.git] / app-i18n / mozc / files / mozc-2.26.4220-system_jsoncpp.patch
blob7ff132eaa591e3ea878693b5d5c6a3fce7ab5d20
1 https://github.com/google/mozc/issues/490
3 --- /src/gyp/defines.gypi
4 +++ /src/gyp/defines.gypi
5 @@ -71,6 +71,10 @@
6 # use_system_gtest represents if system version or bundled version
7 # of gtest library is used.
8 'use_system_gtest%': '0',
10 + # use_system_jsoncpp represents if system version or bundled version
11 + # of jsoncpp library is used.
12 + 'use_system_jsoncpp%': '0',
14 'target_defaults': {
15 'defines': [
16 --- /src/net/jsoncpp.gyp
17 +++ /src/net/jsoncpp.gyp
18 @@ -31,32 +31,60 @@
19 'targets': [
21 'target_name': 'jsoncpp',
22 - 'type': 'static_library',
23 - 'variables': {
24 - 'jsoncpp_root': '<(third_party_dir)/jsoncpp',
25 - 'jsoncpp_srcs': [
26 - '<(jsoncpp_root)/src/lib_json/json_reader.cpp',
27 - '<(jsoncpp_root)/src/lib_json/json_value.cpp',
28 - '<(jsoncpp_root)/src/lib_json/json_writer.cpp',
29 - ],
30 - 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'],
31 - 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'],
32 - },
33 - 'defines': [
34 - '<@(jsoncpp_additional_macros)',
35 + 'conditions': [
36 + ['use_system_jsoncpp==1', {
37 + 'type': 'none',
38 + 'variables': {
39 + 'jsoncpp_additional_macros': [
40 + 'JSON_USE_EXCEPTION=0',
41 + 'MOZC_USE_SYSTEM_JSONCPP',
42 + ],
43 + },
44 + 'all_dependent_settings': {
45 + 'defines': [
46 + '<@(jsoncpp_additional_macros)',
47 + ],
48 + 'cflags': [
49 + '<!@(pkg-config --cflags jsoncpp)',
50 + ],
51 + 'link_settings': {
52 + 'libraries': [
53 + '<!@(pkg-config --libs-only-l jsoncpp)',
54 + ],
55 + 'ldflags': [
56 + '<!@(pkg-config --libs-only-L jsoncpp)',
57 + ],
58 + }
59 + },
60 + }, {
61 + 'type': 'static_library',
62 + 'variables': {
63 + 'jsoncpp_root': '<(third_party_dir)/jsoncpp',
64 + 'jsoncpp_srcs': [
65 + '<(jsoncpp_root)/src/lib_json/json_reader.cpp',
66 + '<(jsoncpp_root)/src/lib_json/json_value.cpp',
67 + '<(jsoncpp_root)/src/lib_json/json_writer.cpp',
68 + ],
69 + 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'],
70 + 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'],
71 + },
72 + 'defines': [
73 + '<@(jsoncpp_additional_macros)',
74 + ],
75 + 'sources': [
76 + '<@(jsoncpp_srcs)',
77 + 'jsoncpp.h',
78 + ],
79 + 'include_dirs': [
80 + '<@(jsoncpp_include_dirs)',
81 + ],
82 + 'all_dependent_settings': {
83 + 'defines': [
84 + '<@(jsoncpp_additional_macros)',
85 + ],
86 + },
87 + }],
89 - 'sources': [
90 - '<@(jsoncpp_srcs)',
91 - 'jsoncpp.h',
92 - ],
93 - 'include_dirs': [
94 - '<@(jsoncpp_include_dirs)',
95 - ],
96 - 'all_dependent_settings': {
97 - 'defines': [
98 - '<@(jsoncpp_additional_macros)',
99 - ],
100 - },
104 --- /src/net/jsoncpp.h
105 +++ /src/net/jsoncpp.h
106 @@ -35,7 +35,11 @@
107 // Mozc basically disables C++ exception.
108 #define JSON_USE_EXCEPTION 0
109 #endif // !JSON_USE_EXCEPTION
110 +#ifdef MOZC_USE_SYSTEM_JSONCPP
111 +#include <json/json.h>
112 +#else
113 #include "third_party/jsoncpp/include/json/json.h"
114 +#endif
115 #define MOZC_JSONCPP_JSON_H_INCLUDED
116 #endif // !MOZC_JSONCPP_JSON_H_INCLUDED