2018-06-30 11:58:06 -04:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (C) 2018 The LineageOS 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.
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2019-08-06 14:05:02 -04:00
|
|
|
DEVICE_COMMON=sdm660-common
|
2020-07-25 11:04:52 -04:00
|
|
|
GUARDED_DEVICES_COMMON="tulip jasmine_sprout wayne clover lavender platina jason whyred"
|
2018-06-30 11:58:06 -04:00
|
|
|
VENDOR=xiaomi
|
|
|
|
|
|
|
|
INITIAL_COPYRIGHT_YEAR=2018
|
|
|
|
|
|
|
|
# Load extract_utils and do some sanity checks
|
2020-05-29 09:08:44 -04:00
|
|
|
COMMON_DIR="${BASH_SOURCE%/*}"
|
|
|
|
if [[ ! -d "$COMMON_DIR" ]]; then COMMON_DIR="$PWD"; fi
|
2018-06-30 11:58:06 -04:00
|
|
|
|
2020-05-29 09:08:44 -04:00
|
|
|
if [[ -z "$DEVICE_DIR" ]]; then
|
|
|
|
DEVICE_DIR="${COMMON_DIR}/../${DEVICE}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
ROOT="$COMMON_DIR"/../../..
|
2018-06-30 11:58:06 -04:00
|
|
|
|
2020-10-25 16:08:03 -04:00
|
|
|
HELPER="$ROOT"/vendor/awaken/build/tools/extract_utils.sh
|
2018-06-30 11:58:06 -04:00
|
|
|
if [ ! -f "$HELPER" ]; then
|
|
|
|
echo "Unable to find helper script at $HELPER"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
. "$HELPER"
|
|
|
|
|
2018-08-05 04:45:35 -04:00
|
|
|
# Initialize the common helper
|
2020-05-29 09:08:44 -04:00
|
|
|
setup_vendor "$DEVICE_COMMON" "$VENDOR" "$ROOT" true
|
2018-06-30 11:58:06 -04:00
|
|
|
|
2020-05-29 09:08:44 -04:00
|
|
|
if ([[ "$ONLY_DEVICE" = "false" ]] || [[ -z "$ONLY_DEVICE" ]]) && [[ -s "${COMMON_DIR}"/proprietary-files.txt ]]; then
|
|
|
|
# Copyright headers and guards
|
|
|
|
write_headers "$GUARDED_DEVICES_COMMON"
|
|
|
|
# The common blobs
|
|
|
|
write_makefiles "$COMMON_DIR"/proprietary-files.txt true
|
|
|
|
# Finish
|
|
|
|
write_footers
|
|
|
|
fi
|
|
|
|
if ([[ "$ONLY_COMMON" = "false" ]] || [[ -z "$ONLY_COMMON" ]]) && [[ -s "${DEVICE_DIR}"/proprietary-files.txt ]]; then
|
|
|
|
# Reinitialize the helper for device and write copyright headers and guards
|
|
|
|
DEVICE_COMMON="$DEVICE"
|
|
|
|
if [[ ! "$IS_COMMON" = "true" ]]; then
|
|
|
|
IS_COMMON=false
|
|
|
|
GUARDED_DEVICES=
|
|
|
|
fi
|
2018-08-05 04:45:35 -04:00
|
|
|
# Reinitialize the helper for device
|
|
|
|
INITIAL_COPYRIGHT_YEAR="$DEVICE_BRINGUP_YEAR"
|
2020-05-29 09:08:44 -04:00
|
|
|
setup_vendor "$DEVICE" "$VENDOR" "$ROOT" "$IS_COMMON" "$CLEAN_VENDOR"
|
2018-08-05 04:45:35 -04:00
|
|
|
# Copyright headers and guards
|
2020-05-29 09:08:44 -04:00
|
|
|
write_headers "$GUARDED_DEVICES"
|
2018-08-05 04:45:35 -04:00
|
|
|
# The standard device blobs
|
2020-05-29 09:08:44 -04:00
|
|
|
write_makefiles "${DEVICE_DIR}"/proprietary-files.txt true
|
2018-08-05 04:45:35 -04:00
|
|
|
# We are done!
|
|
|
|
write_footers
|
|
|
|
fi
|