1 #!/bin/bash -e 2 # Copyright 2015 The TensorFlow Authors. All Rights Reserved. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # ============================================================================== 16 # Builds protobuf 3 for Linux inside the local build tree. 17 18 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 19 GENDIR="$(pwd)/tensorflow/contrib/makefile/gen/protobuf" 20 HOST_GENDIR="$(pwd)/tensorflow/contrib/makefile/gen/protobuf-host" 21 mkdir -p "${GENDIR}" 22 ln -s "${GENDIR}" "${HOST_GENDIR}" 23 24 if [[ ! -f "tensorflow/contrib/makefile/downloads/protobuf/autogen.sh" ]]; then 25 echo "You need to download dependencies before running this script." 1>&2 26 echo "tensorflow/contrib/makefile/download_dependencies.sh" 1>&2 27 exit 1 28 fi 29 source "${SCRIPT_DIR}"/build_helper.subr 30 JOB_COUNT="${JOB_COUNT:-$(get_job_count)}" 31 32 cd tensorflow/contrib/makefile/downloads/protobuf 33 34 ./autogen.sh 35 if [ $? -ne 0 ] 36 then 37 echo "./autogen.sh command failed." 38 exit 1 39 fi 40 41 ./configure --prefix="${GENDIR}" --with-pic 42 if [ $? -ne 0 ] 43 then 44 echo "./configure command failed." 45 exit 1 46 fi 47 48 make clean 49 50 make -j"${JOB_COUNT}" 51 if [ $? -ne 0 ] 52 then 53 echo "make command failed." 54 exit 1 55 fi 56 57 make install 58 59 echo "$(basename $0) finished successfully!!!" 60