-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildenv
297 lines (241 loc) · 8.04 KB
/
buildenv
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# This package does not use a git clone URL. Instead it uses
# the depot tools package to peform a fetch. Fetch, gclient etc
# are included in the depot tools package toolchain. Consquently,
# ZOPEN_BUILD_LINE and ZOPEN_DEV_URL are unspecified and
# ZOPEN_TYPE is set to BARE. Also, in this case, do
# not use ZOPEN_DEV_DEPS. Instead use ZOPEN_DEPS.
# Lastly, specify ZOPEN_NAME.
#
# Use zopen build -vv to see if the dependencies are being processed
export ZOPEN_TYPE="BARE"
export ZOPEN_NAME="v8"
export ZOPEN_DEPS="depot_tools zoslib cmake make check_python gn ninja git check_clang"
export ZOPEN_RUNTIME_DEPS="zoslib check_python"
# Nothing to configure or build:?
export ZOPEN_CONFIGURE="skip"
#export ZOPEN_MAKE="skip"
export ZOPEN_MAKE="zopen_build"
export ZOPEN_INSTALL="zopen_install"
export ZOPEN_CATEGORIES="development language core"
#
# User Tunable Paramters
# Uncomment the following line to build d8 so that it uses a dynamic
# library rather than a static build:
#COMPONENT_BUILD="is_component_build=true"
[ -z "${COMPONENT_BUILD}" ] && COMPONENT_BUILD=""
zopen_check_results()
{
dir="$1"
pfx="$2"
chk="$1/$2_check.log"
# Echo the following information to gauge build health
echo "actualFailures:0"
echo "totalTests:1"
echo "expectedFailures:0"
echo "expectedTotalTests:1"
}
zopen_get_version()
{
# Modify to echo the version of your tool/library
# Rather than hardcoding the version, obtain the version by running the tool/library
echo "1.0.0"
}
#
# Hooks/Routines called during `$ zopen build`
#
# Called First
zopen_init()
{
echo "### zopen_init ###"
# Check for python
if ! type python3 >/dev/null ; then
printError "need python3 venv with packages: httplib2 and six"
fi
}
# Called Second.
zopen_build() {
echo "### zopen_build ###"
# enable tracing.
#set -x
export PATH="${DEPOT_TOOLS_HOME}:${GN_HOME}:$PATH"
# update the compiler settings
unset CFLAGS CXXFLAGS LDFLAGS
export DEPOT_TOOLS_UPDATE=0
# do the export and the set
CUSTOM_CIPD_CLIENT=${DEPOT_TOOLS_HOME}/.cipd_client
export CUSTOM_CIPD_CLIENT=${DEPOT_TOOLS_HOME}/.cipd_client
export DEPOT_TOOLS_BOOTSTRAP_PYTHON3=0
export VPYTHON_BYPASS='manually managed python not supported by chrome operations'
# RESULT
# DEPOT_TOOLS_HOME : /z/jd895801/zopen/usr/local/zopen/depot_tools/depot_tools-main.20240726_201652.zos
# CUSTOM_CIPD_CLIENT : /z/jd895801/zopen/usr/local/zopen/depot_tools/depot_tools-main.20240726_201652.zos/.cipd_client
# VPYTHON_BYPASS : manually managed python not supported by chrome operations
# Disable updating depot_tools
# Point to custom CIPD_CLIENT
# Disable updating depot_tools
# Disable commands:
# * ensure_bootstrap
# * update_depot_tools
# Disable vpython3 (use python directly); see depot_tools/vpython3.
# Run the CIPD client that was built on z/OS; see depot_tools/cipd.
# Disable commands:
# * ensure_bootstrap
# * update_depot_tools
# Create the virtual env in the v8port install dir
echo " Creating a python venv..."
python3 -m venv venv
# depot_tools creates the venv, here we ensure the necessary packages are installed
# Activate the path
echo "activating the virtual env - venv"
. venv/bin/activate
# Update the virtual env
echo "updating the virtual env pip"
python -m pip install -U pip
# Update the PYTHON_EXECUTABLE to fix six.moves problem
echo "****************************************"
echo "PYTHON : $(type python)"
echo "fetch : $(type -p fetch)"
echo "PATH : ${PATH}"
echo "DEPOT_TOOLS_UPDATE: ${DEPOT_TOOLS_UPDATE}"
echo "DEPOT_TOOLS_HOME : ${DEPOT_TOOLS_HOME}"
echo "CUSTOM_CIPD_CLIENT : ${CUSTOM_CIPD_CLIENT}"
echo "VPYTHON_BYPASS : ${VPYTHON_BYPASS}"
echo "env | grep -E '(DEPOT|CUSTOM)' : `env | grep -E '(DEPOT|CUSTOM)'`"
echo "****************************************"
# Install the necessary requirements
echo "Installing reqired package in venv"
pip install -r requirements.txt
# Try this to fix six.moves
pip install --upgrade six
echo "Invoking gclient metrics --opt-out"
# Comment out this line if you wish to participate.
gclient metrics --opt-out
# Now you can start the fetch
mkdir v8base
# change into v8base
cd v8base
# fetch
echo "fetch v8..."
fetch v8
# At this point, fetch is using depot_tools from third party
# and has the AWS error.
# Igor found this url
# https://issues.webrtc.org/issues/42228191
#JFD EARLY EXIT
#echo "JFD EARLY EXIT"
#exit
# change dirs to v8
cd v8
# checkout main
echo "git checkout main"
git checkout main
# use the specified commit hash
echo "git reset c845aba112d05521a9ece51810d2e1a9ca6379da --hard"
git reset c845aba112d05521a9ece51810d2e1a9ca6379da --hard
# Use depot tools gclient sync
echo "gclient sync -D"
echo "gclient is via: `type gclient`"
# If proceed manually, this fails
# cipd ensure depot_tools-main/.cipd_client is missing.
# depot_tools-main is an old path, it no longer has a -main suffix
gclient sync -D -v
#
# apply patches
#
git stash
for df in `find ${ZOPEN_ROOT}/patches/ -type f -name "git.*diff" | sort`; do
dirfile=`echo $df | sed "s:^${ZOPEN_ROOT}/patches/::"`
srcdir=`dirname $dirfile`
echo "under $(pwd): srcdir=${srcdir}"
[[ "$srcdir" != "." ]] && pushd $srcdir && git stash
echo "git apply $MAINDIR/$df from `pwd`"
git apply $MAINDIR/$df
[[ "$srcdir" != "." ]] && popd
done
echo "Apply pax files to buildtools"
pushd buildtools
pax -p p -rzf ${ZOPEN_ROOT}/patches/buildtools/buildtools.zos.20231122.92b79f4d75.pax
popd
#
# Prepare v8 for building
#
pushd buildtools/zos
echo "change dir to v8base/v8/buildtools/zos level..."
echo "make link to gn in v8base/v8/buildtools/zos"
echo "using GN_HOME: ${GN_HOME}"
echo "cwd: `pwd`"
ln -s "${GN_HOME}/gn" .
popd
export PATH="${PWD}:${ZOPEN_ROOT}/v8base/v8/buildtools/zos:$PATH" # for the 'ar' wrapper
echo "ZOPEN_ROOT : ${ZOPEN_ROOT}"
echo "PATH : ${PATH}"
#JFD EARLY EXIT
#echo "JFD EARLY EXIT"
#exit
#
# Do the v8 build
#
echo "Generate ninja files using gn..."
gn -v gen out/zos_s390x.release --args="is_debug=false treat_warnings_as_errors=false ${COMPONENT_BUILD}"
echo "Perform build using ninja..."
V=1 ninja -v -j ${ZOPEN_NUM_JOBS} -C out/zos_s390x.release/
# on exit return to the top level of the git repo
cd ${ZOPEN_ROOT}
# This is required when the built binaries (e.g. mksnapshot) and tests are run
export LIBPATH=${ZOPEN_ROOT}/out/zos_s390x.release:$LIBPATH
# disable tracing
#set +x
}
# Called Third
zopen_install() {
echo "### zopen_install ###"
# ZOPEN_INSTALL_DIR: ${HOME}/zopen/usr/local/zopen/v8/v8-DEV
# Current directory is top level of the repo since zopen_build has run
mkdir -p ${ZOPEN_INSTALL_DIR}
cp -r * ${ZOPEN_INSTALL_DIR} # modify to copy the relevant scripts
}
#
# Hooks/Routines called post install when
# user `. ${HOME}/zopen/etc/zopen-config`
# to use the zopen tools.
#
# zopen_append_env() creates a file with the settings below
# Its ${HOME}/usr/local/zopen/depot_tools/depot_tools-main/.appenv
#
# Called first?
zopen_append_to_env()
{
echo "### zopen_append_env ###"
# echo envars outside of PATH, MANPATH, LIBPATH
}
# Notes:
# zopen_append_to_setup() does:
# creates the dir: ${HOME}/zopen/usr/local/zopen/v8
# during the `zopen build` process.
#
# during this stage the current working directory is
# ${HOME}/zopen/usr/local/zopen/v8
#
# it creates/appends to the file setup.sh in that dir.
#
# Example buildenvs which use this portion of
# code are:
#
# https://github.com/ZOSOpenTools/sudoport/blob/main/buildenv#L49
#
# https://github.com/ZOSOpenTools/gpgport/blob/main/buildenv#L50
#
# Build workflow
# cd ~/zopen/dev/v8port
# rm -rf ~/.local v8base install ${HOME}/zopen/usr/local/zopen/v8 venv logs; zopen build > out.log 2>&1
#
# Called second?
# This captures stdout and puts in setup.sh
# These need to be echo's
zopen_append_to_setup()
{
# echo commands that will run when installing via setup.sh
# At this time, ZOPEN_INSTAL_DIR is:
# ${HOME}/zopen/usr/local/zopen/v8/v8-DEV
echo "echo \"append_to_setup()\""
}