forked from google/deepvariant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-prereq.sh
executable file
·138 lines (111 loc) · 4.98 KB
/
build-prereq.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
#!/bin/bash
set -euo pipefail
# Copyright 2017 Google Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
echo ========== Load config settings.
source settings.sh
################################################################################
# Misc. setup
################################################################################
note_build_stage "Install the runtime packages"
./run-prereq.sh
note_build_stage "Update package list"
sudo -H apt-get -qq -y update
note_build_stage "Install development packages"
sudo -H apt-get -y install pkg-config zip g++ zlib1g-dev unzip curl git
################################################################################
# Java
################################################################################
note_build_stage "Install Java and friends"
# Java is available on Kokoro, so we add this cutout.
if ! java -version 2>&1 | fgrep "1.8"; then
echo "No Java 8, will install."
sudo -H apt-get install -y software-properties-common debconf-utils
sudo add-apt-repository -y ppa:webupd8team/java
sudo -H apt-get -qq -y update
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections
sudo -H apt-get install -y oracle-java8-installer
sudo -H apt-get -y install ca-certificates-java
sudo update-ca-certificates -f
else
echo "Java 8 found, will not reinstall."
fi
################################################################################
# bazel
################################################################################
note_build_stage "Install bazel"
if bazel --bazelrc=/dev/null --nomaster_bazelrc version
then
echo "Bazel already installed on the machine, not reinstalling"
else
# https://bazel.build/versions/master/docs/install-ubuntu.html
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" |
sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
sudo -H apt-get -qq -y update
sudo -H apt-get -y install bazel
sudo -H apt-get -y upgrade bazel
fi
################################################################################
# CLIF
################################################################################
note_build_stage "Install CLIF binary"
if [[ -e /usr/local/clif/bin/pyclif ]];
then
echo "CLIF already installed."
else
# Figure out which linux installation we are on to fetch an appropriate
# version of the pre-built CLIF binary. Note that we only support now Ubuntu
# 14 and 16.
case "$(lsb_release -d)" in
*Ubuntu*16.*.*) export DV_PLATFORM="ubuntu-16" ;;
*Ubuntu*14.*.*) export DV_PLATFORM="ubuntu-14" ;;
*) echo "CLIF is not installed on this machine and a prebuilt binary is not
unavailable for this platform. Please install CLIF at
https://github.com/google/clif before continuing."
exit 1
esac
OSS_CLIF_ROOT="${DV_PACKAGE_BUCKET_PATH}/oss_clif"
OSS_CLIF_PKG="oss_clif.${DV_PLATFORM}.latest.tgz"
if [[ ! -f "/tmp/${OSS_CLIF_PKG}" ]]; then
gsutil cp "${OSS_CLIF_ROOT}/${OSS_CLIF_PKG}" /tmp/
fi
(cd / && sudo tar xzf "/tmp/${OSS_CLIF_PKG}")
sudo ldconfig # Reload shared libraries.
fi
################################################################################
# TensorFlow
################################################################################
note_build_stage "Download and configure TensorFlow sources"
(cd .. &&
git clone https://github.com/tensorflow/tensorflow &&
cd tensorflow &&
git checkout "${DV_TENSORFLOW_GIT_SHA}" &&
echo | ./configure)
note_build_stage "build-prereq.sh complete"