Fabien Sanglard | 0f29f54 | 2020-10-22 17:58:12 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | namespace 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 Singh | 55405b6 | 2023-08-17 09:44:45 -0700 | [diff] [blame] | 28 | * - pageAlignSharedLibs: Align .so files to @pageSize and other files to |
Fabien Sanglard | 0f29f54 | 2020-10-22 17:58:12 -0700 | [diff] [blame] | 29 | * alignTo, or all files to alignTo if false.. |
Kalesh Singh | 55405b6 | 2023-08-17 09:44:45 -0700 | [diff] [blame] | 30 | * - pageSize: Specifies the page size of the target device. This is used |
| 31 | * to correctly page-align shared libraries. |
Fabien Sanglard | 0f29f54 | 2020-10-22 17:58:12 -0700 | [diff] [blame] | 32 | * |
| 33 | * Returns 0 on success. |
| 34 | */ |
| 35 | int process(const char* input, const char* output, int alignTo, bool force, |
Kalesh Singh | 55405b6 | 2023-08-17 09:44:45 -0700 | [diff] [blame] | 36 | bool zopfli, bool pageAlignSharedLibs, int pageSize); |
Fabien Sanglard | 0f29f54 | 2020-10-22 17:58:12 -0700 | [diff] [blame] | 37 | |
| 38 | /* |
| 39 | * Verify the alignment of a zip archive. |
| 40 | * - alignTo: Alignment (in bytes) for uncompressed entries. |
Kalesh Singh | 55405b6 | 2023-08-17 09:44:45 -0700 | [diff] [blame] | 41 | * - pageAlignSharedLibs: Align .so files to @pageSize and other files to |
Fabien Sanglard | 0f29f54 | 2020-10-22 17:58:12 -0700 | [diff] [blame] | 42 | * alignTo, or all files to alignTo if false.. |
Kalesh Singh | 55405b6 | 2023-08-17 09:44:45 -0700 | [diff] [blame] | 43 | * - pageSize: Specifies the page size of the target device. This is used |
| 44 | * to correctly page-align shared libraries. |
Fabien Sanglard | 0f29f54 | 2020-10-22 17:58:12 -0700 | [diff] [blame] | 45 | * |
| 46 | * Returns 0 on success. |
| 47 | */ |
| 48 | int verify(const char* fileName, int alignTo, bool verbose, |
Kalesh Singh | 55405b6 | 2023-08-17 09:44:45 -0700 | [diff] [blame] | 49 | bool pageAlignSharedLibs, int pageSize); |
Fabien Sanglard | 0f29f54 | 2020-10-22 17:58:12 -0700 | [diff] [blame] | 50 | |
| 51 | } // namespace android |
| 52 | |
| 53 | #endif // ZIPALIGN_H |