setup-makefiles.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. DEVICE=lynx
  9. VENDOR=google
  10. # Load extract_utils and do some sanity checks
  11. MY_DIR="${BASH_SOURCE%/*}"
  12. if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
  13. ANDROID_ROOT="${MY_DIR}/../../../.."
  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/google/lynx",
  23. "hardware/google/av",
  24. "hardware/google/gchips",
  25. "hardware/google/graphics/common",
  26. "hardware/google/interfaces",
  27. "hardware/google/pixel",
  28. "hardware/qcom/wlan/wcn6740",
  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. com.google.edgetpu_app_service-V3-ndk | \
  37. com.google.edgetpu_vendor_service-V2-ndk)
  38. echo "$1-vendor"
  39. ;;
  40. libprotobuf-cpp-full-21.12)
  41. echo "libprotobuf-cpp-full"
  42. ;;
  43. libprotobuf-cpp-lite-21.12)
  44. echo "libprotobuf-cpp-lite"
  45. ;;
  46. libacryl | \
  47. libexynosv4l2 | \
  48. libwpa_client) ;;
  49. *)
  50. return 1
  51. ;;
  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
  60. setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}"
  61. # Warning headers and guards
  62. write_headers
  63. write_makefiles "${MY_DIR}/proprietary-files.txt"
  64. write_makefiles "${MY_DIR}/proprietary-files-carriersettings.txt"
  65. write_makefiles "${MY_DIR}/proprietary-files-vendor.txt"
  66. append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt"
  67. # Finish
  68. write_footers