-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuildenv
260 lines (223 loc) · 9.46 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
export ZOPEN_STABLE_URL="https://github.com/boostorg/boost.git"
export ZOPEN_STABLE_DEPS="cmake make zoslib which coreutils check_clang sed jq"
export ZOPEN_DEV_URL="https://github.com/boostorg/boost.git"
export ZOPEN_DEV_DEPS="cmake make zoslib which coreutils check_clang sed jq git findutils diffutils bzip2 zlib"
export ZOPEN_CATEGORIES="library"
export ZOPEN_BUILD_LINE="DEV"
export ZOPEN_CLONE_SUBMODULES="yes"
export ZOPEN_COMP="clang"
export ZOPEN_CHECK_TIMEOUT=72000 # 20 hours
export ZOPEN_SKIP_ZOSLIB_ENV_HOOK="skip"
export ZOPEN_BOOTSTRAP="zopen_bootstrap"
export ZOPEN_CONFIGURE=skip
export ZOPEN_CHECK="zopen_check"
export ZOPEN_CLEAN=skip
export ZOPEN_MAKE="zopen_build"
export ZOPEN_MAKE_MINIMAL="yes"
export GIT_DISCOVERY_ACROSS_FILESYSTEM="yes"
export ZOPEN_INSTALL="zopen_install"
zopen_bootstrap()
{
./bootstrap.sh -with-libraries=thread,chrono,container,filesystem,graph,serialization,date_time,test,regex,system,url,wave,type_erasure,timer,random,nowide,random,fiber,json,charconv,iostreams --with-toolset=clang --prefix=$ZOPEN_INSTALL_DIR
}
zopen_install_caveats()
{
cat <<ZZ
The samples directory contains examples that demonstrate how to use Boost libraries. Refer to the README for instructions on how to compile them.
ZZ
}
zopen_post_install()
{
echo `pwd`
find . -type f -name "*.x" -exec cp {} "${ZOPEN_INSTALL_DIR}/lib" \;
mkdir $ZOPEN_INSTALL_DIR/samples
cp ../samples/* $ZOPEN_INSTALL_DIR/samples/
}
zopen_install()
{
echo `pwd`
cd $ZOPEN_ROOT/boost
echo `pwd`
./b2 install
}
zopen_build()
{
echo `pwd`
cd $ZOPEN_ROOT/boost
echo `pwd`
./b2
echo "generate headers ............"
./b2 headers
}
# Function to test Boost libraries
build_and_test_boost() {
test_dir="$1"
cd "$test_dir" || {
echo "Error: Failed to change directory to $test_dir"
return 1
}
"$ZOPEN_ROOT/boost/b2" --clean
"$ZOPEN_ROOT/boost/b2"
cd -
}
zopen_check()
{
# Define the comma-separated list of libraries
libraries="chrono,thread,container,filesystem,graph,serialization,date_time,regex,algorithm,align,array,any,assert,bind,callable_traits,circular_buffer,concept_check,config,container_hash,core,endian,foreach,format,function,functional,function_types,integer,intrusive,iterator,iostreams,lexical_cast,describe,detail,flyweight,heap,move,utility,unordered,typeof,tuple,multi_array,multi_index,lambda,lambda2,smart_ptr,assign,range,static_string,stl_interfaces,tokenizer,type_index,sort,ratio,rational,property_tree,optional"
# Convert the comma-separated list into an array
IFS=','
echo "$libraries" | tr ',' '\n' | while read -r item; do
build_and_test_boost "$ZOPEN_ROOT/boost/libs/$item/test"
done
}
apply_patch() {
patch_file="$1"
if [ -z "$patch_file" ]; then
echo "Error: No patch file specified ${patch_file}.."
return 1
fi
git apply "$patch_file"
if [ $? -ne 0 ]; then
echo "Error: git apply failed for $patch_file"
return 1
fi
}
zopen_init()
{
# This runs after clone & regular patches are applied
# and runs before bootstrap, configure, build
#boostrap.sh path -> located at ./boost/bootstrap.sh
echo "In ZOPEN_INIT, applying patch to bootstrap"
if ! apply_patch "$ZOPEN_ROOT/boostPatches/bootstrap.sh.patch"; then return 1; fi
# aligned_alloc.hpp patch -> located at ./boost/libs/align/aligned_alloc.hpp
echo "In ZOPEN_INIT, applying patch to lib - align"
cd libs/align
if ! apply_patch "$ZOPEN_ROOT/boostPatches/align.patch"; then return 1; fi
cd -
# asio directory patch -> located at ./boost/libs/asio
echo "In ZOPEN_INIT, applying patch to lib - asio"
cd libs/asio
if ! apply_patch "$ZOPEN_ROOT/boostPatches/asio.patch"; then return 1; fi
cd -
# math directory patch -> located at ./boost/libs/math
echo "In ZOPEN_INIT, applying patch to lib - math"
cd libs/math
if ! apply_patch "$ZOPEN_ROOT/boostPatches/math.patch"; then return 1; fi
cd -
# multiprecision directory patch -> located at ./boost/libs/multiprecision
echo "In ZOPEN_INIT, applying patch to lib - multiprecision"
cd libs/multiprecision
if ! apply_patch "$ZOPEN_ROOT/boostPatches/multiprecision.patch"; then return 1; fi
cd -
# thread directory patch -> located at ./boost/libs/thread
echo "In ZOPEN_INIT, applying patch to lib - thread"
cd libs/thread
if ! apply_patch "$ZOPEN_ROOT/boostPatches/thread.hpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/thread_data.hpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/pthread_helpers.hpp.patch"; then return 1; fi
cd -
# build directory patch -> located at ./boost/tools/build
echo "In ZOPEN_INIT, applying patch to tools/build"
cd tools/build/
if ! apply_patch "$ZOPEN_ROOT/boostPatches/src_engine.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/gcc.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/toolset.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/clang.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/intel-linux.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/pathscale.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/pgi.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/vacpp.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/xlcpp.jam.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/clang-linux-3.9.0.py.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/gcc-4.8.3-linux.py.patch"; then return 1; fi
cd -
cd ./libs/iostreams
echo "In ZOPEN_INIT, applying patch to lib - iostreams"
if ! apply_patch "$ZOPEN_ROOT/boostPatches/iostreams_build.Jamfile.v2.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/iostream_test_Jamfile_v2.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/auto_close_test.cpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/flush_test.cpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/seekable_filter_test.cpp.patch"; then return 1; fi
cd -
cd ./libs/charconv
echo "In ZOPEN_INIT, applying patch to lib - chrono"
if ! apply_patch "$ZOPEN_ROOT/boostPatches/charconv_bigint.hpp.patch"; then return 1; fi
cd -
cd ./libs/chrono
echo "In ZOPEN_INIT, applying patch to lib - chrono"
if ! apply_patch "$ZOPEN_ROOT/boostPatches/chrono.hpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/chrono_io.hpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/time_point_io.hpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/runtime_resolution.cpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/duration_duration_fail.cpp.patch"; then return 1; fi
if ! apply_patch "$ZOPEN_ROOT/boostPatches/system_clocks.hpp.patch"; then return 1; fi
cd -
cd ./libs/test
echo "In ZOPEN_INIT, applying patch to lib - test framework"
if ! apply_patch "$ZOPEN_ROOT/boostPatches/execution_monitor.ipp.patch"; then return 1; fi
cd -
cd ./libs/filesystem
echo "In ZOPEN_INIT, applying patch to lib - filesystem"
if ! apply_patch "$ZOPEN_ROOT/boostPatches/directory.cpp.patch"; then return 1; fi
cd -
cd ./libs/json
echo "In ZOPEN_INIT, applying patch to lib - json"
if ! apply_patch "$ZOPEN_ROOT/boostPatches/json_bigint.hpp.patch"; then return 1; fi
cd -
echo `pwd`
}
zopen_pre_configure()
{
var="using clang : clang++ : <compileflags>-DNDEBUG -march=arch10 -D_UNIX03_THREADS -D_POSIX_THREADS -fasm '\\${CPPFLAGS}' '\\${CFLAGS}' '\\${CXXFLAGS}' : 14.0.0 ;"
awk -v var="$var" '{gsub("using clang ;", var)}1' project-config.jam > temp_file && mv temp_file project-config.jam
awk -v var="$var" '{gsub("using clang ;", var)}1' project-config.jam > temp_file && mv temp_file project-config.jam
awk -v CPPFLAGS="$CPPFLAGS" -v CXXFLAGS="$CXXFLAGS" -v ZOPEN_EXTRA_LDFLAGS="$ZOPEN_EXTRA_LDFLAGS" -v LIBS="$LIBS" '
/<toolset>como-linux:<define>_GNU_SOURCE=1/ {
print
if (getline next_line && index(next_line, "cxxflags") == 0) {
if (length(CPPFLAGS) > 0 || length(CXXFLAGS) > 0) {
print "<toolset>clang:<cxxflags>\"" CPPFLAGS " " CXXFLAGS "\""
}
if (length(ZOPEN_EXTRA_LDFLAGS) > 0 || length(LIBS) > 0) {
print "<toolset>clang:<linkflags>\"" ZOPEN_EXTRA_LDFLAGS " " LIBS "\""
}
} else {
print next_line
}
next
}
1
' Jamroot > temp && mv temp Jamroot
cd -
}
zopen_check_results()
{
dir="$1"
pfx="$2"
chk="$1/$2_check.log"
failures=$(egrep "^\.\.\.failed" $chk | wc -l)
failures_as_expected=$(egrep "^(failed-as-expected)" $chk | wc -l)
skipped=$(egrep "^\.\.\.skipped" $chk | wc -l)
passed=$(egrep "^\*\*passed" $chk | wc -l)
totalTests=$(($failures+$skipped+$passed+$failures_as_expected))
# Echo the following information to gauge build health
cat <<ZZ
actualFailures:${failures}
totalTests:${totalTests}
expectedFailures:${failures}
ZZ
}
zopen_append_to_env()
{
# echo envars outside of PATH, MANPATH, LIBPATH
}
zopen_append_to_setup()
{
# echo commands that will run when installing via setup.sh
}
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
cat boost/version.hpp | grep "define BOOST_LIB_VERSION" | cut -d'"' -f2 | sed 's/_/./'
}