Michael Bestas | c3a1fe5 | 2024-11-03 07:33:51 +0200 | [diff] [blame] | 1 | #!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3 |
| 2 | # |
| 3 | # SPDX-FileCopyrightText: 2024 The LineageOS Project |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | # |
| 6 | |
| 7 | from extract_utils.fixups_blob import ( |
| 8 | blob_fixup, |
| 9 | blob_fixups_user_type, |
| 10 | ) |
| 11 | from extract_utils.fixups_lib import ( |
| 12 | lib_fixup_remove, |
LuK1337 | 6317766 | 2024-11-06 11:56:59 +0100 | [diff] [blame] | 13 | lib_fixups, |
Michael Bestas | c3a1fe5 | 2024-11-03 07:33:51 +0200 | [diff] [blame] | 14 | lib_fixups_user_type, |
Michael Bestas | c3a1fe5 | 2024-11-03 07:33:51 +0200 | [diff] [blame] | 15 | ) |
| 16 | from extract_utils.main import ( |
| 17 | ExtractUtils, |
| 18 | ExtractUtilsModule, |
| 19 | ) |
| 20 | |
| 21 | namespace_imports = [ |
| 22 | 'device/shift/otter', |
| 23 | 'hardware/qcom-caf/sm8350', |
| 24 | 'hardware/qcom-caf/wlan', |
| 25 | 'vendor/qcom/opensource/commonsys/display', |
| 26 | 'vendor/qcom/opensource/commonsys-intf/display', |
| 27 | 'vendor/qcom/opensource/dataservices', |
| 28 | 'vendor/qcom/opensource/display', |
| 29 | ] |
| 30 | |
| 31 | |
| 32 | def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs): |
| 33 | return f'{lib}_{partition}' if partition == 'vendor' else None |
| 34 | |
| 35 | |
| 36 | lib_fixups: lib_fixups_user_type = { |
LuK1337 | 6317766 | 2024-11-06 11:56:59 +0100 | [diff] [blame] | 37 | **lib_fixups, |
Michael Bestas | c3a1fe5 | 2024-11-03 07:33:51 +0200 | [diff] [blame] | 38 | ( |
| 39 | 'com.qualcomm.qti.dpm.api@1.0', |
| 40 | 'libmmosal', |
| 41 | 'vendor.qti.hardware.wifidisplaysession@1.0', |
| 42 | 'vendor.qti.imsrtpservice@3.0', |
| 43 | ): lib_fixup_vendor_suffix, |
| 44 | ( |
| 45 | 'libOmxCore', |
| 46 | 'libwpa_client', |
| 47 | ): lib_fixup_remove, |
| 48 | } |
| 49 | |
| 50 | blob_fixups: blob_fixups_user_type = { |
| 51 | 'system_ext/lib/libwfdmmsrc_system.so': blob_fixup() |
| 52 | .add_needed('libgui_shim.so'), |
| 53 | 'system_ext/lib/libwfdservice.so': blob_fixup() |
| 54 | .replace_needed('android.media.audio.common.types-V2-cpp.so', 'android.media.audio.common.types-V3-cpp.so'), |
| 55 | 'system_ext/lib64/libwfdnative.so': blob_fixup() |
| 56 | .replace_needed('android.hidl.base@1.0.so', 'libhidlbase.so') |
| 57 | .add_needed('libinput_shim.so'), |
| 58 | 'vendor/lib64/hw/fingerprint.lahaina.so': blob_fixup() |
| 59 | .fix_soname(), |
| 60 | 'vendor/lib64/libwvhidl.so': blob_fixup() |
| 61 | .add_needed('libcrypto_shim.so'), |
| 62 | } # fmt: skip |
| 63 | |
| 64 | module = ExtractUtilsModule( |
| 65 | 'otter', |
| 66 | 'shift', |
| 67 | blob_fixups=blob_fixups, |
| 68 | lib_fixups=lib_fixups, |
| 69 | namespace_imports=namespace_imports, |
| 70 | add_firmware_proprietary_file=True, |
| 71 | ) |
| 72 | |
| 73 | if __name__ == '__main__': |
| 74 | utils = ExtractUtils.device(module) |
| 75 | utils.run() |