blob: 65f4e6f5732cb1ba425cc8ceb55a5a61d5c5c5a8 [file] [log] [blame]
function __print_omni_functions_help() {
cat <<EOF
Additional OmniROM functions:
- breakfast: Setup the build environment, but only list
devices we support.
- brunch: Sets up build environment using breakfast(),
and then comiles using mka() against cookies target.
- mka: Builds using SCHED_BATCH on all processors.
- pushboot: Push a file from your OUT dir to your phone and
reboots it, using absolute path.
- repopick: Utility to fetch changes from Gerrit.
EOF
}
function brunch()
{
breakfast $*
if [ $? -eq 0 ]; then
time mka cookies
else
echo "No such item in brunch menu. Try 'breakfast'"
return 1
fi
return $?
}
function breakfast()
{
target=$1
local variant=$2
CUSTOM_DEVICES_ONLY="true"
unset LUNCH_MENU_CHOICES
add_lunch_combo full-eng
for f in `/bin/ls device/*/*/vendorsetup.sh 2> /dev/null`
do
echo "including $f"
. $f
done
unset f
if [ $# -eq 0 ]; then
# No arguments, so let's have the full menu
lunch
else
echo "z$target" | grep -q "-"
if [ $? -eq 0 ]; then
# A buildtype was specified, assume a full device name
lunch $target
else
# This is probably just the omni model name
if [ -z "$variant" ]; then
variant="userdebug"
fi
lunch omni_$target-$variant
fi
fi
return $?
}
alias bib=breakfast
function fixup_common_out_dir() {
common_out_dir=$(get_build_var OUT_DIR)/target/common
target_device=$(get_build_var TARGET_DEVICE)
if [ ! -z $ANDROID_FIXUP_COMMON_OUT ]; then
if [ -d ${common_out_dir} ] && [ ! -L ${common_out_dir} ]; then
mv ${common_out_dir} ${common_out_dir}-${target_device}
ln -s ${common_out_dir}-${target_device} ${common_out_dir}
else
[ -L ${common_out_dir} ] && rm ${common_out_dir}
mkdir -p ${common_out_dir}-${target_device}
ln -s ${common_out_dir}-${target_device} ${common_out_dir}
fi
else
[ -L ${common_out_dir} ] && rm ${common_out_dir}
mkdir -p ${common_out_dir}
fi
}
# Make using all available CPUs
function mka() {
m "$@"
}
function pushboot() {
if [ ! -f $OUT/$* ]; then
echo "File not found: $OUT/$*"
return 1
fi
adb root
sleep 1
adb wait-for-device
adb remount
adb push $OUT/$* /$*
adb reboot
}
function repopick() {
set_stuff_for_environment
T=$(gettop)
$T/vendor/omni/build/tools/repopick.py $@
}
function aospremote()
{
if ! git rev-parse --git-dir &> /dev/null
then
echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
return 1
fi
git remote rm aosp 2> /dev/null
local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
# Google moved the repo location in Oreo
if [ $PROJECT = "build/make" ]
then
PROJECT="build"
fi
if (echo $PROJECT | grep -qv "^device")
then
local PFX="platform/"
fi
git remote add aosp https://android.googlesource.com/$PFX$PROJECT
echo "Remote 'aosp' created"
}
function cafremote()
{
if ! git rev-parse --git-dir &> /dev/null
then
echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
return 1
fi
git remote rm caf 2> /dev/null
local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
# Google moved the repo location in Oreo
if [ $PROJECT = "build/make" ]
then
PROJECT="build"
fi
if [[ $PROJECT =~ "qcom/opensource" ]];
then
PROJECT=$(echo $PROJECT | sed -e "s#qcom\/opensource#qcom-opensource#")
fi
if (echo $PROJECT | grep -qv "^device")
then
local PFX="platform/"
fi
git remote add caf https://source.codeaurora.org/quic/la/$PFX$PROJECT
echo "Remote 'caf' created"
}
# Enable SD-LLVM if available
if [ -d $(gettop)/vendor/qcom/sdclang ]; then
export SDCLANG=true
export SDCLANG_PATH="vendor/qcom/sdclang/6.0/prebuilt/linux-x86_64/bin"
export SDCLANG_LTO_DEFS="vendor/qcom/sdclang/sdllvm-lto-defs.mk"
export SDCLANG_CONFIG="vendor/qcom/sdclang/sdclang.json"
export SDCLANG_AE_CONFIG="vendor/qcom/sdclang/sdclangAE.json"
export SDCLANG_COMMON_FLAGS="-O3 -Wno-user-defined-warnings -Wno-vectorizer-no-neon -Wno-unknown-warning-option \
-Wno-deprecated-register -Wno-tautological-type-limit-compare -Wno-sign-compare -Wno-gnu-folding-constant \
-mllvm -arm-implicit-it=always -Wno-inline-asm -Wno-unused-command-line-argument -Wno-unused-variable"
fi