f7ada94d1bb3df60e91e8b4f7ab45143805c55cc
[platform/framework/web/crosswalk.git] / src / third_party / liblouis / liblouis_nacl.gyp
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 {
6   'variables': {
7     'braille_test_data_dir': '<(PRODUCT_DIR)/chromevox_test_data/braille',
8     'braille_chromevox_dir': '<(PRODUCT_DIR)/resources/chromeos/chromevox/chromevox/background/braille',
9     'table_files': [
10       '>!@pymod_do_main(liblouis_list_tables -D . -D src/tables -e cvox-common.cti tables.json)',
11     ],
12   },
13   # x86 targets build both 32 and 64 bit binaries by default.  We only need
14   # the one that matches our target architecture.
15   'target_defaults': {
16     'conditions': [
17       ['target_arch=="ia32"', {
18         'variables': {
19           'enable_x86_64': 0,
20         },
21       }],
22       ['target_arch=="x64"', {
23         'variables': {
24           'enable_x86_32': 0,
25         },
26       }],
27     ],
28   },
29   'includes': [
30     '../../build/common_untrusted.gypi',
31   ],
32   'conditions': [
33     ['disable_nacl==0 and disable_nacl_untrusted==0', {
34       'targets': [
35         {
36           'target_name': 'liblouis_nacl',
37           'type': 'none',
38           'variables': {
39             'nacl_untrusted_build': 1,
40             'nlib_target': 'liblouis_nacl.a',
41             'build_newlib': 1,
42           },
43           'compile_flags': [
44             '-Wno-switch',
45             '-Wno-unused-but-set-variable',
46           ],
47           'include_dirs': [
48             'overrides/liblouis',
49             'src/liblouis',
50             '.',
51           ],
52           'direct_dependent_settings': {
53             'include_dirs': [
54               'overrides',
55             ],
56           },
57           'sources': [
58             'overrides/liblouis/config.h',
59             'overrides/liblouis/liblouis.h',
60             'src/liblouis/compileTranslationTable.c',
61             'src/liblouis/logging.c',
62             'src/liblouis/lou_backTranslateString.c',
63             'src/liblouis/lou_translateString.c',
64             'src/liblouis/transcommon.ci',
65             'src/liblouis/wrappers.c',
66           ],
67           'dependencies': [
68             '../../native_client/tools.gyp:prep_toolchain',
69           ],
70         },
71         {
72           'target_name': 'liblouis_nacl_wrapper_nacl',
73           'type': 'none',
74           'variables': {
75             'nacl_untrusted_build': 1,
76             'nexe_target': 'liblouis_nacl',
77             'out_newlib64': '<(braille_test_data_dir)/>(nexe_target)_x86_64.nexe',
78             'out_newlib32': '<(braille_test_data_dir)/>(nexe_target)_x86_32.nexe',
79             'out_newlib_arm': '<(braille_test_data_dir)/>(nexe_target)_arm.nexe',
80             'out_newlib_mips': '<(braille_test_data_dir)/>(nexe_target)_mips32.nexe',
81             'build_newlib': 1,
82             'extra_args': [
83               '--strip-debug',
84             ],
85             'nmf': '<(braille_test_data_dir)/>(nexe_target).nmf',
86             'target_conditions': [
87               ['enable_x86_64==1', {
88                 'nexe_files': ['>(out_newlib64)'],
89               }],
90               ['enable_x86_32==1', {
91                 'nexe_files': ['>(out_newlib32)'],
92               }],
93               ['enable_arm==1', {
94                 'nexe_files': ['>(out_newlib_arm)'],
95               }],
96               ['enable_mips==1', {
97                 'nexe_files': ['>(out_newlib_mips)'],
98               }],
99             ],
100           },
101           'sources': [
102             'nacl_wrapper/liblouis_instance.h',
103             'nacl_wrapper/liblouis_instance.cc',
104             'nacl_wrapper/liblouis_module.h',
105             'nacl_wrapper/liblouis_module.cc',
106             'nacl_wrapper/liblouis_wrapper.h',
107             'nacl_wrapper/liblouis_wrapper.cc',
108             'nacl_wrapper/translation_params.h',
109             'nacl_wrapper/translation_result.h',
110           ],
111           'link_flags': [
112             '-lppapi',
113             '-lppapi_cpp',
114             '-llouis_nacl',
115             '-ljsoncpp_nacl',
116             '-lpthread',
117             '-lnacl_io',
118           ],
119           'dependencies': [
120             '../../native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
121             '../../native_client/tools.gyp:prep_toolchain',
122             '../../native_client_sdk/native_client_sdk_untrusted.gyp:nacl_io_untrusted',
123             '../../ppapi/native_client/native_client.gyp:ppapi_lib',
124             '../../ppapi/ppapi_nacl.gyp:ppapi_cpp_lib',
125             '../jsoncpp/jsoncpp_nacl.gyp:jsoncpp_nacl',
126             'liblouis_nacl',
127           ],
128           'actions': [
129             {
130               'action_name': 'Generate NEWLIB NMF',
131               'inputs': [
132                 '>@(nexe_files)',
133               ],
134               'outputs': ['>(nmf)'],
135               'action': [
136                 'python',
137                 '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
138                 '>@(_inputs)',
139                 '--output=>(nmf)',
140               ],
141             },
142           ],
143           # Copy specific files into the product directory to avoid
144           # copying over the unstripped binary file.
145           'copies': [
146             {
147               'destination': '<(braille_chromevox_dir)',
148               'files': [
149                 '<(nmf)',
150                 '>@(nexe_files)',
151                 'tables.json',
152               ],
153             },
154             {
155               'destination': '<(braille_chromevox_dir)/tables',
156               'files': [
157                 '<@(table_files)',
158               ],
159             },
160           ],
161         },
162         {
163           'target_name': 'liblouis_test_data',
164           'type': 'none',
165           'variables': {
166             'test_extension_dir': '<(DEPTH)/chrome/test/data/chromeos/liblouis_nacl',
167           },
168           'dependencies': [
169             'liblouis_nacl_wrapper_nacl',
170           ],
171           'copies': [
172             {
173               'destination': '<(braille_test_data_dir)',
174               'files': [
175                 'tables.json',
176                 '<(test_extension_dir)/manifest.json',
177                 '<(test_extension_dir)/test.js',
178               ],
179             },
180             {
181               'destination': '<(braille_test_data_dir)/tables',
182               'files': [
183                 '<@(table_files)',
184               ],
185             },
186           ],
187         },
188       ],
189     }],
190   ],
191 }