summaryrefslogtreecommitdiffstats
path: root/build/android/native_app_dependencies.gypi
blob: d9241cc30323e44bb48c817bb293bf274ecb677a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file is meant to be included into a target to provide a rule
# to strip and place dependent shared libraries required by a native binary in a
# single folder that can later be pushed to the device.
#
# NOTE: consider packaging your binary as an apk instead of running a native
# library.
#
# To use this, create a gyp target with the following form:
#  {
#    'target_name': 'target_that_depends_on_my_binary',
#    'type': 'none',
#    'dependencies': [
#      'my_binary',
#    ],
#    'variables': {
#      'native_binary': '<(PRODUCT_DIR)/my_binary',
#      'output_dir': 'location to place binary and dependent libraries'
#    },
#    'includes': [ '../../build/android/native_app_dependencies.gypi' ],
#  },
#

{
  'copies': [
    {
      'destination': '<(output_dir)',
      'files': [ '<(native_binary)' ],
    }
  ],
  'conditions': [
      ['component == "shared_library"', {
        'dependencies': [
          '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
        ],
        'variables': {
          'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
          'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
        },
        'actions': [
          {
            'variables': {
              'input_libraries': ['<(native_binary)'],
            },
            'includes': ['../../build/android/write_ordered_libraries.gypi'],
          },
          {
            'action_name': 'stripping native libraries',
            'variables': {
              'stripped_libraries_dir%': '<(output_dir)',
              'input_paths': ['<(native_binary)'],
              'stamp': '<(intermediate_dir)/strip.stamp',
            },
            'includes': ['../../build/android/strip_native_libraries.gypi'],
          },
        ],
      }],
  ],
}