1 # Copyright (C) 2017 The Android Open Source Project 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 { 16 'target_defaults': { 17 'cflags': [ 18 '-Wextra', 19 '-Wno-unused-parameter', 20 ], 21 'cflags_cc': [ 22 '-Wnon-virtual-dtor', 23 ], 24 'include_dirs': [ 25 'include', 26 # We need this include dir because we include all the local code as 27 # "bsdiff/...". 28 '<(platform2_root)/../aosp/external', 29 ], 30 'defines': [ 31 '_FILE_OFFSET_BITS=64', 32 ], 33 }, 34 'targets': [ 35 # bsdiff static library 36 { 37 'target_name': 'libbsdiff-static', 38 'type': 'static_library', 39 'cflags!': ['-fPIE'], 40 'cflags': ['-fPIC'], 41 'all_dependent_settings': { 42 'link_settings': { 43 'libraries': [ 44 '-lbz2', 45 '-lbrotlienc', 46 '-ldivsufsort', 47 '-ldivsufsort64', 48 ], 49 }, 50 }, 51 'sources': [ 52 'brotli_compressor.cc', 53 'bsdiff.cc', 54 'bz2_compressor.cc', 55 'compressor_buffer.cc', 56 'diff_encoder.cc', 57 'endsley_patch_writer.cc', 58 'logging.cc', 59 'patch_writer.cc', 60 'patch_writer_factory.cc', 61 'split_patch_writer.cc', 62 'suffix_array_index.cc', 63 ], 64 }, 65 # bsdiff shared library 66 { 67 'target_name': 'libbsdiff', 68 'type': 'shared_library', 69 'dependencies': [ 70 'libbsdiff-static', 71 ], 72 }, 73 # bsdiff executable 74 { 75 'target_name': 'bsdiff', 76 'type': 'executable', 77 'dependencies': [ 78 'libbsdiff', 79 ], 80 'sources': [ 81 'bsdiff_arguments.cc', 82 'bsdiff_main.cc', 83 ], 84 }, 85 # bspatch static library 86 { 87 'target_name': 'libbspatch-static', 88 'type': 'static_library', 89 'cflags!': ['-fPIE'], 90 'cflags': ['-fPIC'], 91 'all_dependent_settings': { 92 'link_settings': { 93 'libraries': [ 94 '-lbz2', 95 '-lbrotlidec', 96 ], 97 }, 98 }, 99 'sources': [ 100 'brotli_decompressor.cc', 101 'bspatch.cc', 102 'buffer_file.cc', 103 'bz2_decompressor.cc', 104 'decompressor_interface.cc', 105 'extents.cc', 106 'extents_file.cc', 107 'file.cc', 108 'logging.cc', 109 'memory_file.cc', 110 'patch_reader.cc', 111 'sink_file.cc', 112 'utils.cc', 113 ], 114 }, 115 # bspatch shared library 116 { 117 'target_name': 'libbspatch', 118 'type': 'shared_library', 119 'dependencies': [ 120 'libbspatch-static', 121 ], 122 }, 123 # bspatch executable 124 { 125 'target_name': 'bspatch', 126 'type': 'executable', 127 'dependencies': [ 128 'libbspatch', 129 ], 130 'sources': [ 131 'bspatch_main.cc', 132 ], 133 }, 134 ], 135 'conditions': [ 136 ['USE_test == 1', { 137 'targets': [ 138 { 139 'target_name': 'bsdiff_unittest', 140 'type': 'executable', 141 'dependencies': [ 142 'libbsdiff-static', 143 'libbspatch-static', 144 '../common-mk/testrunner.gyp:testrunner', 145 ], 146 'variables': { 147 'deps': [ 148 'libchrome-<(libbase_ver)', 149 ], 150 }, 151 'includes': ['../common-mk/common_test.gypi'], 152 'sources': [ 153 'brotli_compressor_unittest.cc', 154 'bsdiff_arguments.cc', 155 'bsdiff_arguments_unittest.cc', 156 'bsdiff_unittest.cc', 157 'bspatch_unittest.cc', 158 'diff_encoder_unittest.cc', 159 'endsley_patch_writer_unittest.cc', 160 'extents_file_unittest.cc', 161 'extents_unittest.cc', 162 'patch_reader_unittest.cc', 163 'patch_writer_unittest.cc', 164 'split_patch_writer_unittest.cc', 165 'suffix_array_index_unittest.cc', 166 'test_utils.cc', 167 ], 168 }, 169 ], 170 }], 171 ], 172 } 173