diff options
author | TheStrix <parthbhatia98@gmail.com> | 2020-03-19 13:57:28 +0530 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-12-25 21:42:48 +0800 |
commit | 636635c20a6de9c81fe80242ad05753fe11023d9 (patch) | |
tree | 0a77ede8ab227077993522a85f98a8d5dc6dc2df | |
parent | 696f89ff21a73f791424df4c68e530f06c0140ec (diff) |
extract_utils: Add support for extracting QTI common components
Change-Id: I4bc21d1c21f6e2b477360943ad063161b2e0cfad
-rw-r--r-- | extract_utils.sh | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/extract_utils.sh b/extract_utils.sh index 0d3d154..b7e14b2 100644 --- a/extract_utils.sh +++ b/extract_utils.sh @@ -2,6 +2,7 @@ # # Copyright (C) 2016 The CyanogenMod Project # Copyright (C) 2017-2023 The LineageOS Project +# Copyright (C) 2017-2023 Paranoid Android # # SPDX-License-Identifier: Apache-2.0 # @@ -78,21 +79,31 @@ function setup_vendor_deps() { # # setup_vendor # -# $1: device name +# $1: device/component name # $2: vendor name # $3: Android root directory # $4: is common device - optional, default to false # $5: cleanup - optional, default to true # $6: custom vendor makefile name - optional, default to false +# $7: is qti common component - optional, default to false # # Must be called before any other functions can be used. This # sets up the internal state for a new vendor configuration. # function setup_vendor() { - local DEVICE="$1" - if [ -z "$DEVICE" ]; then - echo "\$DEVICE must be set before including this script!" - exit 1 + export IS_QTI_COMPONENT="$7" + if [ -z "$IS_QTI_COMPONENT" ]; then + local DEVICE="$1" + if [ -z "$DEVICE" ]; then + echo "\$DEVICE must be set before including this script!" + exit 1 + fi + else + local COMPONENT="$1" + if [ -z "$COMPONENT" ]; then + echo "\$COMPONENT must be set before including this script!" + exit 1 + fi fi local VENDOR="$2" @@ -107,14 +118,22 @@ function setup_vendor() { exit 1 fi - export OUTDIR=vendor/"$VENDOR"/"$DEVICE" + if [ -z "$IS_QTI_COMPONENT" ]; then + export OUTDIR=vendor/"$VENDOR"/"$DEVICE" + else + export OUTDIR=vendor/"$VENDOR"/"$COMPONENT" + fi if [ ! -d "$ANDROID_ROOT/$OUTDIR" ]; then mkdir -p "$ANDROID_ROOT/$OUTDIR" fi VNDNAME="$6" if [ -z "$VNDNAME" ]; then - VNDNAME="$DEVICE" + if [ -z "$IS_QTI_COMPONENT" ]; then + VNDNAME="$DEVICE" + else + VNDNAME="$COMPONENT" + fi fi export PRODUCTMK="$ANDROID_ROOT"/"$OUTDIR"/"$VNDNAME"-vendor.mk @@ -450,7 +469,7 @@ function write_blueprint_packages() { if [ ! -z "$STEM" ]; then printf '\tstem: "%s",\n' "$STEM" fi - printf '\towner: "%s",\n' "$VENDOR" + printf '\towner: "%s",\n' "${VENDOR%\/*}" printf '\tstrip: {\n' printf '\t\tnone: true,\n' printf '\t},\n' @@ -486,7 +505,7 @@ function write_blueprint_packages() { elif [ "$CLASS" = "APPS" ]; then printf 'android_app_import {\n' printf '\tname: "%s",\n' "$PKGNAME" - printf '\towner: "%s",\n' "$VENDOR" + printf '\towner: "%s",\n' "${VENDOR%\/*}" if [ "$EXTRA" = "priv-app" ]; then SRC="$SRC/priv-app" else @@ -513,7 +532,7 @@ function write_blueprint_packages() { elif [ "$CLASS" = "JAVA_LIBRARIES" ]; then printf 'dex_import {\n' printf '\tname: "%s",\n' "$PKGNAME" - printf '\towner: "%s",\n' "$VENDOR" + printf '\towner: "%s",\n' "${VENDOR%\/*}" printf '\tjars: ["%s/framework/%s"],\n' "$SRC" "$FILE" elif [ "$CLASS" = "ETC" ]; then if [ "$EXTENSION" = "xml" ]; then @@ -522,7 +541,7 @@ function write_blueprint_packages() { printf 'prebuilt_etc {\n' fi printf '\tname: "%s",\n' "$PKGNAME" - printf '\towner: "%s",\n' "$VENDOR" + printf '\towner: "%s",\n' "${VENDOR%\/*}" printf '\tsrc: "%s/etc/%s",\n' "$SRC" "$FILE" printf '\tfilename_from_src: true,\n' elif [ "$CLASS" = "EXECUTABLES" ]; then @@ -532,7 +551,7 @@ function write_blueprint_packages() { printf 'cc_prebuilt_binary {\n' fi printf '\tname: "%s",\n' "$PKGNAME" - printf '\towner: "%s",\n' "$VENDOR" + printf '\towner: "%s",\n' "${VENDOR%\/*}" if [ "$EXTENSION" != "sh" ]; then printf '\tsrcs: ["%s/bin/%s"],\n' "$SRC" "$FILE" printf '\tcheck_elf_files: false,\n' @@ -978,7 +997,7 @@ function write_blueprint_header() { cat << EOF >> $1 // Automatically generated file. DO NOT MODIFY // -// This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh +// This file is generated by device/$VENDOR/$([ -z "$IS_QTI_COMPONENT" ] && echo ${DEVICE} || echo ${COMPONENT})/setup-makefiles.sh EOF } @@ -1003,7 +1022,7 @@ function write_makefile_header() { cat << EOF >> $1 # Automatically generated file. DO NOT MODIFY # -# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh +# This file is generated by device/$VENDOR/$([ -z "$IS_QTI_COMPONENT" ] && echo ${DEVICE} || echo ${COMPONENT})/setup-makefiles.sh EOF } @@ -1085,20 +1104,28 @@ function write_rro_package() { function write_headers() { write_makefile_header "$ANDROIDMK" + cat << EOF >> "$ANDROIDMK" +LOCAL_PATH := \$(call my-dir) + +EOF + GUARD="$2" if [ -z "$GUARD" ]; then GUARD="TARGET_DEVICE" fi - cat << EOF >> "$ANDROIDMK" -LOCAL_PATH := \$(call my-dir) - -EOF if [ "$COMMON" -ne 1 ]; then - cat << EOF >> "$ANDROIDMK" + if [ -z "$IS_QTI_COMPONENT" ]; then + cat << EOF >> "$ANDROIDMK" ifeq (\$($GUARD),$DEVICE) EOF + else + cat << EOF >> "$ANDROIDMK" +ifneq (,\$(filter $COMPONENT,\$(TARGET_COMMON_QTI_COMPONENTS))) + +EOF + fi else if [ -z "$1" ]; then echo "Argument with devices to be added to guard must be set!" @@ -1124,7 +1151,7 @@ EOF [ "$COMMON" -eq 1 ] && local VENDOR="${VENDOR_COMMON:-$VENDOR}" cat << EOF >> "$PRODUCTMK" PRODUCT_SOONG_NAMESPACES += \\ - vendor/$VENDOR/$DEVICE + vendor/$VENDOR/$([ -z "$IS_QTI_COMPONENT" ] && echo ${DEVICE} || echo ${COMPONENT}) EOF } |