65 lines
2.2 KiB
Ruby
65 lines
2.2 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.1.tar.gz"
|
|
sha256 "83092d709800e2d93d4d4b1bcacaeb74f2f328962ed764cb35bbee20402879c6"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "3d5fe3570ab9fae79f05b15de3553d80ae39f26487e8a0e396f13277fe6dd567" => :mojave
|
|
sha256 "bb37d21865620cede51698a2ef0ba910fe291dbfbe2b6fa968ed29b90f763564" => :high_sierra
|
|
sha256 "700655b132a6ff84a5bb1bb8c37d0f61813463f5fccca5cde45906e3b070ef21" => :sierra
|
|
sha256 "e88b3b9e0d3f0f60d9719b3bbb35fdc4c56c2ee10df3afe5b684342c3d5f0660" => :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
|