setup-makefiles.sh 2.7 KB

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