64 lines
2.1 KiB
Ruby
64 lines
2.1 KiB
Ruby
class Libtensorflow < Formula
|
|
desc "C interface for Google's OS library for Machine Intelligence"
|
|
homepage "https://www.tensorflow.org/"
|
|
url "https://github.com/tensorflow/tensorflow/archive/v1.10.0.tar.gz"
|
|
sha256 "ee9cb98d9e0d8106f2f4ed52a38fe89399324af303e1401567e5b64a9f86744b"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "6f9c81e909ed200949e523898dd8f698d6705ee3b12630d21060219306756924" => :high_sierra
|
|
sha256 "be5a86a4d8c6c9c5b812dda7570b557408164416439695936d3408d2f17ae618" => :sierra
|
|
sha256 "90a7bcadb131eefa62c5cc1642522f7c6a389d98fd2d8aa159b69edb601d7713" => :el_capitan
|
|
end
|
|
|
|
depends_on "bazel" => :build
|
|
depends_on :java => ["1.8", :build]
|
|
|
|
def install
|
|
cmd = Language::Java.java_home_cmd("1.8")
|
|
ENV["JAVA_HOME"] = Utils.popen_read(cmd).chomp
|
|
|
|
ENV["PYTHON_BIN_PATH"] = which("python").to_s
|
|
ENV["CC_OPT_FLAGS"] = "-march=native"
|
|
ENV["TF_NEED_JEMALLOC"] = "1"
|
|
ENV["TF_NEED_GCP"] = "0"
|
|
ENV["TF_NEED_HDFS"] = "0"
|
|
ENV["TF_ENABLE_XLA"] = "0"
|
|
ENV["USE_DEFAULT_PYTHON_LIB_PATH"] = "1"
|
|
ENV["TF_NEED_OPENCL"] = "0"
|
|
ENV["TF_NEED_CUDA"] = "0"
|
|
ENV["TF_NEED_MKL"] = "0"
|
|
ENV["TF_NEED_VERBS"] = "0"
|
|
ENV["TF_NEED_MPI"] = "0"
|
|
ENV["TF_NEED_S3"] = "1"
|
|
ENV["TF_NEED_GDR"] = "0"
|
|
ENV["TF_NEED_KAFKA"] = "0"
|
|
ENV["TF_NEED_OPENCL_SYCL"] = "0"
|
|
ENV["TF_DOWNLOAD_CLANG"] = "0"
|
|
ENV["TF_SET_ANDROID_WORKSPACE"] = "0"
|
|
system "./configure"
|
|
|
|
system "bazel", "build", "--compilation_mode=opt", "--copt=-march=native", "tensorflow:libtensorflow.so"
|
|
lib.install Dir["bazel-bin/tensorflow/*.so"]
|
|
(include/"tensorflow/c").install "tensorflow/c/c_api.h"
|
|
(lib/"pkgconfig/tensorflow.pc").write <<~EOS
|
|
Name: tensorflow
|
|
Description: Tensorflow library
|
|
Version: #{version}
|
|
Libs: -L#{lib} -ltensorflow
|
|
Cflags: -I#{include}
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <stdio.h>
|
|
#include <tensorflow/c/c_api.h>
|
|
int main() {
|
|
printf("%s", TF_Version());
|
|
}
|
|
EOS
|
|
system ENV.cc, "-L#{lib}", "-ltensorflow", "-o", "test_tf", "test.c"
|
|
assert_equal version, shell_output("./test_tf")
|
|
end
|
|
end
|