blob: d6dddee37ac1ddcd25bdc32cd4c5194d25e0dd14 [file] [log] [blame]
Michael Bestas411537b2020-12-28 00:58:46 +02001#!/bin/bash
2#
Michael Bestas7830bc12024-08-27 22:51:30 +03003# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
4# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
Michael Bestas411537b2020-12-28 00:58:46 +02005# SPDX-License-Identifier: Apache-2.0
6#
7
8set -e
9
Michael Bestas9e3d0d62024-05-28 03:47:26 +030010DEVICE=otter
11VENDOR=shift
Michael Bestas411537b2020-12-28 00:58:46 +020012
13# Load extract_utils and do some sanity checks
14MY_DIR="${BASH_SOURCE%/*}"
15if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
16
17ANDROID_ROOT="${MY_DIR}/../../.."
18
Aaron Kling6411f242024-08-14 01:44:45 -050019export TARGET_ENABLE_CHECKELF=true
20
Michael Bestas411537b2020-12-28 00:58:46 +020021HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
22if [ ! -f "${HELPER}" ]; then
23 echo "Unable to find helper script at ${HELPER}"
24 exit 1
25fi
26source "${HELPER}"
27
Aaron Kling7f92c8f2023-08-29 15:58:31 -050028function vendor_imports() {
29 cat <<EOF >>"$1"
Michael Bestas9e3d0d62024-05-28 03:47:26 +030030 "device/shift/otter",
Aaron Kling7f92c8f2023-08-29 15:58:31 -050031 "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",
37EOF
38}
39
Cosmin Tanislav5c861732024-08-17 02:23:32 +030040function lib_to_package_fixup_vendor_variants() {
41 if [ "$2" != "vendor" ]; then
42 return 1
43 fi
44
45 case "$1" in
Cosmin Tanislav4aee5e32024-08-17 02:03:24 +030046 com.qualcomm.qti.dpm.api@1.0 | \
Michael Bestasf9cb2b42024-08-25 13:45:39 +030047 libmmosal | \
48 vendor.qti.hardware.wifidisplaysession@1.0 | \
Cosmin Tanislav4aee5e32024-08-17 02:03:24 +030049 vendor.qti.imsrtpservice@3.0)
Cosmin Tanislav5c861732024-08-17 02:23:32 +030050 echo "$1-vendor"
51 ;;
Cosmin Tanislavd3de9382024-08-18 09:52:31 +030052 libOmxCore | \
53 libwfdaac_vendor | \
54 libwpa_client) ;;
Cosmin Tanislav5c861732024-08-17 02:23:32 +030055 *)
56 return 1
57 ;;
58 esac
59}
60
61function 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 Bestas411537b2020-12-28 00:58:46 +020067# Initialize the helper
68setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}"
69
70# Warning headers and guards
71write_headers
72
Michael Bestasc1e2b7b2024-09-10 02:07:58 +030073write_makefiles "${MY_DIR}/proprietary-files.txt"
Michael Bestas411537b2020-12-28 00:58:46 +020074
Michael Bestasbfccf732022-02-22 19:22:26 +020075append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt"
76
Michael Bestas411537b2020-12-28 00:58:46 +020077# Finish
78write_footers