-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathenv.sh
140 lines (126 loc) · 3.81 KB
/
env.sh
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/sh
function gettop
{
local TOPFILE=servicemanager/Access.cpp
if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
# The following circumlocution ensures we remove symlinks from TOP.
(cd "$TOP"; PWD= /bin/pwd)
else
if [ -f $TOPFILE ] ; then
# The following circumlocution (repeated below as well) ensures
# that we record the true directory name and not one that is
# faked up with symlink names.
PWD= /bin/pwd
else
local HERE=$PWD
local T=
while [ \( ! \( -f $TOPFILE \) \) -a \( "$PWD" != "/" \) ]; do
\cd ..
T=`PWD= /bin/pwd -P`
done
\cd "$HERE"
if [ -f "$T/$TOPFILE" ]; then
echo "$T"
fi
fi
fi
}
function croot()
{
local T=$(gettop)
if [ "$T" ]; then
if [ "$1" ]; then
\cd $(gettop)/$1
else
\cd $(gettop)
fi
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
}
function ask_outdir() {
read -p "Choose build output directory [out] > " DIR
if [ -z "$DIR" ] ; then
echo "set default"
export BINDER_OUTDIR=$(gettop)/out
else
echo $DIR
export BINDER_OUTDIR=$(eval echo $DIR)
fi
}
function check_outdir() {
if [ -z "$BINDER_OUTDIR" ] ; then
ask_outdir
fi
}
# export BINDER_OUTDIR=$HOME/binder-linux-out
export TOP=$(gettop)
function cout {
check_outdir
cd ${BINDER_OUTDIR}
}
function m {
check_outdir
echo "Build C/C++ binaries and libraries"
if [ ! -f "${BINDER_OUTDIR}" ]; then
mkdir -p ${BINDER_OUTDIR}
fi
cd ${BINDER_OUTDIR} && cmake -DCMAKE_INSTALL_PREFIX=$HOME/local ${TOP} -G Ninja && ninja -j `nproc`
cd -
}
export ANDROID_DIR=$(gettop)/android
REPOSITORIES=(
"https://android.googlesource.com/platform/frameworks/native"
"https://android.googlesource.com/platform/system/libbase"
"https://android.googlesource.com/platform/system/core"
"https://android.googlesource.com/platform/system/logging"
"https://android.googlesource.com/platform/system/unwinding"
"https://android.googlesource.com/platform/system/tools/aidl"
"https://android.googlesource.com/platform/system/tools/hidl"
"https://android.googlesource.com/platform/system/libprocinfo"
"https://android.googlesource.com/platform/system/libvintf"
"https://android.googlesource.com/platform/prebuilts/build-tools"
"https://android.googlesource.com/platform/external/fmtlib"
"https://android.googlesource.com/platform/external/googletest"
"https://android.googlesource.com/platform/external/pcre"
"https://android.googlesource.com/platform/external/tinyxml2"
"https://android.googlesource.com/platform/packages/modules/Gki"
)
TAG="android-14.0.0_r21"
function android_clone() {
local PUSH_DIR=`pwd`
cd $(gettop)
rm -rf ${ANDROID_DIR}
mkdir -p ${ANDROID_DIR} && cd ${ANDROID_DIR}
for R in ${REPOSITORIES[*]}; do
# git clone ${GIT_OPTIONS} -b ${TAG} ${R}
git clone -c advice.detachedHead=false --depth 1 -b ${TAG} ${R}
BASENAME=`basename ${R}`
PATCH="$(gettop)/patches/${BASENAME}.patch"
if [ -f ${PATCH} ]; then
echo "Apply ${PATCH}"
cd ${BASENAME}
git apply ${PATCH}
cd -
fi
done
cd ${PUSH_DIR}
}
function android_pull() {
local PUSH_DIR=`pwd`
cd ${ANDROID_DIR}
for R in ${REPOSITORIES[*]}; do
D=`basename ${R}`
if cd ${D} ; then
echo ${R}
git stash push
git pull ${GIT_OPTIONS} --rebase
git stash pop
echo
cd -
fi
done
cd ${PUSH_DIR}
}
check_outdir
echo "Out directory is [${BINDER_OUTDIR}]"