Chromium Code Reviews| Index: third_party/liblouis/BUILD.gn |
| diff --git a/third_party/liblouis/BUILD.gn b/third_party/liblouis/BUILD.gn |
| index 85e452c2d3c60fc4c579c07ef1d6dd84acbe72b7..92cb935b86a4ad80ac4125b2adc36aca4e8f1978 100644 |
| --- a/third_party/liblouis/BUILD.gn |
| +++ b/third_party/liblouis/BUILD.gn |
| @@ -2,46 +2,184 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -chromevox_braille_out_dir = "$root_out_dir/resources/chromeos/chromevox/braille" |
| +import("//build/config/nacl/config.gni") |
| +import("//build/config/nacl/rules.gni") |
| -group("liblouis") { |
| - data_deps = [ |
| - ":liblouis_tables", |
| - ":liblouis_tables_json", |
| - ] |
| -} |
| +if (current_toolchain == default_toolchain) { |
|
Peter Lundblad
2015/11/30 10:27:04
Curious, why do we need this check here?
Petr Hosek
2015/12/01 01:19:56
To ensure that these targets are not instantiated
|
| + chromevox_test_data_dir = "$root_build_dir/chromevox_test_data/braille" |
| + chromevox_braille_out_dir = |
|
Peter Lundblad
2015/11/30 10:27:04
nit: This is only used once, so could just use the
Petr Hosek
2015/12/01 01:19:56
Done.
|
| + "$root_build_dir/resources/chromeos/chromevox/braille" |
| + |
| + # Build Liblouis library |
| + # |
| + # This target is used to build and assemble Liblouis braille translator |
| + # including Native Client executable, manifest and translation tables. |
| + # |
| + # Variables: |
| + # dest_dir: destination path for all translator files |
|
Peter Lundblad
2015/11/30 10:27:04
List 'deps' here as well (no need for a descriptio
Petr Hosek
2015/12/01 01:19:56
Done.
|
| + template("liblouis_library") { |
| + assert(defined(invoker.dest_dir), "Must define dest_dir") |
| + forward_variables_from(invoker, [ "dest_dir" ]) |
| + |
| + tables_target_name = "${target_name}_tables" |
| + tables_json_target_name = "${target_name}_tables_json" |
| + nexe_target_name = "${target_name}_nexe" |
| + nmf_target_name = "${target_name}_nmf" |
| + |
| + action(tables_target_name) { |
|
Peter Lundblad
2015/11/30 10:27:04
Add visibility = [ ":$target_name" ]
Petr Hosek
2015/12/01 01:19:57
Done.
|
| + script = "copy_tables.py" |
| + inputs = [ |
| + "liblouis_list_tables.py", |
| + ] |
| + depfile = "$target_gen_dir/$target_name.d" |
| + sources = [ |
| + "tables.json", |
| + ] |
| + outputs = [ |
| + "$depfile.stamp", |
| + ] |
| + args = [ |
| + "-D", |
| + rebase_path(".", root_build_dir), |
| + "-D", |
| + rebase_path("src/tables", root_build_dir), |
| + "-d", |
| + rebase_path("$dest_dir/tables", root_build_dir), |
| + "-e", |
| + rebase_path("cvox-common.cti", root_build_dir), |
| + "--depfile", |
| + rebase_path(depfile, root_build_dir), |
| + ] + rebase_path(sources, root_build_dir) |
| + } |
| + |
| + copy(tables_json_target_name) { |
|
Peter Lundblad
2015/11/30 10:27:04
Add visibility = [ ":$target_name" ]
Petr Hosek
2015/12/01 01:19:56
Done.
|
| + sources = [ |
| + "tables.json", |
| + ] |
| + outputs = [ |
| + "$dest_dir/{{source_file_part}}", |
| + ] |
| + } |
| + |
| + copy(nexe_target_name) { |
|
Peter Lundblad
2015/11/30 10:27:04
Add visibility = [ ":$target_name" ]
Petr Hosek
2015/12/01 01:19:57
Done.
|
| + nacl_wrapper = "liblouis_nacl_wrapper(//build/toolchain/nacl:clang_newlib_${target_cpu})" |
| + path = get_label_info(":$nacl_wrapper", "root_out_dir") |
| + sources = [ |
| + "${path}/liblouis_nacl.nexe", |
| + ] |
| + |
| + if (current_cpu == "x86") { |
| + nmf_cpu = "x86_32" |
| + } else if (current_cpu == "x64") { |
| + nmf_cpu = "x86_64" |
| + } else { |
| + nmf_cpu = current_cpu |
| + } |
| + outputs = [ |
| + "$dest_dir/{{source_name_part}}_${nmf_cpu}.nexe", |
| + ] |
| + deps = [ |
| + ":$nacl_wrapper", |
| + ] |
| + } |
| + |
| + generate_nmf(nmf_target_name) { |
|
Peter Lundblad
2015/11/30 10:27:04
Add visibility = [ ":$target_name" ]
Petr Hosek
2015/12/01 01:19:57
Done.
|
| + executables = get_target_outputs(":$nexe_target_name") |
| + nmf = "$dest_dir/liblouis_nacl.nmf" |
| + deps = [ |
| + ":$nexe_target_name", |
| + ] |
| + } |
| -action("liblouis_tables") { |
| - script = "copy_tables.py" |
| - inputs = [ |
| - "liblouis_list_tables.py", |
| - ] |
| - depfile = "$target_gen_dir/tables.d" |
| - sources = [ |
| - "tables.json", |
| - ] |
| - outputs = [ |
| - "$depfile.stamp", |
| - ] |
| - args = [ |
| - "-D", |
| - rebase_path(".", root_build_dir), |
| - "-D", |
| - rebase_path("src/tables", root_build_dir), |
| - "-d", |
| - rebase_path("$chromevox_braille_out_dir/tables", root_build_dir), |
| - "-e", |
| - rebase_path("cvox-common.cti", root_build_dir), |
| - "--depfile", |
| - rebase_path(depfile, root_build_dir), |
| - ] + rebase_path(sources, root_build_dir) |
| + group(target_name) { |
| + deps = [ |
| + ":$nexe_target_name", |
| + ":$nmf_target_name", |
| + ":$tables_json_target_name", |
| + ":$tables_target_name", |
| + ] |
| + if (defined(invoker.deps)) { |
| + deps += invoker.deps |
| + } |
| + } |
| + } |
| + |
| + liblouis_library("liblouis") { |
| + dest_dir = chromevox_braille_out_dir |
| + } |
| + |
| + liblouis_library("liblouis_test_data") { |
| + dest_dir = chromevox_test_data_dir |
| + deps = [ |
| + ":liblouis_test_files", |
| + ] |
| + } |
|
Peter Lundblad
2015/11/30 10:27:04
Add testonly = true (see comment on the template i
Petr Hosek
2015/12/01 01:19:57
Done.
|
| + |
| + copy("liblouis_test_files") { |
|
Peter Lundblad
2015/11/30 10:27:04
Add
visibility = ":$liblouis_test_data"
and
te
Petr Hosek
2015/12/01 01:19:56
Done.
|
| + sources = [ |
| + "//chrome/test/data/chromeos/liblouis_nacl/manifest.json", |
| + "//chrome/test/data/chromeos/liblouis_nacl/test.js", |
| + ] |
| + outputs = [ |
| + "${chromevox_test_data_dir}/{{source_file_part}}", |
| + ] |
| + } |
| } |
| -copy("liblouis_tables_json") { |
| - sources = [ |
| - "tables.json", |
| - ] |
| - outputs = [ |
| - "$chromevox_braille_out_dir/{{source_file_part}}", |
| - ] |
| +if (is_nacl) { |
| + config("liblouis_nacl_config") { |
| + cflags = [ |
| + "-Wno-sign-compare", |
| + |
| + # Needed for target_arch=mipsel |
| + # src/liblouis/compileTranslationTable.c:1414 |
| + "-Wno-tautological-compare", |
| + |
| + # Needed for target_arch=mipsel |
| + # src/liblouis/logging.c:58 |
| + "-Wno-non-literal-null-conversion", |
| + ] |
| + } |
| + |
| + source_set("liblouis_nacl") { |
|
Peter Lundblad
2015/11/30 10:27:04
Add visibility = [ ":liblouis_nacl_wrapper" ]
Petr Hosek
2015/12/01 01:19:56
Done.
|
| + sources = [ |
| + "overrides/liblouis/config.h", |
| + "overrides/liblouis/liblouis.h", |
| + "src/liblouis/compileTranslationTable.c", |
| + "src/liblouis/logging.c", |
| + "src/liblouis/lou_backTranslateString.c", |
| + "src/liblouis/lou_translateString.c", |
| + "src/liblouis/transcommon.ci", |
| + "src/liblouis/wrappers.c", |
| + ] |
| + include_dirs = [ |
| + "overrides/liblouis", |
| + "src/liblouis", |
| + ".", |
| + "../..", |
| + ] |
| + configs += [ ":liblouis_nacl_config" ] |
| + } |
| + |
| + executable("liblouis_nacl_wrapper") { |
|
Peter Lundblad
2015/11/30 10:27:03
Add visibility = [ "*" ] or list the two targets.
Petr Hosek
2015/12/01 01:19:57
Done.
|
| + output_name = "liblouis_nacl" |
| + sources = [ |
| + "nacl_wrapper/liblouis_instance.cc", |
| + "nacl_wrapper/liblouis_instance.h", |
| + "nacl_wrapper/liblouis_module.cc", |
| + "nacl_wrapper/liblouis_module.h", |
| + "nacl_wrapper/liblouis_wrapper.cc", |
| + "nacl_wrapper/liblouis_wrapper.h", |
| + "nacl_wrapper/translation_params.h", |
| + "nacl_wrapper/translation_result.h", |
| + ] |
| + deps = [ |
| + ":liblouis_nacl", |
| + "//native_client/src/untrusted/nacl", |
| + "//native_client_sdk/src/libraries/nacl_io", |
| + "//ppapi:ppapi_cpp_lib", |
| + "//ppapi/native_client:ppapi_lib", |
| + "//third_party/jsoncpp", |
| + ] |
| + } |
| } |