summaryrefslogtreecommitdiff
path: root/extract_utils.sh
diff options
context:
space:
mode:
authorTheStrix <parthbhatia98@gmail.com>2020-03-19 13:57:28 +0530
committeralk3pInjection <webmaster@raspii.tech>2022-01-14 10:16:54 +0800
commit09c2eaa1f664956620aee8832bd5fa64c817e9ff (patch)
tree593ad6a784efc90c2c7a06115122c9b0111ba1fb /extract_utils.sh
parent8466101527f6252dac8b7d7470a983c990352206 (diff)
extract_utils: Add support for extracting QTI common componentsHEADsugisawa-mr1sugisawa
Change-Id: I4bc21d1c21f6e2b477360943ad063161b2e0cfad
Diffstat (limited to 'extract_utils.sh')
-rw-r--r--extract_utils.sh68
1 files changed, 48 insertions, 20 deletions
diff --git a/extract_utils.sh b/extract_utils.sh
index 2010546..29d96f6 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -2,6 +2,7 @@
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
+# Copyright (C) 2017-2020 Paranoid Android
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -36,21 +37,31 @@ trap cleanup 0
#
# 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
export VENDOR="$2"
@@ -65,14 +76,23 @@ 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
@@ -388,7 +408,7 @@ function write_blueprint_packages() {
if [ "$CLASS" = "SHARED_LIBRARIES" ]; then
printf 'cc_prebuilt_library_shared {\n'
printf '\tname: "%s",\n' "$PKGNAME"
- printf '\towner: "%s",\n' "$VENDOR"
+ printf '\towner: "%s",\n' "${VENDOR%\/*}"
printf '\tstrip: {\n'
printf '\t\tnone: true,\n'
printf '\t},\n'
@@ -424,7 +444,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
@@ -452,7 +472,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
@@ -461,7 +481,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
@@ -471,7 +491,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 [ "$ARGS" = "rootfs" ]; then
SRC="$SRC/rootfs"
if [ "$EXTRA" = "sbin" ]; then
@@ -975,7 +995,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
}
@@ -999,7 +1019,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
}
@@ -1017,20 +1037,28 @@ EOF
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!"
@@ -1055,7 +1083,7 @@ EOF
[ "$COMMON" -eq 1 ] && local DEVICE="$DEVICE_COMMON"
cat << EOF >> "$PRODUCTMK"
PRODUCT_SOONG_NAMESPACES += \\
- vendor/$VENDOR/$DEVICE
+ vendor/$VENDOR/$([ -z "$IS_QTI_COMPONENT" ] && echo ${DEVICE} || echo ${COMPONENT})
EOF
}