From 7cc6a69866f1e749974810f49688e5cb2a63bcfc Mon Sep 17 00:00:00 2001 From: avctrh Date: Thu, 9 Mar 2017 19:54:24 -0500 Subject: [PATCH] Added installation script for OS X dependencies under tools/ (#80) * consolidated OS X instructions to the shell script, removed step-by-step instructions from README.md --- README.md | 22 +++++------------ tools/install_osx_dependencies.sh | 41 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 16 deletions(-) create mode 100755 tools/install_osx_dependencies.sh diff --git a/README.md b/README.md index 70be846..983d400 100644 --- a/README.md +++ b/README.md @@ -89,21 +89,11 @@ There is also a demo application: ## Build on Mac OS X -The following instructions were verified with Mac OS X El Capitan. +Run the [install_osx_dependencies.sh](./tools/install_osx_dependencies.sh) +script in the `tools/` directory. The script installs dependencies +via [Homebrew](http://brew.sh) and then downloads and installs the TensorFlow +library on your machine under `/usr/local`. -- Install dependencies via [Homebrew](http://brew.sh): +After running the script to install system dependencies, build the project with stack: - brew install protobuf - brew install snappy - -- Install the TensorFlow library on your machine: - - curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.0.0.tar.gz > libtensorflow.tar.gz - tar zxf libtensorflow.tar.gz -C /usr/local - mv /usr/local/lib/libtensorflow.so /usr/local/lib/libtensorflow.dylib - install_name_tool -id libtensorflow.dylib /usr/local/lib/libtensorflow.dylib - rm libtensorflow.tar.gz - -- Run stack: - - stack test + stack test diff --git a/tools/install_osx_dependencies.sh b/tools/install_osx_dependencies.sh new file mode 100755 index 0000000..df0fdfa --- /dev/null +++ b/tools/install_osx_dependencies.sh @@ -0,0 +1,41 @@ +#!/bin/bash +set -eu + +echo "Installing OSX System Dependencies" +echo "==================================" + +if ! type "brew" > /dev/null; then + echo "Requires homebrew to be installed." + echo "Install homebrew from https://brew.sh/" + exit 1 +fi + +if brew ls --versions protobuf > /dev/null; then + echo "protobuf installation detected." +else + echo "protobuf not installed, installing with homebrew." + brew install protobuf +fi + +if brew ls --versions snappy > /dev/null; then + echo "snappy installation detected." +else + echo "snappy not installed, installing with homebrew." + brew install snappy +fi + +echo "Downloading libtensorflow..." +curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.0.0.tar.gz > libtensorflow.tar.gz + +echo "Extracting and copying libtensorflow..." +tar zxf libtensorflow.tar.gz -C /usr/local +rm libtensorflow.tar.gz +mv /usr/local/lib/libtensorflow.so /usr/local/lib/libtensorflow.dylib + +sudo install_name_tool -id libtensorflow.dylib /usr/local/lib/libtensorflow.dylib + +echo "Installing submodule dependencies" +git submodule update --init --recursive + +echo "" +echo "Finished"