blob: 4651ac36e542ad030891cd24a8b3e87c6b4585bf [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001# Copyright 2013 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# This file is meant to be included into a target to provide a rule
6# to strip and place dependent shared libraries required by a native binary in a
7# single folder that can later be pushed to the device.
8#
9# NOTE: consider packaging your binary as an apk instead of running a native
10# library.
11#
12# To use this, create a gyp target with the following form:
13# {
14# 'target_name': 'target_that_depends_on_my_binary',
15# 'type': 'none',
16# 'dependencies': [
17# 'my_binary',
18# ],
19# 'variables': {
20# 'native_binary': '<(PRODUCT_DIR)/my_binary',
21# 'output_dir': 'location to place binary and dependent libraries'
22# },
23# 'includes': [ '../../build/android/native_app_dependencies.gypi' ],
24# },
25#
26
27{
28 'variables': {
29 'include_main_binary%': 1,
30 'extra_files%': [],
31 },
32 'conditions': [
33 ['android_must_copy_system_libraries == 1', {
34 'dependencies': [
35 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
36 ],
37 'variables': {
38 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
39 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
40 },
41 'actions': [
42 {
43 'variables': {
44 'input_libraries': ['<(native_binary)'],
45 },
46 'includes': ['../../build/android/write_ordered_libraries.gypi'],
47 },
48 {
49 'action_name': 'stripping native libraries',
50 'variables': {
51 'stripped_libraries_dir%': '<(output_dir)',
52 'input_paths': ['<(native_binary)'],
53 'stamp': '<(intermediate_dir)/strip.stamp',
54 },
55 'includes': ['../../build/android/strip_native_libraries.gypi'],
56 },
57 ],
58 }],
59 ['extra_files!=[]', {
60 'copies': [
61 {
62 'destination': '<(output_dir)',
63 'files': [ '<@(extra_files)' ],
64 }
65 ],
66 }],
67 ['include_main_binary==1', {
68 'copies': [
69 {
70 'destination': '<(output_dir)',
71 'files': [ '<(native_binary)' ],
72 }
73 ],
74 }],
75 ],
76}