forked from yugabyte/yugabyte-db-thirdparty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_thirdparty.sh
executable file
·63 lines (56 loc) · 2.34 KB
/
build_thirdparty.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
#!/usr/bin/env bash
#
# Copyright (c) YugaByte, Inc.
#
# 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.
#
set -euo pipefail
yb_thirdparty_repo_root=$( cd "${BASH_SOURCE%/*}" && pwd )
. "$yb_thirdparty_repo_root/yb-thirdparty-common.sh"
if [[ -n ${YB_THIRDPARTY_DIR:-} && $YB_THIRDPARTY_DIR != $yb_thirdparty_repo_root ]]; then
echo >&2 "Warning: un-setting previously set YB_THIRDPARTY_DIR: $YB_THIRDPARTY_DIR"
fi
export YB_THIRDPARTY_DIR=$yb_thirdparty_repo_root
echo "YB_THIRDPARTY_DIR=${YB_THIRDPARTY_DIR:-undefined}"
if [[ -z ${YB_SRC_ROOT:-} ]]; then
yb_src_root_candidate=$( cd "${BASH_SOURCE%/*}"/.. && pwd )
if [[ -d $yb_src_root_candidate/build-support ]]; then
YB_SRC_ROOT=$yb_src_root_candidate
fi
fi
echo "YB_SRC_ROOT=${YB_SRC_ROOT:-undefined}"
if [[ -n ${YB_SRC_ROOT:-} ]]; then
echo "Building YugabyteDB third-party dependencies inside a YugabyteDB source tree: " \
"$YB_SRC_ROOT"
. "$YB_SRC_ROOT/build-support/common-build-env.sh"
detect_brew
add_brew_bin_to_path
else
echo "Building YugabyteDB in a stand-alone mode (not within a YugabyteDB source tree)."
# Running outside of a YugabyteDB codebase -- this is a stand-alone thirdparty deps build.
if [[ ! -d $YB_THIRDPARTY_DIR/venv ]]; then
python3 -m venv "$YB_THIRDPARTY_DIR/venv"
fi
set +u
. "$YB_THIRDPARTY_DIR/venv/bin/activate"
set -u
( set -x; cd "$YB_THIRDPARTY_DIR" && pip3 install -r requirements.txt )
fi
echo "YB_LINUXBREW_DIR=${YB_LINUXBREW_DIR:-undefined}"
if [[ $OSTYPE == linux* && -n ${YB_LINUXBREW_DIR:-} ]]; then
if [[ ! -d $YB_LINUXBREW_DIR ]]; then
fatal "Directory specified by YB_LINUXBREW_DIR ('$YB_LINUXBREW_DIR') does not exist"
fi
export PATH=$YB_LINUXBREW_DIR/bin:$PATH
fi
echo "YB_CUSTOM_HOMEBREW_DIR=${YB_CUSTOM_HOMEBREW_DIR:-undefined}"
set -x
python3 "$YB_THIRDPARTY_DIR/yb_build_thirdparty_main.py" "$@" ${YB_BUILD_THIRDPARTY_EXTRA_ARGS:-}