setup-makefiles.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. #
  3. # Copyright (C) 2016 The CyanogenMod Project
  4. # Copyright (C) 2017-2021 The LineageOS Project
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. set -e
  19. export DEVICE_COMMON=common
  20. export VENDOR=gapps
  21. # Load extract_utils and do some sanity checks
  22. MY_DIR="${BASH_SOURCE%/*}"
  23. if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
  24. ANDROID_ROOT="$MY_DIR/../.."
  25. HELPER="$ANDROID_ROOT/tools/extract-utils/extract_utils.sh"
  26. if [ ! -f "$HELPER" ]; then
  27. echo "Unable to find helper script at $HELPER"
  28. exit 1
  29. fi
  30. . "$HELPER"
  31. # Initialize the helper for common gapps
  32. setup_vendor "$DEVICE_COMMON" "$VENDOR" "$ANDROID_ROOT" true
  33. # Copyright headers
  34. write_headers "arm arm64 x86 x86_64"
  35. # Common gapps
  36. write_makefiles "$MY_DIR"/proprietary-files-common.txt
  37. # Gapps that are too large for grouper
  38. printf "\n" >> "$PRODUCTMK"
  39. echo "ifeq (\$(TARGET_IS_GROUPER),)" >> "$PRODUCTMK"
  40. write_makefiles "$MY_DIR"/proprietary-files-common-nongrouper.txt
  41. echo "endif" >> "$PRODUCTMK"
  42. sed -i 's/TARGET_DEVICE/TARGET_ARCH/g' "$ANDROIDMK"
  43. # We are done with common
  44. write_footers
  45. for DEVICE in arm arm64 x86 x86_64; do
  46. # Reinitialize the helper for target gapps
  47. setup_vendor "$DEVICE" "$VENDOR" "$ANDROID_ROOT"
  48. # Copyright headers and guards
  49. write_headers "$DEVICE"
  50. write_makefiles "$MY_DIR"/proprietary-files-$DEVICE.txt
  51. # Gapps that are too large for grouper
  52. printf "\n" >> "$PRODUCTMK"
  53. echo "ifeq (\$(TARGET_IS_GROUPER),)" >> "$PRODUCTMK"
  54. write_makefiles "$MY_DIR"/proprietary-files-$DEVICE-nongrouper.txt
  55. echo "endif" >> "$PRODUCTMK"
  56. printf '\n%s\n' "\$(call inherit-product, vendor/gapps/common/common-vendor.mk)" >> "$PRODUCTMK"
  57. sed -i 's/TARGET_DEVICE/TARGET_ARCH/g' "$ANDROIDMK"
  58. # Make Google SuW override Provision
  59. sed -i 's/\(SetupWizard.apk",\)/\1\n\toverrides: ["Provision"],/' "$ANDROIDBP"
  60. # We are done with target
  61. write_footers
  62. done