setup-makefiles.sh 2.5 KB

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