1 #!/usr/bin/env bash 2 # Copyright 2017 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 17 TF_PREFIX='/usr/local' 18 19 usage() { 20 echo "Usage: $0 OPTIONS" 21 echo -e "-p, --prefix\tset installation prefix (default: /usr/local)" 22 echo -e "-v, --version\tset TensorFlow version" 23 echo -e "-h, --help\tdisplay this message" 24 } 25 26 [ $# == 0 ] && usage && exit 0 27 28 # read the options 29 ARGS=$(getopt -o p:v:h --long prefix:,version:,help -n $0 -- "$@") 30 eval set -- "$ARGS" 31 32 # extract options and their arguments into variables. 33 while true ; do 34 case "$1" in 35 -h|--help) usage ; exit ;; 36 -p|--prefix) 37 case "$2" in 38 "") shift 2 ;; 39 *) TF_PREFIX=$2 ; shift 2 ;; 40 esac ;; 41 -v|--version) 42 case "$2" in 43 "") shift 2 ;; 44 *) TF_VERSION=$2 ; shift 2 ;; 45 esac ;; 46 --) shift ; break ;; 47 *) echo "Internal error! Try '$0 --help' for more information." ; exit 1 ;; 48 esac 49 done 50 51 [ -z $TF_VERSION ] && echo "Specify a version using -v or --version" && exit 1 52 53 echo "Generating pkgconfig file for TensorFlow $TF_VERSION in $TF_PREFIX" 54 55 cat << EOF > tensorflow.pc 56 prefix=${TF_PREFIX} 57 exec_prefix=\${prefix} 58 libdir=\${exec_prefix}/lib 59 includedir=\${prefix}/include 60 61 Name: TensorFlow 62 Version: ${TF_VERSION} 63 Description: Library for computation using data flow graphs for scalable machine learning 64 Requires: 65 Libs: -L\${libdir} -ltensorflow 66 Cflags: -I\${includedir} 67 EOF 68