Michael Bestas | 411537b | 2020-12-28 00:58:46 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Michael Bestas | 7830bc1 | 2024-08-27 22:51:30 +0300 | [diff] [blame] | 3 | # SPDX-FileCopyrightText: 2016 The CyanogenMod Project |
| 4 | # SPDX-FileCopyrightText: 2017-2024 The LineageOS Project |
Michael Bestas | 411537b | 2020-12-28 00:58:46 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | # |
| 7 | |
| 8 | set -e |
| 9 | |
Michael Bestas | 9e3d0d6 | 2024-05-28 03:47:26 +0300 | [diff] [blame] | 10 | DEVICE=otter |
| 11 | VENDOR=shift |
Michael Bestas | 411537b | 2020-12-28 00:58:46 +0200 | [diff] [blame] | 12 | |
| 13 | # Load extract_utils and do some sanity checks |
| 14 | MY_DIR="${BASH_SOURCE%/*}" |
| 15 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi |
| 16 | |
| 17 | ANDROID_ROOT="${MY_DIR}/../../.." |
| 18 | |
Aaron Kling | 6411f24 | 2024-08-14 01:44:45 -0500 | [diff] [blame] | 19 | export TARGET_ENABLE_CHECKELF=true |
| 20 | |
Michael Bestas | 411537b | 2020-12-28 00:58:46 +0200 | [diff] [blame] | 21 | HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" |
| 22 | if [ ! -f "${HELPER}" ]; then |
| 23 | echo "Unable to find helper script at ${HELPER}" |
| 24 | exit 1 |
| 25 | fi |
| 26 | source "${HELPER}" |
| 27 | |
Aaron Kling | 7f92c8f | 2023-08-29 15:58:31 -0500 | [diff] [blame] | 28 | function vendor_imports() { |
| 29 | cat <<EOF >>"$1" |
Michael Bestas | 9e3d0d6 | 2024-05-28 03:47:26 +0300 | [diff] [blame] | 30 | "device/shift/otter", |
Aaron Kling | 7f92c8f | 2023-08-29 15:58:31 -0500 | [diff] [blame] | 31 | "hardware/qcom-caf/sm8350", |
| 32 | "hardware/qcom-caf/wlan", |
| 33 | "vendor/qcom/opensource/commonsys/display", |
| 34 | "vendor/qcom/opensource/commonsys-intf/display", |
| 35 | "vendor/qcom/opensource/dataservices", |
| 36 | "vendor/qcom/opensource/display", |
| 37 | EOF |
| 38 | } |
| 39 | |
Cosmin Tanislav | 5c86173 | 2024-08-17 02:23:32 +0300 | [diff] [blame] | 40 | function lib_to_package_fixup_vendor_variants() { |
| 41 | if [ "$2" != "vendor" ]; then |
| 42 | return 1 |
| 43 | fi |
| 44 | |
| 45 | case "$1" in |
Cosmin Tanislav | 4aee5e3 | 2024-08-17 02:03:24 +0300 | [diff] [blame] | 46 | com.qualcomm.qti.dpm.api@1.0 | \ |
Michael Bestas | f9cb2b4 | 2024-08-25 13:45:39 +0300 | [diff] [blame] | 47 | libmmosal | \ |
| 48 | vendor.qti.hardware.wifidisplaysession@1.0 | \ |
Cosmin Tanislav | 4aee5e3 | 2024-08-17 02:03:24 +0300 | [diff] [blame] | 49 | vendor.qti.imsrtpservice@3.0) |
Cosmin Tanislav | 5c86173 | 2024-08-17 02:23:32 +0300 | [diff] [blame] | 50 | echo "$1-vendor" |
| 51 | ;; |
Cosmin Tanislav | d3de938 | 2024-08-18 09:52:31 +0300 | [diff] [blame] | 52 | libOmxCore | \ |
| 53 | libwfdaac_vendor | \ |
| 54 | libwpa_client) ;; |
Cosmin Tanislav | 5c86173 | 2024-08-17 02:23:32 +0300 | [diff] [blame] | 55 | *) |
| 56 | return 1 |
| 57 | ;; |
| 58 | esac |
| 59 | } |
| 60 | |
| 61 | function lib_to_package_fixup() { |
| 62 | lib_to_package_fixup_clang_rt_ubsan_standalone "$1" || |
| 63 | lib_to_package_fixup_proto_3_9_1 "$1" || |
| 64 | lib_to_package_fixup_vendor_variants "$@" |
| 65 | } |
| 66 | |
Michael Bestas | 411537b | 2020-12-28 00:58:46 +0200 | [diff] [blame] | 67 | # Initialize the helper |
| 68 | setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" |
| 69 | |
| 70 | # Warning headers and guards |
| 71 | write_headers |
| 72 | |
Michael Bestas | c1e2b7b | 2024-09-10 02:07:58 +0300 | [diff] [blame] | 73 | write_makefiles "${MY_DIR}/proprietary-files.txt" |
Michael Bestas | 411537b | 2020-12-28 00:58:46 +0200 | [diff] [blame] | 74 | |
Michael Bestas | bfccf73 | 2022-02-22 19:22:26 +0200 | [diff] [blame] | 75 | append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt" |
| 76 | |
Michael Bestas | 411537b | 2020-12-28 00:58:46 +0200 | [diff] [blame] | 77 | # Finish |
| 78 | write_footers |