1# Copyright (C) 2018 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15gettop() { 16 # $BASH_SOURCE works if the shell is bash. $0 works when the shell was 17 # invoked from a shell script but may fail when sourced in non-bash shell. 18 SCRIPT=$(readlink -f ${BASH_SOURCE:-$0}) 19 TOPFILE="trusty/vendor/google/aosp/scripts/envsetup.sh" 20 TOPDIR=$(dirname $SCRIPT) 21 while [ \( ! -f "$TOPDIR/$TOPFILE" \) -a \( "$TOPDIR" != "/" \) ]; do 22 TOPDIR=`dirname $TOPDIR` 23 done 24 if [ ! -f "$TOPDIR/$TOPFILE" ]; then 25 echo "Error: Couldn't locate the top of the trusty tree. Try using bash?" 1>&2 26 exit 1 27 fi 28 echo $TOPDIR 29} 30 31export TRUSTY_TOP=$(gettop) 32export CLANG_BINDIR=${TRUSTY_TOP}/prebuilts/clang/host/linux-x86/clang-r498229b/bin 33export CLANG_HOST_LIBDIR=${CLANG_BINDIR}/../lib 34export CLANG_TOOLS_BINDIR=${TRUSTY_TOP}/prebuilts/clang-tools/linux-x86/bin 35export LINUX_CLANG_BINDIR=${TRUSTY_TOP}/prebuilts/clang/host/linux-x86/clang-r498229b/bin 36export RUST_BINDIR=${TRUSTY_TOP}/prebuilts/rust/linux-x86/1.77.1.p1/bin 37export RUST_HOST_LIBDIR=${RUST_BINDIR}/../lib/rustlib/x86_64-unknown-linux-gnu/lib 38export ARCH_arm_TOOLCHAIN_PREFIX=${CLANG_BINDIR}/llvm- 39export ARCH_arm64_TOOLCHAIN_PREFIX=${CLANG_BINDIR}/llvm- 40export ARCH_x86_64_TOOLCHAIN_PREFIX=${CLANG_BINDIR}/llvm- 41export ARCH_x86_TOOLCHAIN_PREFIX=${CLANG_BINDIR}/llvm- 42export BUILDTOOLS_BINDIR=${TRUSTY_TOP}/prebuilts/build-tools/linux-x86/bin 43export BUILDTOOLS_COMMON=${TRUSTY_TOP}/prebuilts/build-tools/common 44export PY3=$BUILDTOOLS_BINDIR/py3-cmd 45 46SOONG_UI=$TRUSTY_TOP/build/soong/soong_ui.bash 47if [ -f "$SOONG_UI" ]; then 48 export SOONG_UI 49fi 50 51if [ -f "$TRUSTY_TOP/external/lk/engine.mk" ]; then 52 export LKROOT=$TRUSTY_TOP/external/lk 53elif [ -f "$TRUSTY_TOP/external/trusty/lk/engine.mk" ]; then 54 export LKROOT=$TRUSTY_TOP/external/trusty/lk 55else 56 echo "Error: Couldn't locate the LK root directory." 1>&2 57 exit 1 58fi 59 60# Additional Python libraries: 61# Most Trusty Python scripts source this file to find the hermetic 62# Python interpreter ($PY3). 63# The hermetic Python interpreter only exposes the Python standard library. 64# Set PYTHONPATH to make select, vendor'ed libraries available to hermetic 65# Python scripts. 66# WARNING: Python scripts that are copied to the build output directory should *not* 67# import these packages. 68PYTHONPATH=${TRUSTY_TOP}/prebuilts/libprotobuf/python 69PYTHONPATH=${PYTHONPATH}:${TRUSTY_TOP}/external/python/six 70PYTHONPATH=${PYTHONPATH}:${TRUSTY_TOP}/external/python/markupsafe/src 71PYTHONPATH=${PYTHONPATH}:${TRUSTY_TOP}/external/python/jinja/src 72export PYTHONPATH 73 74# Bindgen uses clang and libclang at runtime, so we need to tell it where to 75# look for these tools. 76export BINDGEN_CLANG_PATH=${TRUSTY_TOP}/prebuilts/clang/host/linux-x86/clang-r498229b/bin/clang 77export BINDGEN_LIBCLANG_PATH=${TRUSTY_TOP}/prebuilts/clang/host/linux-x86/clang-r498229b/lib 78