setup-makefiles.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. #
  3. # SPDX-FileCopyrightText: 2016 The CyanogenMod Project
  4. # SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
  5. # SPDX-License-Identifier: Apache-2.0
  6. #
  7. set -e
  8. # Load extract_utils and do some sanity checks
  9. MY_DIR="${BASH_SOURCE%/*}"
  10. if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
  11. ANDROID_ROOT="${MY_DIR}/../../.."
  12. export TARGET_ENABLE_CHECKELF="true"
  13. HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
  14. if [ ! -f "${HELPER}" ]; then
  15. echo "Unable to find helper script at ${HELPER}"
  16. exit 1
  17. fi
  18. source "${HELPER}"
  19. function vendor_imports() {
  20. cat << EOF >> "$1"
  21. "device/xiaomi/sm8450-common",
  22. "hardware/qcom-caf/sm8450",
  23. "hardware/qcom-caf/wlan",
  24. "hardware/xiaomi",
  25. "vendor/qcom/opensource/commonsys/display",
  26. "vendor/qcom/opensource/commonsys-intf/display",
  27. "vendor/qcom/opensource/dataservices",
  28. EOF
  29. }
  30. function lib_to_package_fixup_vendor_variants() {
  31. if [ "$2" != "vendor" ]; then
  32. return 1
  33. fi
  34. case "$1" in
  35. [email protected] | \
  36. [email protected] | \
  37. [email protected] | \
  38. [email protected] | \
  39. [email protected] | \
  40. [email protected] | \
  41. [email protected] | \
  42. [email protected] | \
  43. [email protected])
  44. echo "$1-vendor"
  45. ;;
  46. libagm | \
  47. libar-pal | \
  48. libpalclient | \
  49. libwpa_client)
  50. ;;
  51. *)
  52. return 1
  53. esac
  54. }
  55. function lib_to_package_fixup() {
  56. lib_to_package_fixup_clang_rt_ubsan_standalone "$1" || \
  57. lib_to_package_fixup_proto_3_9_1 "$1" || \
  58. lib_to_package_fixup_vendor_variants "$@"
  59. }
  60. # Initialize the helper for common
  61. setup_vendor "${DEVICE_COMMON}" "${VENDOR_COMMON:-$VENDOR}" "${ANDROID_ROOT}" true
  62. # Warning headers and guards
  63. write_headers "cupid diting marble mayfly mondrian thor unicorn zeus ziyi zizhan"
  64. # The standard common blobs
  65. write_makefiles "${MY_DIR}/proprietary-files.txt"
  66. # Finish
  67. write_footers
  68. if [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" ]; then
  69. # Reinitialize the helper for device
  70. source "${MY_DIR}/../${DEVICE}/setup-makefiles.sh"
  71. setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false
  72. # Warning headers and guards
  73. write_headers
  74. # The standard device blobs
  75. write_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt"
  76. if [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then
  77. append_firmware_calls_to_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt"
  78. fi
  79. # Finish
  80. write_footers
  81. fi