setup-makefiles.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
  13. if [ ! -f "${HELPER}" ]; then
  14. echo "Unable to find helper script at ${HELPER}"
  15. exit 1
  16. fi
  17. source "${HELPER}"
  18. function vendor_imports() {
  19. cat << EOF >> "$1"
  20. "device/xiaomi/sm8450-common",
  21. "hardware/qcom-caf/sm8450",
  22. "hardware/qcom-caf/wlan",
  23. "hardware/xiaomi",
  24. "vendor/qcom/opensource/commonsys/display",
  25. "vendor/qcom/opensource/commonsys-intf/display",
  26. "vendor/qcom/opensource/dataservices",
  27. EOF
  28. }
  29. function lib_to_package_fixup_vendor_variants() {
  30. if [ "$2" != "vendor" ]; then
  31. return 1
  32. fi
  33. case "$1" in
  34. [email protected] | \
  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. echo "$1-vendor"
  44. ;;
  45. libagm | \
  46. libar-pal | \
  47. libpalclient | \
  48. libwpa_client)
  49. ;;
  50. *)
  51. return 1
  52. esac
  53. }
  54. function lib_to_package_fixup() {
  55. lib_to_package_fixup_clang_rt_ubsan_standalone "$1" || \
  56. lib_to_package_fixup_proto_3_9_1 "$1" || \
  57. lib_to_package_fixup_vendor_variants "$@"
  58. }
  59. # Initialize the helper for common
  60. setup_vendor "${DEVICE_COMMON}" "${VENDOR_COMMON:-$VENDOR}" "${ANDROID_ROOT}" true
  61. # Warning headers and guards
  62. write_headers "cupid diting marble mayfly mondrian thor unicorn zeus ziyi zizhan"
  63. # The standard common blobs
  64. write_makefiles "${MY_DIR}/proprietary-files.txt"
  65. # Finish
  66. write_footers
  67. if [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" ]; then
  68. # Reinitialize the helper for device
  69. source "${MY_DIR}/../${DEVICE}/setup-makefiles.sh"
  70. setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false
  71. # Warning headers and guards
  72. write_headers
  73. # The standard device blobs
  74. write_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt"
  75. if [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then
  76. append_firmware_calls_to_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt"
  77. fi
  78. # Finish
  79. write_footers
  80. fi