You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.7 KiB

#!/bin/bash
BASE_DIR=vendor/google/tvstock
#----------------------------------------------------------
function generate_head()
{
cat > $1 <<- EOF
#
# Copyright 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
EOF
}
function generate_device_mk()
{
[ -z $1 ] && return -1
echo -n "Generating $1..."
generate_head $1
printf "\n# GApps dependencies\n" >> $1
printf "PRODUCT_COPY_FILES +=" >> $1
for sf in $(find system/ system_ext/ product/ -type f ! -name "*.apk"); do
echo " \\" >> $1
printf "\t${BASE_DIR}/proprietary/$sf:$sf:google" >> $1
done
printf "\n\n" >> $1
printf "PRODUCT_PACKAGES +=" >> $1
for sf in $(find product/priv-app/ system_ext/priv-app/ system/ product/app/ product/overlay/ -type f -name "*.apk"); do
apk_name=$(basename $sf)
module_name=${apk_name//\.apk/}
echo " \\" >> $1
printf "\t${module_name}" >> $1
done
printf "\n\n" >> $1
echo "done."
}
function generate_android_mk()
{
[ -z $1 ] && return -1
echo -n "Generating $1..."
generate_head $1
printf "\nLOCAL_PATH := \$(call my-dir)\n\n" >> $1
for sf in $(find product/priv-app/ system_ext/priv-app/ system/ product/app/ product/overlay/ -type f -name "*.apk"); do
apk_name=$(basename $sf)
module_name=${apk_name//\.apk/}
module_path='#TBD'
module_priv='#TBD'
if [[ $sf == product/overlay/* ]]; then
module_path='LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/overlay/'
fi
if [[ $sf == */priv-app/* ]]; then
module_priv='LOCAL_PRIVILEGED_MODULE := true'
fi
if [[ $sf == system_ext/* ]]; then
module_part='LOCAL_SYSTEM_EXT_MODULE := true'
else
# [[ $sf == product/* ]]
module_part='LOCAL_PRODUCT_MODULE := true'
fi
cat >> $1 <<- EOF
include \$(CLEAR_VARS)
LOCAL_MODULE := $module_name
$module_path
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_OWNER := google
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $sf
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_DEX_PREOPT := false
$module_priv
$module_part
include \$(BUILD_PREBUILT)
EOF
done
sed '/^#TBD$/d' $1 -i
echo "done."
}
#----------------------------------------------------------
generate_head ../BoardConfigPartial.mk
generate_device_mk ../device-partial.mk
generate_android_mk ./Android.mk