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
15package {
16    default_applicable_licenses: ["bootable_recovery_applypatch_license"],
17}
18
19// Added automatically by a large-scale-change
20// See: http://go/android-license-faq
21license {
22    name: "bootable_recovery_applypatch_license",
23    visibility: [":__subpackages__"],
24    license_kinds: [
25        "SPDX-license-identifier-Apache-2.0",
26    ],
27    license_text: [
28        "NOTICE",
29    ],
30}
31
32cc_defaults {
33    name: "applypatch_defaults",
34
35    cflags: [
36        "-D_FILE_OFFSET_BITS=64",
37        "-DZLIB_CONST",
38        "-Wall",
39        "-Werror",
40    ],
41
42    local_include_dirs: [
43        "include",
44    ],
45}
46
47cc_library_static {
48    name: "libapplypatch",
49
50    host_supported: true,
51    vendor_available: true,
52
53    defaults: [
54        "applypatch_defaults",
55    ],
56
57    srcs: [
58        "applypatch.cpp",
59        "bspatch.cpp",
60        "freecache.cpp",
61        "imgpatch.cpp",
62    ],
63
64    export_include_dirs: [
65        "include",
66    ],
67
68    static_libs: [
69        "libbase",
70        "libbspatch",
71        "libbz",
72        "libedify",
73        "libotautil",
74        "libz_stable",
75    ],
76
77    shared_libs: [
78        "libcrypto",
79    ],
80
81    target: {
82        darwin: {
83            enabled: false,
84        },
85    },
86}
87
88cc_library_static {
89    name: "libapplypatch_modes",
90    vendor_available: true,
91
92    defaults: [
93        "applypatch_defaults",
94    ],
95
96    srcs: [
97        "applypatch_modes.cpp",
98    ],
99
100    static_libs: [
101        "libapplypatch",
102        "libbase",
103        "libedify",
104        "libotautil",
105    ],
106
107    shared_libs: [
108        "libcrypto",
109    ],
110}
111
112cc_binary {
113    name: "applypatch",
114    vendor: true,
115
116    defaults: [
117        "applypatch_defaults",
118    ],
119
120    srcs: [
121        "applypatch_main.cpp",
122    ],
123
124    static_libs: [
125        "libapplypatch_modes",
126        "libapplypatch",
127        "libedify",
128        "libotautil",
129
130        // External dependencies.
131        "libbspatch",
132        "libbrotli",
133        "libbz",
134    ],
135
136    shared_libs: [
137        "libbase",
138        "libcrypto",
139        "liblog",
140        "libz_stable",
141        "libziparchive",
142    ],
143
144    init_rc: [
145        "vendor_flash_recovery.rc",
146    ],
147}
148
149cc_library_static {
150    name: "libimgdiff",
151    host_supported: true,
152    defaults: [
153        "applypatch_defaults",
154    ],
155
156    srcs: [
157        "imgdiff.cpp",
158    ],
159
160    export_include_dirs: [
161        "include",
162    ],
163
164    static_libs: [
165        "libbase",
166        "libbsdiff",
167        "libdivsufsort",
168        "libdivsufsort64",
169        "liblog",
170        "libotautil",
171        "libutils",
172        "libz_stable",
173        "libziparchive",
174    ],
175}
176
177cc_binary_host {
178    name: "imgdiff",
179    srcs: [
180        "imgdiff_main.cpp",
181    ],
182
183    defaults: [
184        "applypatch_defaults",
185    ],
186
187    static_libs: [
188        "libimgdiff",
189        "libotautil",
190        "libbsdiff",
191        "libdivsufsort",
192        "libdivsufsort64",
193        "libziparchive",
194        "libbase",
195        "libutils",
196        "liblog",
197        "libbrotli",
198        "libbz",
199        "libz_stable",
200    ],
201}
202