-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup-env.sh
More file actions
executable file
·87 lines (75 loc) · 2.47 KB
/
setup-env.sh
File metadata and controls
executable file
·87 lines (75 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
#/**
# * Copyright 2024 Comcast Cable Communications Management, LLC
# *
# * 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.
# *
# * SPDX-License-Identifier: Apache-2.0
# */
# ==============================================================================
# setup-env.sh
#
# Shared environment & helpers for all linux-binder-aidl scripts.
#
# Contains ONLY:
# - Core paths (WORK_DIR, OUT_DIR, TARGET_SDK_DIR, HOST_AIDL_DIR, ...)
# - Shared tool config (CMAKE, MAKE, GIT, TAR_BIN)
# - Logging helpers (LOGI/LOGW/LOGE) and tiny FS helpers (CD/RM/MKDIR/...)
#
# Does NOT contain:
# - TAG / REPOSITORIES
# - clone_android_binder_repo()
# - build_linux_binder()
# - any script-specific logic
# ==============================================================================
set -e
#########################
# Core paths
#########################
WORK_DIR="${WORK_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
# Single output root
OUT_DIR="${OUT_DIR:-${WORK_DIR}/out}"
# Target SDK (what target code links against)
TARGET_SDK_DIR="${TARGET_SDK_DIR:-${OUT_DIR}/target}"
# Host-side outputs
HOST_OUT_DIR="${HOST_OUT_DIR:-${OUT_DIR}/host}"
HOST_AIDL_DIR="${HOST_AIDL_DIR:-${HOST_OUT_DIR}/aidl_compiler}"
# Build trees
TARGET_BUILD_DIR="${TARGET_BUILD_DIR:-${OUT_DIR}/build/target}"
HOST_AIDL_BUILD_DIR="${HOST_AIDL_BUILD_DIR:-${OUT_DIR}/build/host_aidl}"
# Android sources root
ANDROID_DIR="${ANDROID_DIR:-${WORK_DIR}/android}"
#########################
# Tools and command wrappers
#########################
CMAKE="${CMAKE:-cmake}"
MAKE="${MAKE:-make}"
GIT="${GIT:-git}"
TAR_BIN="${TAR_BIN:-tar}"
CD="cd"
RM="rm -rf"
MKDIR="mkdir -p"
PUSHD="pushd"
POPD="popd"
#########################
# Colours & logging
#########################
RED="\033[1;31m"
YEL="\033[1;33m"
GRN="\033[1;32m"
GREEN="\033[1;32m"
CYAN="\033[1;36m"
NC="\033[0m"
LOGI() { echo -e "${GRN}[INFO]${NC} $*"; }
LOGW() { echo -e "${YEL}[WARN]${NC} $*"; }
LOGE() { echo -e "${RED}[ERROR]${NC} $*" >&2; }