blob: 85dda1400a234862b166df1ecb01753cada53afa [file] [log] [blame]
Fabien Sanglard0f29f542020-10-22 17:58:12 -07001/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ZIPALIGN_H
18#define ZIPALIGN_H
19
20namespace android {
21
22/*
23 * Generate a new, aligned, zip "output" from an "input" zip.
24 * - alignTo: Alignment (in bytes) for uncompressed entries.
25 * - force : Overwrite output if it exists, fail otherwise.
26 * - zopfli : Recompress compressed entries with more efficient algorithm.
27 * Copy compressed entries as-is, and unaligned, otherwise.
Kalesh Singh55405b62023-08-17 09:44:45 -070028 * - pageAlignSharedLibs: Align .so files to @pageSize and other files to
Fabien Sanglard0f29f542020-10-22 17:58:12 -070029 * alignTo, or all files to alignTo if false..
Kalesh Singh55405b62023-08-17 09:44:45 -070030 * - pageSize: Specifies the page size of the target device. This is used
31 * to correctly page-align shared libraries.
Fabien Sanglard0f29f542020-10-22 17:58:12 -070032 *
33 * Returns 0 on success.
34 */
35int process(const char* input, const char* output, int alignTo, bool force,
Kalesh Singh55405b62023-08-17 09:44:45 -070036 bool zopfli, bool pageAlignSharedLibs, int pageSize);
Fabien Sanglard0f29f542020-10-22 17:58:12 -070037
38/*
39 * Verify the alignment of a zip archive.
40 * - alignTo: Alignment (in bytes) for uncompressed entries.
Kalesh Singh55405b62023-08-17 09:44:45 -070041 * - pageAlignSharedLibs: Align .so files to @pageSize and other files to
Fabien Sanglard0f29f542020-10-22 17:58:12 -070042 * alignTo, or all files to alignTo if false..
Kalesh Singh55405b62023-08-17 09:44:45 -070043 * - pageSize: Specifies the page size of the target device. This is used
44 * to correctly page-align shared libraries.
Fabien Sanglard0f29f542020-10-22 17:58:12 -070045 *
46 * Returns 0 on success.
47 */
48int verify(const char* fileName, int alignTo, bool verbose,
Kalesh Singh55405b62023-08-17 09:44:45 -070049 bool pageAlignSharedLibs, int pageSize);
Fabien Sanglard0f29f542020-10-22 17:58:12 -070050
51} // namespace android
52
53#endif // ZIPALIGN_H