xref: /aosp_15_r20/build/make/tools/zipalign/include/ZipAlign.h (revision 9e94795a3d4ef5c1d47486f9a02bb378756cea8a)
1*9e94795aSAndroid Build Coastguard Worker /*
2*9e94795aSAndroid Build Coastguard Worker  * Copyright (C) 2020 The Android Open Source Project
3*9e94795aSAndroid Build Coastguard Worker  *
4*9e94795aSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*9e94795aSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*9e94795aSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*9e94795aSAndroid Build Coastguard Worker  *
8*9e94795aSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*9e94795aSAndroid Build Coastguard Worker  *
10*9e94795aSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*9e94795aSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*9e94795aSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*9e94795aSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*9e94795aSAndroid Build Coastguard Worker  * limitations under the License.
15*9e94795aSAndroid Build Coastguard Worker  */
16*9e94795aSAndroid Build Coastguard Worker 
17*9e94795aSAndroid Build Coastguard Worker #ifndef ZIPALIGN_H
18*9e94795aSAndroid Build Coastguard Worker #define ZIPALIGN_H
19*9e94795aSAndroid Build Coastguard Worker 
20*9e94795aSAndroid Build Coastguard Worker namespace android {
21*9e94795aSAndroid Build Coastguard Worker 
22*9e94795aSAndroid Build Coastguard Worker /*
23*9e94795aSAndroid Build Coastguard Worker  * Generate a new, aligned, zip "output" from an "input" zip.
24*9e94795aSAndroid Build Coastguard Worker  * - alignTo: Alignment (in bytes) for uncompressed entries.
25*9e94795aSAndroid Build Coastguard Worker  * - force  : Overwrite output if it exists, fail otherwise.
26*9e94795aSAndroid Build Coastguard Worker  * - zopfli : Recompress compressed entries with more efficient algorithm.
27*9e94795aSAndroid Build Coastguard Worker  *            Copy compressed entries as-is, and unaligned, otherwise.
28*9e94795aSAndroid Build Coastguard Worker  * - pageAlignSharedLibs: Align .so files to @pageSize and other files to
29*9e94795aSAndroid Build Coastguard Worker  *   alignTo, or all files to alignTo if false..
30*9e94795aSAndroid Build Coastguard Worker  * - pageSize: Specifies the page size of the target device. This is used
31*9e94795aSAndroid Build Coastguard Worker  *             to correctly page-align shared libraries.
32*9e94795aSAndroid Build Coastguard Worker  *
33*9e94795aSAndroid Build Coastguard Worker  * Returns 0 on success.
34*9e94795aSAndroid Build Coastguard Worker  */
35*9e94795aSAndroid Build Coastguard Worker int process(const char* input, const char* output, int alignTo, bool force,
36*9e94795aSAndroid Build Coastguard Worker     bool zopfli, bool pageAlignSharedLibs, int pageSize);
37*9e94795aSAndroid Build Coastguard Worker 
38*9e94795aSAndroid Build Coastguard Worker /*
39*9e94795aSAndroid Build Coastguard Worker  * Verify the alignment of a zip archive.
40*9e94795aSAndroid Build Coastguard Worker  * - alignTo: Alignment (in bytes) for uncompressed entries.
41*9e94795aSAndroid Build Coastguard Worker  * - pageAlignSharedLibs: Align .so files to @pageSize and other files to
42*9e94795aSAndroid Build Coastguard Worker  *   alignTo, or all files to alignTo if false..
43*9e94795aSAndroid Build Coastguard Worker  * - pageSize: Specifies the page size of the target device. This is used
44*9e94795aSAndroid Build Coastguard Worker  *             to correctly page-align shared libraries.
45*9e94795aSAndroid Build Coastguard Worker  *
46*9e94795aSAndroid Build Coastguard Worker  * Returns 0 on success.
47*9e94795aSAndroid Build Coastguard Worker  */
48*9e94795aSAndroid Build Coastguard Worker int verify(const char* fileName, int alignTo, bool verbose,
49*9e94795aSAndroid Build Coastguard Worker     bool pageAlignSharedLibs, int pageSize);
50*9e94795aSAndroid Build Coastguard Worker 
51*9e94795aSAndroid Build Coastguard Worker } // namespace android
52*9e94795aSAndroid Build Coastguard Worker 
53*9e94795aSAndroid Build Coastguard Worker #endif // ZIPALIGN_H
54