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.
5 # This template makes a stub for a Linux system library that dynamically loads
8 # name: Name to use for the value of the --name arg.
9 # output_h/output_cc: Names for the generated header/cc file with no dir.
10 # header: header file to process. Example: "<foo/bar.h>"
11 # functions: List of strings for functions to process.
12 # config: (optional) Label of the config generated by pkgconfig.
13 # bundled_header: (optional)
14 template("generate_library_loader") {
15 output_h = "$root_gen_dir/library_loaders/" + invoker.output_h
16 output_cc = "$root_gen_dir/library_loaders/" + invoker.output_cc
18 action_visibility = [ ":$target_name" ]
19 action("${target_name}_loader") {
20 visibility = action_visibility
22 script = "//tools/generate_library_loader/generate_library_loader.py"
23 if (defined(invoker.visibility)) {
24 visibility = invoker.visibility
36 rebase_path(output_h),
38 rebase_path(output_cc),
42 # Note GYP build exposes a per-target variable to control this, which, if
43 # manually set to true, will disable dlopen(). Its not clear this is
44 # needed, so here we just leave off. If this can be done globally, we can
45 # expose one switch for this value, otherwise we need to add a template
49 if (defined(invoker.bundled_header)) {
52 invoker.bundled_header,
55 args += invoker.functions
58 source_set(target_name) {
59 if (defined(invoker.config)) {
60 public_configs = [ invoker.config ]
67 ":${target_name}_loader",