forked from TileDB-Inc/TileDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·215 lines (193 loc) · 7.03 KB
/
bootstrap
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
#!/bin/bash
# Adapted from Pivotals libhdfs3 native c++ hdfs client project
# https://github.com/Pivotal-Data-Attic/pivotalrd-libhdfs3
die() {
echo "$@" 1>&2 ; exit 1
}
arg() {
echo "$1" | sed "s/^${2-[^=]*=}//" | sed "s/:/;/g"
}
# Detect directory information.
source_dir=`cd "\`dirname \"$0\"\`";pwd`
binary_dir=`pwd`
# Choose the default install prefix.
default_prefix="${source_dir}/dist"
# Choose the default dependency install prefix
default_dependency=${DEPENDENCY_INSTALL_PREFIX}
if [ x"${default_dependency}" = x"" ]; then
default_dependency="/opt/dependency"
fi
# Display bootstrap usage
usage() {
echo '
Usage: '"$0"' [<options>]
Options: [defaults in brackets after descriptions]
Configuration:
--help print this message
--prefix=PREFIX install files in tree rooted at PREFIX
['"${default_prefix}"']
--dependency=DIRs specify the dependencies at DIRs, separated by colon
['"${default_dependency}"']
--force-build-all-deps force building of all dependencies, even those
already installed at system-level
--disable-werror disables use of -Werror during build
--disable-cpp-api disables building of the TileDB C++ API
--disable-tests disables building the TileDB tests
--disable-tbb disables use of TBB for parallelization
--disable-stats disables internal TileDB statistics
--disable-avx2 disables use of AVX2 instructions
--enable-static-tiledb enables building TileDB as a static library
--enable-sanitizer=SAN enable sanitizer (clang only)
(address|memory|leak|thread|undefined)
--enable-debug enable debug build
--enable-release-symbols enable create symbols for release build
--enable-coverage enable build with code coverage support
--enable-verbose enable verbose status messages
--enable-hdfs enables the hdfs storage backend
--enable-s3 enables the s3 storage backend
--enable-azure enables the azure storage backend
--enable-gcs enables the gcs storage backend
--enable-serialization enables query serialization support
--enable-tools enables TileDB CLI tools (experimental)
--enable-ccache enables use of ccache (if present)
--enable-arrow-tests enables the compilation of the arrow adapter unit tests
--enable=arg1,arg2... same as "--enable-arg1 --enable-arg2 ..."
Dependencies:
c/c++ compiler
GNU make
cmake http://www.cmake.org/
Example:
mkdir build
cd build
../bootstrap --prefix=/path/to/install --dependency=/path/to/dep1:path/to/dep2...
make
make install
'
exit 10
}
# Parse arguments
prefix_dirs="${default_prefix}"
dependency_dir="${default_dependency}"
sanitizer=""
build_type="Release"
tiledb_verbose="OFF"
tiledb_hdfs="OFF"
tiledb_s3="OFF"
tiledb_azure="OFF"
tiledb_gcs="OFF"
tiledb_werror="ON"
tiledb_tests="ON"
tiledb_cpp_api="ON"
tiledb_force_all_deps="OFF"
tiledb_tbb="OFF"
tiledb_stats="ON"
tiledb_static="OFF"
tiledb_disable_avx2=""
tiledb_serialization="OFF"
tiledb_tools="OFF"
tiledb_ccache="OFF"
tiledb_arrow_tests="OFF"
enable_multiple=""
while test $# != 0; do
case "$1" in
--prefix=*) dir=`arg "$1"`
prefix_dirs="$dir";;
--dependency=*) dir=`arg "$1"`
dependency_dir="$dir";;
--force-build-all-deps) tiledb_force_all_deps="ON";;
--disable-werror) tiledb_werror="OFF";;
--disable-tests) tiledb_tests="OFF";;
--disable-cpp-api) tiledb_cpp_api="OFF";;
--disable-tbb) tiledb_tbb="OFF";;
--disable-stats) tiledb_stats="OFF";;
--disable-avx2) tiledb_disable_avx2="-DCOMPILER_SUPPORTS_AVX2=FALSE";;
--enable-static-tiledb) tiledb_static="ON";;
--enable-sanitizer=*) san=`arg "$1"`
sanitizer="$san";;
--enable-debug) build_type="Debug";;
--enable-release-symbols) build_type="RelWithDebInfo";;
--enable-coverage) build_type="Coverage";;
--enable-verbose) tiledb_verbose="ON";;
--enable-hdfs) tiledb_hdfs="ON";;
--enable-s3) tiledb_s3="ON";;
--enable-azure) tiledb_azure="ON";;
--enable-gcs) tiledb_gcs="ON";;
--enable-serialization) tiledb_serialization="ON";;
--enable-tools) tiledb_tools="ON";;
--enable-ccache) tiledb_ccache="ON";;
--enable-arrow-tests) tiledb_arrow_tests="ON";;
--enable=*) s=`arg "$1"`
enable_multiple="$s";;
--help) usage ;;
*) die "Unknown option: $1" ;;
esac
shift
done
# Parse the comma-separated list of enables.
IFS=',' read -ra enables <<< "$enable_multiple"
for en in "${enables[@]}"; do
case "$en" in
debug) build_type="Debug";;
release-symbols) build_type="RelWithDebInfo";;
coverage) build_type="Coverage";;
verbose) tiledb_verbose="ON";;
s3) tiledb_s3="ON";;
azure) tiledb_azure="ON";;
gcs) tiledb_gcs="ON";;
serialization) tiledb_serialization="ON";;
tools) tiledb_tools="ON";;
ccache) tiledb_ccache="ON";;
arrow-tests) tiledb_arrow_tests="ON";;
hdfs) tiledb_hdfs="ON";;
static-tiledb) tiledb_static="ON";;
*) die "Unknown option: --enable-$en" ;;
esac
done
if [ "${source_dir}" = "${binary_dir}" ]; then
die "cannot build the project in the source directory! Out-of-source build is enforced!"
fi
# Check clang compiler
if [[ x"${CC}" = x"" ]]; then
CC=gcc
fi
if [[ x"${CXX}" = x"" ]]; then
CXX=g++
fi
c_compiler=`which ${CC}`
cxx_compiler=`which ${CXX}`
cmake=`which cmake`
if [[ ! -x ${c_compiler} ]]; then
die "cannot find c compiler"
fi
if [[ ! -x ${cxx_compiler} ]]; then
die "cannot find cplusplus compiler"
fi
if [[ ! -x ${cmake} ]]; then
die "cannot find cmake"
fi
# Configure
${cmake} -DCMAKE_BUILD_TYPE=${build_type} \
-DCMAKE_INSTALL_PREFIX="${prefix_dirs}" \
-DCMAKE_C_COMPILER="${c_compiler}" \
-DCMAKE_CXX_COMPILER="${cxx_compiler}" \
-DCMAKE_PREFIX_PATH="${dependency_dir}" \
-DTILEDB_VERBOSE=${tiledb_verbose} \
-DTILEDB_HDFS=${tiledb_hdfs} \
-DTILEDB_S3=${tiledb_s3} \
-DTILEDB_AZURE=${tiledb_azure} \
-DTILEDB_GCS=${tiledb_gcs} \
-DTILEDB_SERIALIZATION=${tiledb_serialization} \
-DTILEDB_TOOLS=${tiledb_tools} \
-DTILEDB_WERROR=${tiledb_werror} \
-DTILEDB_CPP_API=${tiledb_cpp_api} \
-DTILEDB_TBB=${tiledb_tbb} \
-DTILEDB_STATS=${tiledb_stats} \
-DTILEDB_STATIC=${tiledb_static} \
-DTILEDB_TESTS=${tiledb_tests} \
-DTILEDB_CCACHE=${tiledb_ccache} \
-DTILEDB_ARROW_TESTS=${tiledb_arrow_tests} \
-DTILEDB_FORCE_ALL_DEPS=${tiledb_force_all_deps} \
-DSANITIZER="${sanitizer}" \
${tiledb_disable_avx2} \
"${source_dir}" || die "failed to configure the project"
echo 'bootstrap success. Run "make" to build, "make check" to test, or "make -C tiledb install" to install.'