Index: science/Makefile =================================================================== --- science/Makefile +++ science/Makefile @@ -269,6 +269,7 @@ SUBDIR += py-scipy SUBDIR += py-scoria SUBDIR += py-spglib + SUBDIR += py-tensorflow SUBDIR += py-veusz SUBDIR += py-ws2300 SUBDIR += pybrain @@ -307,6 +308,7 @@ SUBDIR += svmlight SUBDIR += szip SUBDIR += teem + SUBDIR += tensorflow-core SUBDIR += tfel SUBDIR += tinker SUBDIR += udunits Index: science/py-tensorflow/Makefile =================================================================== --- /dev/null +++ science/py-tensorflow/Makefile @@ -0,0 +1,15 @@ +# $FreeBSD$ + +PKGNAMESUFFIX= +PKGNAMEPREFIX= ${PYTHON_PREFIX} + +MASTERDIR= ${.CURDIR}/../../science/tensorflow-core + +USES= python:3.6 + +BAZEL_TARGET= //tensorflow/python:python + +do-install: + asd + +.include "${MASTERDIR}/Makefile" Index: science/tensorflow-core/Makefile =================================================================== --- /dev/null +++ science/tensorflow-core/Makefile @@ -0,0 +1,90 @@ +# $FreeBSD$ + +PORTNAME= tensorflow +DISTVERSION= 2.0.0-alpha0 +CATEGORIES= science +MASTER_SITES= LOCAL/arrowd +PKGNAMESUFFIX?= -core + +MAINTAINER= arrowd@FreeBSD.org +COMMENT= Computation using data flow graphs for scalable machine learning + +LICENSE= APACHE20 + +ONLY_FOR_ARCHS= amd64 + +USES+= tar:xz + +USE_LDCONFIG= yes + +NO_BUILD= yes + +.if defined(PREPARING) +FETCH_DEPENDS= git:devel/git +BUILD_DEPENDS= bazel:devel/bazel \ + ${PYTHON_PKGNAMEPREFIX}numpy>=0:math/py-numpy@${PY_FLAVOR} + +USES+= python:3.6 + +HAS_CONFIGURE= yes +CONFIGURE_ENV= PYTHON_BIN_PATH=${PYTHON_CMD} \ + PYTHON_LIB_PATH=${PYTHON_SITELIBDIR} \ + TF_ENABLE_XLA=1 \ + TF_NEED_OPENCL_SYCL=0 \ + TF_NEED_ROCM=0 \ + TF_NEED_CUDA=0 \ + TF_DOWNLOAD_CLANG=0 \ + TF_NEED_MPI=0 \ + CC_OPT_FLAGS="${CFLAGS}" \ + TF_SET_ANDROID_WORKSPACE=0 + +BAZEL_TARGET?= //tensorflow:libtensorflow.so +.endif + +.if defined(PREPARING) +fetch1: ${WRKDIR} + mkdir -p ${WRKDIR} + cd ${WRKDIR} && git clone --depth 1 -b v${DISTVERSION} https://github.com/tensorflow/tensorflow tensorflow-${DISTVERSION} || true + make do-patch + +configure1: + make do-configure + +build1: + cd ${WRKSRC} && bazel info && \ + bazel build ${BAZEL_EXTRA_ARGS} ${BAZEL_TARGET} + +clean1: + rm -rf ${HOME}/.cache/bazel + +install1: + mkdir -p ${STAGEDIR}/${DISTNAME}/lib + mkdir -p ${STAGEDIR}/${DISTNAME}/include/tensorflow/c + + ${INSTALL_PROGRAM} ${WRKSRC}/bazel-bin/tensorflow/libtensorflow.so ${STAGEDIR}/${DISTNAME}/lib + ${INSTALL_PROGRAM} ${WRKSRC}/bazel-bin/tensorflow/libtensorflow_framework.so ${STAGEDIR}/${DISTNAME}/lib + ${INSTALL_DATA} ${WRKSRC}/tensorflow/c/c_api.h ${STAGEDIR}/${DISTNAME}/include/tensorflow/c + +package1: + cd ${STAGEDIR} && tar -caf /tmp/${PORTNAME}-${PORTVERSION}.tar.xz ${DISTNAME} + + cd /tmp \ + && sha256 ${DISTNAME}${EXTRACT_SUFX} \ + && ${ECHO} -n "SIZE (${DISTNAME}${EXTRACT_SUFX}) = " \ + && ${STAT} -f %z ${DISTNAME}${EXTRACT_SUFX} + +.else + +do-patch: + @${DO_NADA} + +.if !target(do-install) +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/lib/*.so ${STAGEDIR}${PREFIX}/lib + ${MKDIR} ${STAGEDIR}${PREFIX}/include/tensorflow/c + ${INSTALL_DATA} ${WRKSRC}/include/tensorflow/c/*.h ${STAGEDIR}${PREFIX}/include/tensorflow/c +.endif + +.endif + +.include Index: science/tensorflow-core/distinfo =================================================================== --- /dev/null +++ science/tensorflow-core/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1556257919 +SHA256 (tensorflow-2.0.0-alpha0.tar.xz) = 734a0b5546ed0e173c082004468ae1559aef4788a124a8e12cd6a97b6716c193 +SIZE (tensorflow-2.0.0-alpha0.tar.xz) = 28962572 Index: science/tensorflow-core/files/patch-tensorflow_BUILD =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-tensorflow_BUILD @@ -0,0 +1,10 @@ +--- tensorflow/BUILD.orig 2019-04-25 07:56:48 UTC ++++ tensorflow/BUILD +@@ -474,6 +474,7 @@ tf_cc_shared_object( + "//tensorflow:windows": [], + "//conditions:default": [ + "-Wl,--version-script,$(location //tensorflow:tf_framework_version_script.lds)", ++ "-lexecinfo", + ], + }), + linkstatic = 1, Index: science/tensorflow-core/files/patch-tensorflow_compiler_xla_BUILD =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-tensorflow_compiler_xla_BUILD @@ -0,0 +1,10 @@ +--- tensorflow/compiler/xla/BUILD.orig 2019-04-25 07:56:48 UTC ++++ tensorflow/compiler/xla/BUILD +@@ -163,6 +163,7 @@ cc_library( + "overflow_util.h", + "util.h", + ], ++ linkopts = ["-lexecinfo"], + visibility = ["//visibility:public"], + deps = [ + ":status", Index: science/tensorflow-core/files/patch-tensorflow_contrib_ignite_kernels_client_ignite__plain__client__unix.cc =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-tensorflow_contrib_ignite_kernels_client_ignite__plain__client__unix.cc @@ -0,0 +1,11 @@ +--- tensorflow/contrib/ignite/kernels/client/ignite_plain_client_unix.cc.orig 2019-04-26 12:45:38 UTC ++++ tensorflow/contrib/ignite/kernels/client/ignite_plain_client_unix.cc +@@ -16,6 +16,8 @@ limitations under the License. + #include "tensorflow/contrib/ignite/kernels/client/ignite_plain_client.h" + + #include ++#include ++#include + #include + #include + #include Index: science/tensorflow-core/files/patch-tensorflow_core_platform_cloud_gcs__dns__cache.cc =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-tensorflow_core_platform_cloud_gcs__dns__cache.cc @@ -0,0 +1,11 @@ +--- tensorflow/core/platform/cloud/gcs_dns_cache.cc.orig 2019-04-25 07:56:47 UTC ++++ tensorflow/core/platform/cloud/gcs_dns_cache.cc +@@ -16,6 +16,8 @@ limitations under the License. + #include "tensorflow/core/platform/cloud/gcs_dns_cache.h" + #ifndef _WIN32 + #include ++#include ++#include + #include + #else + #include Index: science/tensorflow-core/files/patch-tensorflow_core_platform_posix_env.cc =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-tensorflow_core_platform_posix_env.cc @@ -0,0 +1,19 @@ +--- tensorflow/core/platform/posix/env.cc.orig 2019-04-25 07:56:49 UTC ++++ tensorflow/core/platform/posix/env.cc +@@ -95,14 +95,14 @@ class PosixEnv : public Env { + // Has to be casted to long first, else this error appears: + // static_cast from 'pthread_t' (aka 'pthread *') to 'int32' (aka 'int') + // is not allowed +- return static_cast(static_cast(pthread_self())); ++ return static_cast(reinterpret_cast(pthread_self())); + #else + return static_cast(pthread_self()); + #endif + } + + bool GetCurrentThreadName(string* name) override { +-#if defined(__ANDROID__) || defined(__EMSCRIPTEN__) ++#if defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__) + return false; + #else + char buf[100]; Index: science/tensorflow-core/files/patch-third__party_aws_BUILD.bazel =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-third__party_aws_BUILD.bazel @@ -0,0 +1,12 @@ +--- third_party/aws/BUILD.bazel.orig 2019-04-25 07:56:48 UTC ++++ third_party/aws/BUILD.bazel +@@ -15,6 +15,9 @@ cc_library( + "@org_tensorflow//tensorflow:linux_x86_64": glob([ + "aws-cpp-sdk-core/source/platform/linux-shared/*.cpp", + ]), ++ "@org_tensorflow//tensorflow:freebsd": glob([ ++ "aws-cpp-sdk-core/source/platform/linux-shared/*.cpp", ++ ]), + "@org_tensorflow//tensorflow:macos": glob([ + "aws-cpp-sdk-core/source/platform/linux-shared/*.cpp", + ]), Index: science/tensorflow-core/files/patch-third__party_gpus_rocm__configure.bzl =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-third__party_gpus_rocm__configure.bzl @@ -0,0 +1,11 @@ +--- third_party/gpus/rocm_configure.bzl.orig 2019-04-24 07:09:33 UTC ++++ third_party/gpus/rocm_configure.bzl +@@ -297,7 +297,7 @@ def _lib_name(lib, cpu_value, version = "", static = F + Returns: + The platform-specific name of the library. + """ +- if cpu_value in ("Linux"): ++ if cpu_value in ("Linux", "FreeBSD"): + if static: + return "lib%s.a" % lib + else: Index: science/tensorflow-core/files/patch-third__party_hwloc_BUILD.bazel =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-third__party_hwloc_BUILD.bazel @@ -0,0 +1,54 @@ +--- third_party/hwloc/BUILD.bazel.orig 2019-04-25 07:56:49 UTC ++++ third_party/hwloc/BUILD.bazel +@@ -36,7 +36,6 @@ template_rule( + "#undef HWLOC_VERSION_RELEASE": "#define HWLOC_VERSION_RELEASE 3", + "#undef HWLOC_VERSION_GREEK": "#define HWLOC_VERSION_GREEK \"\"", + "#undef HWLOC_VERSION": "#define HWLOC_VERSION \"2.0.3\"", +- "#undef HWLOC_LINUX_SYS": "#define HWLOC_LINUX_SYS 1", + "#undef hwloc_pid_t": "#define hwloc_pid_t pid_t", + "#undef hwloc_thread_t": "#define hwloc_thread_t pthread_t", + "# undef HWLOC_HAVE_STDINT_H": "# define HWLOC_HAVE_STDINT_H 1 ", +@@ -86,7 +85,6 @@ _INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_COMMON_SUBS = + "#undef HAVE_NL_LANGINFO": "#define HAVE_NL_LANGINFO 1", + "#undef HAVE_OPENAT": "#define HAVE_OPENAT 1", + "#undef HAVE_POSIX_MEMALIGN": "#define HAVE_POSIX_MEMALIGN 1", +- "#undef HAVE_PROGRAM_INVOCATION_NAME": "#define HAVE_PROGRAM_INVOCATION_NAME 1", + "#undef HAVE_PTHREAD_T": "#define HAVE_PTHREAD_T 1", + "#undef HAVE_PUTWC": "#define HAVE_PUTWC 1", + "#undef HAVE_SETLOCALE": "#define HAVE_SETLOCALE 1", +@@ -149,7 +147,6 @@ _INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_COMMON_SUBS = + "#undef HWLOC_HAVE_SYSCALL": "#define HWLOC_HAVE_SYSCALL 1", + "#undef HWLOC_HAVE_X11_KEYSYM": "#define HWLOC_HAVE_X11_KEYSYM 1", + "#undef HWLOC_HAVE_X86_CPUID": "#define HWLOC_HAVE_X86_CPUID 1", +- "#undef HWLOC_LINUX_SYS": "#define HWLOC_LINUX_SYS 1", + "#undef HWLOC_SIZEOF_UNSIGNED_INT": "#define HWLOC_SIZEOF_UNSIGNED_INT 4", + "#undef HWLOC_SIZEOF_UNSIGNED_LONG": "#define HWLOC_SIZEOF_UNSIGNED_LONG 8", + "#undef HWLOC_SYM_PREFIX": "#define HWLOC_SYM_PREFIX hwloc_", +@@ -224,13 +221,12 @@ cc_library( + "hwloc/static-components.h", + "hwloc/topology.c", + "hwloc/topology-hardwired.c", +- "hwloc/topology-linux.c", ++ "hwloc/topology-freebsd.c", + "hwloc/topology-noos.c", + "hwloc/topology-synthetic.c", + "hwloc/topology-xml.c", + "hwloc/topology-xml-nolibxml.c", + "hwloc/traversal.c", +- "include/hwloc/linux.h", + "include/hwloc/plugins.h", + "include/hwloc/shmem.h", + "include/private/autogen/config.h", +@@ -240,10 +236,10 @@ cc_library( + "include/private/misc.h", + "include/private/private.h", + "include/private/xml.h", ++ "hwloc/topology-x86.c", ++ "include/private/cpuid-x86.h", + ] + select({ + "@org_tensorflow//tensorflow:linux_x86_64": [ +- "hwloc/topology-x86.c", +- "include/private/cpuid-x86.h", + ], + "//conditions:default": [], + }), Index: science/tensorflow-core/files/patch-third__party_hwloc_static-components.h =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-third__party_hwloc_static-components.h @@ -0,0 +1,12 @@ +--- third_party/hwloc/static-components.h.orig 2019-04-25 07:56:48 UTC ++++ third_party/hwloc/static-components.h +@@ -22,8 +22,7 @@ static const struct hwloc_component* hwloc_static_comp + &hwloc_xml_component, + &hwloc_synthetic_component, + &hwloc_xml_nolibxml_component, +- &hwloc_linux_component, +- &hwloc_linuxio_component, ++ &hwloc_freebsd_component, + #if defined(__x86_64__) || defined(__amd64__) || defined(_M_IX86) || \ + defined(_M_X64) + &hwloc_x86_component, Index: science/tensorflow-core/files/patch-third__party_llvm_llvm.bzl =================================================================== --- /dev/null +++ science/tensorflow-core/files/patch-third__party_llvm_llvm.bzl @@ -0,0 +1,19 @@ +--- third_party/llvm/llvm.bzl.orig 2019-04-25 07:56:49 UTC ++++ third_party/llvm/llvm.bzl +@@ -243,7 +243,6 @@ posix_cmake_vars = { + linux_cmake_vars = { + "HAVE_MALLOC_H": 1, + "HAVE_LINK_H": 1, +- "HAVE_MALLINFO": 1, + "HAVE_FUTIMENS": 1, + } + +@@ -326,7 +325,7 @@ llvm_all_cmake_vars = select({ + + llvm_linkopts = select({ + "@org_tensorflow//tensorflow:windows": [], +- "//conditions:default": ["-ldl", "-lm", "-lpthread"], ++ "//conditions:default": ["-ldl", "-lm", "-lpthread", "-lexecinfo"], + }) + + llvm_defines = select({ Index: science/tensorflow-core/pkg-descr =================================================================== --- /dev/null +++ science/tensorflow-core/pkg-descr @@ -0,0 +1,12 @@ +TensorFlow is an open source software library for numerical computation using +data flow graphs. Nodes in the graph represent mathematical operations, while +the graph edges represent the multidimensional data arrays (tensors) +communicated between them. The flexible architecture allows you to deploy +computation to one or more CPUs or GPUs in a desktop, server, or mobile device +with a single API. TensorFlow was originally developed by researchers and +engineers working on the Google Brain Team within Google's Machine Intelligence +research organization for the purposes of conducting machine learning and deep +neural networks research, but the system is general enough to be applicable in +a wide variety of other domains as well. + +WWW: https://www.tensorflow.org Index: science/tensorflow-core/pkg-plist =================================================================== --- /dev/null +++ science/tensorflow-core/pkg-plist @@ -0,0 +1,3 @@ +include/tensorflow/c/c_api.h +lib/libtensorflow.so +lib/libtensorflow_framework.so