setup-makefiles.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. echo "$1-vendor"
  43. ;;
  44. *)
  45. return 1
  46. esac
  47. }
  48. function lib_to_package_fixup() {
  49. lib_to_package_fixup_clang_rt_ubsan_standalone "$1" || \
  50. lib_to_package_fixup_proto_3_9_1 "$1" || \
  51. lib_to_package_fixup_vendor_variants "$@"
  52. }
  53. # Initialize the helper for common
  54. setup_vendor "${DEVICE_COMMON}" "${VENDOR_COMMON:-$VENDOR}" "${ANDROID_ROOT}" true
  55. # Warning headers and guards
  56. write_headers "cupid diting marble mayfly mondrian thor unicorn zeus ziyi zizhan"
  57. # The standard common blobs
  58. write_makefiles "${MY_DIR}/proprietary-files.txt" true
  59. # Finish
  60. write_footers
  61. if [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" ]; then
  62. # Reinitialize the helper for device
  63. source "${MY_DIR}/../${DEVICE}/setup-makefiles.sh"
  64. setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false
  65. # Warning headers and guards
  66. write_headers
  67. # The standard device blobs
  68. write_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" true
  69. if [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then
  70. append_firmware_calls_to_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt"
  71. fi
  72. # Finish
  73. write_footers
  74. fi