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