setup-makefiles.sh 2.3 KB

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