summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaman <perfinion@gentoo.org>2018-07-12 13:21:42 +0800
committerJason Zaman <perfinion@gentoo.org>2018-07-12 13:22:06 +0800
commit9970887ee957cbee76d0855bc009cdb5bae0ad38 (patch)
tree86c1c12fd0d83a6adcef5d480ef734d971c90201 /sci-libs/tensorflow
parentdev-ruby/trollop: add 2.1.3 (diff)
downloadgentoo-9970887ee957cbee76d0855bc009cdb5bae0ad38.tar.gz
gentoo-9970887ee957cbee76d0855bc009cdb5bae0ad38.tar.bz2
gentoo-9970887ee957cbee76d0855bc009cdb5bae0ad38.zip
sci-libs/tensorflow: bump to 1.9.0
Package-Manager: Portage-2.3.40, Repoman-2.3.9
Diffstat (limited to 'sci-libs/tensorflow')
-rw-r--r--sci-libs/tensorflow/Manifest3
-rw-r--r--sci-libs/tensorflow/tensorflow-1.9.0.ebuild425
2 files changed, 428 insertions, 0 deletions
diff --git a/sci-libs/tensorflow/Manifest b/sci-libs/tensorflow/Manifest
index af4c1c9d87ea..070d28f60026 100644
--- a/sci-libs/tensorflow/Manifest
+++ b/sci-libs/tensorflow/Manifest
@@ -19,6 +19,7 @@ DIST cython-3732784c45cfb040a5b0936951d196f83a12ea17.tar.gz 1796107 BLAKE2B 65cd
DIST double-conversion-3992066a95b823efc8ccc1baf82a1cfc73f6e9b8.zip 7071029 BLAKE2B 722c190c941b169a3292ce2141c59b8eb1bcc5edd2ed09669592dddb9354e4c6c094dafe02e5a154f215aec776f9f7cebae36b9b0317b10b707282b1ca9449a5 SHA512 1db0d4805c80e9a08d9a581051d8708ddbfe1d74fd820dccde2c2405c45c06a861bd5b535b25d191cd01064e268f3fe71e58bef16fd39471812aea6c2f97da43
DIST eigen-6913f0cf7d06.tar.gz 2296773 BLAKE2B f3d4ed1577abc7f722fb600e79bcb1294ae5d6a4499668df05a8b9014bfafb576e6d15d3e311080e6e6ed3afd00e60ccd0c1092161a218d200a32668bef83ea2 SHA512 e1cbd55edfc128ee5c2d0bc08a7fec051efb5713f78e2d323ce49074bf1b86d63e7fcc06c01e469c01d2476dd369e4159ecb306f6d28371a3274402d0ea25e87
DIST eigen-e5e305a158a0.tar.gz 2312776 BLAKE2B 268419895e1c49963bd15b6e9142775d782f8d7e6aa88f55eaa7b5dd42ce11456c8687235ff2478bedaf232b7df71832fdbaed62026f7880501c0403cfcf6d4d SHA512 f6070e2cec18c059f296857405c90e06566f643a4e3499a6eceaab8682597c192f8b9b91bdbbfa53aa654969a2269cda6a1c044b92e4a9f8362e8831e773daf8
+DIST eigen-fd6845384b86.tar.gz 2312810 BLAKE2B aae02b053e9b22b0c063d1173b28fd7d71cdec6b6e6702624b8fdeb707ada24e5415079f1a1c7b8fe108c7e632c6c736e13cfbdc101270742565b7045a57616a SHA512 b999e60236abf7a6a5062aa55b0aeefe9254b204416092649d4a88d42fef7c571e3ba563bbbf94033093f789511793d614c1ce94a0a0f3eb4b18df466b6345a5
DIST farmhash-816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz 467122 BLAKE2B 8b9dd426f4b9f732df6c8c09d868d1b1cc006c395b1525c46ea91c75318b723358c8e64bb0d86a73aace2032eded93f0d80cc7c2c77fddd6a39e3402ab4f2cb7 SHA512 7f5110514a8cdc7ce48d33fd94ad67d96a24e42e11b203e4d0986f4190545f051b2a63f8e09f2ac38c3aa4a5c62d9a0e02cd8ce02045037381fb62a99f0dcd00
DIST fft.tgz 72213 BLAKE2B 4a3ac2b4c0bc3275b5743df59241e1cdbd0200371c153ddf54ef6c7c4ec523ee6560547e2d5ef9f3200037c0635bf41c18991ac35f271b1e600d0dbd65d1a9a7 SHA512 f1ceac00cb7b9eb8f625eee7f1f5eea8af363343589a344226628d68baf668c176e6c23b7f904c4e682330352eaa0cd5d00731340d208e94c9657b8f85ae2240
DIST flatbuffers-971a68110e4fc1bace10fcb6deeb189e7e1a34ce.tar.gz 613854 BLAKE2B 982142b7dd81791f221d7f3cbbecf6539549c86c436e0cf3ae0c57bd7535b90083c7d2709abc811abcf3b6fee417a16b1d8dcdedcce58fd8715db7ae785a7bff SHA512 01ffc047483edaaccc13bf256d59eef0c4cb7488618f1e908c74e0dcc599f00856d052d209a079d35e385bef973a4c6daf401107c4be85bba46dcc3b4f453b26
@@ -63,8 +64,10 @@ DIST sqlite-amalgamation-3200000.zip 2069628 BLAKE2B 97b641fdd143af8bd1f4b7b733f
DIST sqlite-amalgamation-3230100.zip 2183147 BLAKE2B af25542f81ac0592d143695466de785779dc8002ebc5b6cf20cb2d56a66cf12b9d4f73392b6ac696b8107beca0e5c3a3e03efb703fa49fc380355d1e9302e78a SHA512 5784f4dea7f14d7dcf5dd07f0e111c8f0b64ff55c68b32a23fba7a36baf1f095c7a35573fc3b57b84822878218b78f9b0187c4e3f0439d4215471ee5f556eee1
DIST swig-3.0.8.tar.gz 7937213 BLAKE2B 38f17631a36f178a478bf77f1a7ea77b50b91ed95ca0363f0f75d86bf7da6d855db314c1b7e67634b0e6e1438a0d141d0241595987142154ee356d60955248bc SHA512 85605bd98bf2b56f5bfca23ae23d76d764d76a174b05836c8686825e912d6326c370e9cf2134c0bf4f425560be103b16bf9c9d075077f52e713a69082616e906
DIST tensorflow-1.8.0.tar.gz 22649439 BLAKE2B 7384c2cf742fb5a8b4e266e95080ae2513c1b112ab97f74839fa8e81bd91bd24645be8afb02e4447ad5fba9f47c4d146f59aa12085937cd3a364ec34c99590f3 SHA512 7280e65d26fb3f15d95f7217ee3bc08d1424cd144cf25bf638fa114fa835b2505dfaf457c55700067d24f485b77120973d094ec568e6d1b1054857402f9c352d
+DIST tensorflow-1.9.0.tar.gz 23571524 BLAKE2B 2961ef5a35d3271512999478f6e260c90c48537e251b41d60ae9e033386c0dd9e1337af85c5441afca1b8cf5b3726349ba0e56cccdfa95fdf1c5e9e4d4db8af5 SHA512 eb25dafccf2ec600c4ca28612362c8317b8b9160610ca9fb60f265815651c155b19ae5be3f213a0d9e716d9e25637d6502164433955247cf6fa5d75408b7ac84
DIST tensorflow-1.9.0_rc1.tar.gz 23639406 BLAKE2B 94f7254b67ebbcf7a6c46f194bf00ecb4e386cf90b74ef436febdbe1f4e9b4e206aeaabd9392f1023d8486ffd91b9e7814a64f8c7275a198a3040a76181d282e SHA512 3354738c6f6e3c8336bd7186379dc8ef02e12aa83db4b65a93a644f5435254fc253f897dfd2b307b2fe77b1dbe6f506f1fccc4d0ea6e04cdf3e3eb9a52ca81fd
DIST tensorflow-1.9.0_rc2.tar.gz 24167723 BLAKE2B b676c8d521a060487fb5d31b75beda2e7c301396ceaa887776e368a16541ed0be0ad85c92901a45d8df324a857a324b706a6d0f38c91a2d991dcd7c40d3ecb3a SHA512 e8544b56a040b0b1a65c92455e002ea33e65d1fcd5f7eb94b4abcae74e0d8aa6982624c0133e9bdda6e57f52f410861977e866112fc1fc28ba9b4c836836a11a
+DIST tensorflow-patches-1.9.0.tar.bz2 8588 BLAKE2B 7fbdaa680b3bc372c760861709776cf333d587398297fb596332bb7394a7747c86cdc87615ae6f74e81d4e6b39a34aa3a9b6ee7cab95237316f20a315773b12b SHA512 35d56a1e71e500f41e423a2b58d58d210737afd2d9cd955aed227036a066506be1b39e7809f71d82c80f055ed43dfe1813213975acfb8d86be38baf24510e0f3
DIST tensorflow-patches-1.9.0_rc1-r2.tar.bz2 9372 BLAKE2B fe6d33deff5cdf1158319f2e30c7c79130c555d8d8c5f8fa719c7760e1edcc1083118fcff04c0e8aedd089dd95641e19240d14d6d10e28d2dd6ae9f4ec75f185 SHA512 fc904e2396e4a0e98baa463d1bdfc421402a5e17609fe7d4ec30f6c3e5692a432f5db36ba7fa9083e9eebf4dba29b48865102fb24429bde072c738c76478d377
DIST tensorflow-patches-1.9.0_rc2.tar.bz2 8038 BLAKE2B b416abcd1aaf3fa221eecd8e5e13bece47e13b42666c754388acf93fef4ca9f1e6a178027053402dfcabc8c9b220867fe63a73d97f56b62ec51def537d2706c4 SHA512 e6d7e8771bb9f27e5c5099b6d33f7f44bc4a2e40df1e3996e1fd7473eb836f33348c31931a28ab5d46771219b90b2eebc57d78471ee77d0ccb49fb437cd96a07
DIST tensorflow-python-license.txt 45132 BLAKE2B 1f572a06eeb4a58a5563b87a2db381a6e9eb0195cf1d006bda0d3da158e62a1e67e889a7d3d0da83d8609c0d048887bcbbd0d7056fd8e4f56b654047f36936fa SHA512 1b8c2f9733fcf27d560879418c366b5c3e44420d42adb3b857ee741793ddc75ad18324b016909457e5311f2143593392ce4404d12962f076e62f6036afbb521e
diff --git a/sci-libs/tensorflow/tensorflow-1.9.0.ebuild b/sci-libs/tensorflow/tensorflow-1.9.0.ebuild
new file mode 100644
index 000000000000..824e9cc079ef
--- /dev/null
+++ b/sci-libs/tensorflow/tensorflow-1.9.0.ebuild
@@ -0,0 +1,425 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python2_7 python3_{5,6} )
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+inherit check-reqs cuda distutils-r1 eapi7-ver multiprocessing toolchain-funcs
+
+DESCRIPTION="Computation framework using data flow graphs for scalable machine learning"
+HOMEPAGE="https://www.tensorflow.org/"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="cuda jemalloc mpi +python system-libs"
+CPU_USE_FLAGS_X86="sse sse2 sse3 sse4_1 sse4_2 avx avx2 fma3 fma4"
+for i in $CPU_USE_FLAGS_X86; do
+ IUSE+=" cpu_flags_x86_$i"
+done
+
+# distfiles that bazel uses for the workspace, will be copied to basel-distdir
+bazel_external_uris="
+ http://www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz -> oourafft-20061228.tgz
+ https://bitbucket.org/eigen/eigen/get/fd6845384b86.tar.gz -> eigen-fd6845384b86.tar.gz
+ https://github.com/abseil/abseil-cpp/archive/9613678332c976568272c8f4a78631a29159271d.tar.gz -> abseil-cpp-9613678332c976568272c8f4a78631a29159271d.tar.gz
+ https://github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz -> bazelbuild-rules_closure-dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz
+ https://github.com/google/double-conversion/archive/3992066a95b823efc8ccc1baf82a1cfc73f6e9b8.zip -> double-conversion-3992066a95b823efc8ccc1baf82a1cfc73f6e9b8.zip
+ https://github.com/google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz -> farmhash-816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz
+ https://github.com/google/gemmlowp/archive/38ebac7b059e84692f53e5938f97a9943c120d98.zip -> gemmlowp-38ebac7b059e84692f53e5938f97a9943c120d98.zip
+ https://github.com/google/highwayhash/archive/fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gz -> highwayhash-fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gz
+ https://github.com/google/nsync/archive/0559ce013feac8db639ee1bf776aca0325d28777.tar.gz -> nsync-0559ce013feac8db639ee1bf776aca0325d28777.tar.gz
+ https://github.com/google/protobuf/archive/396336eb961b75f03b25824fe86cf6490fb75e3a.tar.gz -> protobuf-396336eb961b75f03b25824fe86cf6490fb75e3a.tar.gz
+ https://github.com/open-source-parsers/jsoncpp/archive/11086dd6a7eba04289944367ca82cea71299ed70.tar.gz -> jsoncpp-11086dd6a7eba04289944367ca82cea71299ed70.tar.gz
+ https://github.com/jemalloc/jemalloc/archive/4.4.0.tar.gz -> jemalloc-4.4.0.tar.gz
+ cuda? ( https://github.com/nvidia/nccl/archive/03d856977ecbaac87e598c0c4bafca96761b9ac7.tar.gz -> nvidia-nccl-03d856977ecbaac87e598c0c4bafca96761b9ac7.tar.gz )
+ python? (
+ https://github.com/NVlabs/cub/archive/1.8.0.zip -> cub-1.8.0.zip
+ https://github.com/abseil/abseil-py/archive/ea8c4d2ddbf3fba610c4d613260561699b776db8.tar.gz -> abseil-py-ea8c4d2ddbf3fba610c4d613260561699b776db8.tar.gz
+ https://github.com/aws/aws-sdk-cpp/archive/1.3.15.tar.gz -> aws_sdk_cpp-1.3.15.tar.gz
+ https://github.com/edenhill/librdkafka/archive/v0.11.1.tar.gz -> librdkafka-v0.11.1.tar.gz
+ https://github.com/google/boringssl/archive/a0fb951d2a26a8ee746b52f3ba81ab011a0af778.tar.gz -> boringssl-a0fb951d2a26a8ee746b52f3ba81ab011a0af778.tar.gz
+ https://github.com/googleapis/googleapis/archive/f81082ea1e2f85c43649bee26e0d9871d4b41cdb.zip -> googleapis-f81082ea1e2f85c43649bee26e0d9871d4b41cdb.zip
+ https://github.com/GoogleCloudPlatform/google-cloud-cpp/archive/53f822805e77ea7715f5b52c592a162c515c7219.tar.gz -> google-cloud-cpp-53f822805e77ea7715f5b52c592a162c515c7219.tar.gz
+ https://github.com/hfp/libxsmm/archive/1.8.1.tar.gz -> libxsmm-1.8.1.tar.gz
+ https://github.com/intel/ARM_NEON_2_x86_SSE/archive/0f77d9d182265259b135dad949230ecbf1a2633d.tar.gz -> ARM_NEON_2_x86_SSE-0f77d9d182265259b135dad949230ecbf1a2633d.tar.gz
+ https://github.com/intel/mkl-dnn/archive/v0.12.tar.gz -> mkl_dnn-v0.12.tar.gz
+ https://github.com/llvm-mirror/llvm/archive/fe1e7736763a8577ac081eca525e05d3b52de414.tar.gz -> llvm-fe1e7736763a8577ac081eca525e05d3b52de414.tar.gz
+ https://mirror.bazel.build/docs.python.org/2.7/_sources/license.txt -> tensorflow-python-license.txt
+ https://pypi.python.org/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz
+ https://pypi.python.org/packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/backports.weakref-1.0rc1.tar.gz
+ !system-libs? (
+ http://ftp.exim.org/pub/pcre/pcre-8.42.tar.gz
+ http://ufpr.dl.sourceforge.net/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz
+ https://curl.haxx.se/download/curl-7.60.0.tar.gz
+ https://pypi.python.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
+ https://pypi.python.org/packages/d8/be/c4276b3199ec3feee2a88bc64810fbea8f26d961e0a4cd9c68387a9f35de/astor-0.6.2.tar.gz
+ https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz
+ https://github.com/google/flatbuffers/archive/v1.9.0.tar.gz -> flatbuffers-v1.9.0.tar.gz
+ https://github.com/cython/cython/archive/3732784c45cfb040a5b0936951d196f83a12ea17.tar.gz -> cython-3732784c45cfb040a5b0936951d196f83a12ea17.tar.gz
+ )
+ )
+ !system-libs? (
+ http://pilotfiber.dl.sourceforge.net/project/giflib/giflib-5.1.4.tar.gz
+ http://pkgs.fedoraproject.org/repo/pkgs/nasm/nasm-2.12.02.tar.bz2/d15843c3fb7db39af80571ee27ec6fad/nasm-2.12.02.tar.bz2
+ https://github.com/LMDB/lmdb/archive/LMDB_0.9.22.tar.gz
+ https://github.com/glennrp/libpng/archive/v1.6.34.tar.gz -> libpng-v1.6.34.tar.gz
+ https://github.com/google/re2/archive/2018-04-01.tar.gz -> re2-2018-04-01.tar.gz
+ https://github.com/google/snappy/archive/1.1.7.tar.gz -> snappy-1.1.7.tar.gz
+ https://github.com/grpc/grpc/archive/d184fa229d75d336aedea0041bd59cb93e7e267f.tar.gz -> grpc-d184fa229d75d336aedea0041bd59cb93e7e267f.tar.gz
+ https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.5.3.tar.gz -> libjpeg_turbo-1.5.3.tar.gz
+ https://www.sqlite.org/2018/sqlite-amalgamation-3230100.zip
+ https://zlib.net/zlib-1.2.11.tar.gz
+ )"
+
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz
+ https://dev.gentoo.org/~perfinion/patches/tensorflow-patches-${PVR}.tar.bz2
+ ${bazel_external_uris}"
+
+RDEPEND="
+ cuda? (
+ >=dev-util/nvidia-cuda-toolkit-8.0[profiler]
+ >=dev-libs/cudnn-6.0
+ )
+ mpi? ( virtual/mpi )
+ system-libs? (
+ app-arch/snappy
+ dev-db/lmdb
+ dev-db/sqlite
+ >=dev-libs/flatbuffers-1.8.0
+ >=dev-libs/jsoncpp-1.8.4
+ dev-libs/libpcre
+ >=dev-libs/protobuf-3.6.0
+ >=dev-libs/re2-0.2018.04.01
+ media-libs/giflib
+ media-libs/libjpeg-turbo
+ media-libs/libpng:0
+ >=net-libs/grpc-1.12.1[${PYTHON_USEDEP}]
+ net-misc/curl
+ sys-libs/zlib
+ jemalloc? ( >=dev-libs/jemalloc-4.4.0 )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/absl-py[${PYTHON_USEDEP}]
+ dev-python/astor[${PYTHON_USEDEP}]
+ dev-python/numpy[${PYTHON_USEDEP}]
+ >=dev-python/protobuf-python-3.6.0[${PYTHON_USEDEP}]
+ dev-python/six[${PYTHON_USEDEP}]
+ dev-python/termcolor[${PYTHON_USEDEP}]
+ virtual/python-enum34[${PYTHON_USEDEP}]
+ )
+ )"
+DEPEND="${RDEPEND}
+ !python? ( dev-lang/python )
+ app-arch/unzip
+ >=dev-util/bazel-0.14.0
+ dev-java/java-config
+ dev-python/mock
+ system-libs? (
+ dev-lang/nasm
+ dev-lang/swig
+ dev-python/cython
+ )"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( AUTHORS CONTRIBUTING.md ISSUE_TEMPLATE.md README.md RELEASE.md )
+CHECKREQS_MEMORY="5G"
+CHECKREQS_DISK_BUILD="5G"
+
+bazel-get-cpu-flags() {
+ local i f=()
+ # Keep this list in sync with tensorflow/core/platform/cpu_feature_guard.cc.
+ for i in sse sse2 sse3 sse4_1 sse4_2 avx avx2 fma4; do
+ use cpu_flags_x86_${i} && f+=( -m${i/_/.} )
+ done
+ use cpu_flags_x86_fma3 && f+=( -mfma )
+ echo "${f[*]}"
+}
+
+bazel-get-flags() {
+ local i fs=()
+ for i in ${CFLAGS} $(bazel-get-cpu-flags); do
+ fs+=( "--copt=${i}" "--host_copt=${i}" )
+ done
+ for i in ${CXXFLAGS} $(bazel-get-cpu-flags); do
+ fs+=( "--cxxopt=${i}" "--host_cxxopt=${i}" )
+ done
+ for i in ${CPPFLAGS}; do
+ fs+=( "--copt=${i}" "--host_copt=${i}" )
+ fs+=( "--cxxopt=${i}" "--host_cxxopt=${i}" )
+ done
+ for i in ${LDFLAGS}; do
+ fs+=( "--linkopt=${i}" "--host_linkopt=${i}" )
+ done
+ echo "${fs[*]}"
+}
+
+setup_bazelrc() {
+ if [[ -f "${T}/bazelrc" ]]; then
+ return
+ fi
+
+ # F: fopen_wr
+ # P: /proc/self/setgroups
+ # Even with standalone enabled, the Bazel sandbox binary is run for feature test:
+ # https://github.com/bazelbuild/bazel/blob/7b091c1397a82258e26ab5336df6c8dae1d97384/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java#L61
+ # https://github.com/bazelbuild/bazel/blob/76555482873ffcf1d32fb40106f89231b37f850a/src/main/tools/linux-sandbox-pid1.cc#L113
+ addpredict /proc
+
+ mkdir -p "${T}/bazel-cache" || die
+ mkdir -p "${T}/bazel-distdir" || die
+
+ cat > "${T}/bazelrc" <<-EOF
+ startup --batch
+
+ # dont strip HOME, portage sets a temp per-package dir
+ build --action_env HOME
+
+ # make bazel respect MAKEOPTS
+ build --jobs=$(makeopts_jobs) $(bazel-get-flags)
+ build --compilation_mode=opt --host_compilation_mode=opt
+
+ # Use standalone strategy to deactivate the bazel sandbox, since it
+ # conflicts with FEATURES=sandbox.
+ build --spawn_strategy=standalone --genrule_strategy=standalone
+ test --spawn_strategy=standalone --genrule_strategy=standalone
+
+ build --strip=never
+ build --verbose_failures --noshow_loading_progress
+ test --verbose_test_summary --verbose_failures --noshow_loading_progress
+
+ # make bazel only fetch distfiles from the cache
+ fetch --repository_cache=${T}/bazel-cache/ --experimental_distdir=${T}/bazel-distdir/
+ build --repository_cache=${T}/bazel-cache/ --experimental_distdir=${T}/bazel-distdir/
+ EOF
+}
+
+ebazel() {
+ setup_bazelrc
+
+ # Use different build folders for each multibuild variant.
+ local base_suffix="${MULTIBUILD_VARIANT+-}${MULTIBUILD_VARIANT}"
+ local output_base="${WORKDIR}/bazel-base${base_suffix}"
+ mkdir -p "${output_base}" || die
+
+ einfo Running: bazel --output_base="${output_base}" "$@"
+ bazel --output_base="${output_base}" $@ || die
+}
+
+load_distfiles() {
+ # Populate the bazel distdir to fetch from since it cannot use the network
+ # Bazel looks in distdir but will only look for the original filename, not
+ # the possibly renamed one that portage downloaded. If the line has -> we
+ # need to rename it back, otherwise a simple copy is fine.
+
+ local src dst uri rename
+
+ while read uri rename dst; do
+ src="${uri##*/}"
+ [[ -z $src ]] && continue
+ if [[ "$rename" != "->" ]]; then
+ dst="${src}"
+ fi
+
+ [[ ${A} =~ ${dst} ]] || continue
+
+ if [[ "$dst" == "$src" ]]; then
+ einfo "Copying $dst to bazel distdir $src ..."
+ else
+ einfo "Copying $dst to bazel distdir ..."
+ fi
+ cp "${DISTDIR}/${dst}" "${T}/bazel-distdir/${src}" || die
+ done <<< "$(sed -re 's/!?[A-Za-z]+\?\s+\(\s*//g; s/\s+\)//g' <<< "${bazel_external_uris}")"
+}
+
+pkg_setup() {
+ check-reqs_pkg_setup
+}
+
+src_unpack() {
+ # Only unpack the main distfile
+ unpack "${P}.tar.gz"
+ unpack tensorflow-patches-${PVR}.tar.bz2
+}
+
+src_prepare() {
+ export JAVA_HOME=$(java-config --jre-home) # so keepwork works
+
+ setup_bazelrc
+ load_distfiles
+
+ eapply "${WORKDIR}"/patches/*.patch
+
+ default
+ use python && python_copy_sources
+
+ if use cuda; then
+ for i in /dev/nvidia*; do
+ addpredict $i
+ done
+ fi
+}
+
+src_configure() {
+ export JAVA_HOME=$(java-config --jre-home) # so keepwork works
+
+ do_configure() {
+ export CC_OPT_FLAGS=" "
+ export TF_NEED_JEMALLOC=$(usex jemalloc 1 0)
+ export TF_NEED_GCP=0
+ export TF_NEED_HDFS=0
+ export TF_NEED_S3=0
+ export TF_NEED_AWS=0
+ export TF_NEED_KAFKA=0
+ export TF_ENABLE_XLA=0
+ export TF_NEED_GDR=0
+ export TF_NEED_VERBS=0
+ export TF_NEED_OPENCL_SYCL=0
+ export TF_NEED_OPENCL=0
+ export TF_NEED_COMPUTECPP=0
+ export TF_NEED_MKL=0
+ export TF_NEED_MPI=$(usex mpi 1 0)
+ export TF_SET_ANDROID_WORKSPACE=0
+
+ if use python; then
+ python_export PYTHON_SITEDIR
+ export PYTHON_BIN_PATH="${PYTHON}"
+ export PYTHON_LIB_PATH="${PYTHON_SITEDIR}"
+ else
+ export PYTHON_BIN_PATH="$(which python)"
+ export PYTHON_LIB_PATH="$(python -c 'from distutils.sysconfig import *; print(get_python_lib())')"
+ fi
+
+ export TF_NEED_CUDA=$(usex cuda 1 0)
+ export TF_DOWNLOAD_CLANG=0
+ export TF_CUDA_CLANG=0
+ export TF_NEED_TENSORRT=0
+ if use cuda; then
+ export CUDA_TOOLKIT_PATH="${EROOT%/}/opt/cuda"
+ export CUDNN_INSTALL_PATH="${EROOT%/}/opt/cuda"
+ export GCC_HOST_COMPILER_PATH="$(cuda_gccdir)/$(tc-getCC)"
+ export TF_NCCL_VERSION="1"
+
+ TF_CUDA_VERSION="$(best_version dev-util/nvidia-cuda-toolkit)"
+ TF_CUDA_VERSION="${TF_CUDA_VERSION##*cuda-toolkit-}"
+ export TF_CUDA_VERSION="$(ver_cut 1-2 ${TF_CUDA_VERSION})"
+ einfo "Setting CUDA version: $TF_CUDA_VERSION"
+
+ TF_CUDNN_VERSION="$(best_version dev-libs/cudnn)"
+ TF_CUDNN_VERSION="${TF_CUDNN_VERSION##*cudnn-}"
+ export TF_CUDNN_VERSION="$(ver_cut 1-2 ${TF_CUDNN_VERSION})"
+ einfo "Setting CUDNN version: $TF_CUDNN_VERSION"
+ fi
+
+ # Only one bazelrc is read, import our one before configure sets its options
+ echo "import ${T}/bazelrc" >> ./.bazelrc
+
+ # This is not autoconf
+ ./configure || die
+
+ sed -i '/strip=always/d' .tf_configure.bazelrc || die
+
+ if use system-libs; then
+ echo 'build --action_env TF_SYSTEM_LIBS="astor_archive,com_googlesource_code_re2,curl,cython,flatbuffers,gif_archive,grpc,jemalloc,jpeg,lmdb,nasm,org_sqlite,pcre,png_archive,six_archive,snappy,swig,termcolor_archive,zlib_archive"' >> .tf_configure.bazelrc || die
+ fi
+ }
+ if use python; then
+ python_foreach_impl run_in_build_dir do_configure
+ else
+ do_configure
+ fi
+}
+
+src_compile() {
+ export JAVA_HOME=$(java-config --jre-home) # so keepwork works
+
+ if use python; then
+ python_setup
+ local MULTIBUILD_VARIANT="${EPYTHON/./_}"
+ cd "${S}-${MULTIBUILD_VARIANT}" || die
+ fi
+
+ ebazel build \
+ //tensorflow:libtensorflow_framework.so \
+ //tensorflow:libtensorflow.so
+ ebazel build //tensorflow:libtensorflow_cc.so
+
+ do_compile() {
+ ebazel build //tensorflow/tools/pip_package:build_pip_package
+ }
+ use python && python_foreach_impl run_in_build_dir do_compile
+}
+
+src_install() {
+ local i j
+ export JAVA_HOME=$(java-config --jre-home) # so keepwork works
+
+ do_install() {
+ einfo "Installing ${EPYTHON} files"
+ local srcdir="${T}/src-${MULTIBUILD_VARIANT}"
+ mkdir -p "${srcdir}" || die
+ bazel-bin/tensorflow/tools/pip_package/build_pip_package --src "${srcdir}" || die
+ cd "${srcdir}" || die
+ esetup.py install
+
+ # Symlink to the main .so file
+ python_export PYTHON_SITEDIR
+ rm -rf "${D}/${PYTHON_SITEDIR}/${PN}/lib${PN}_framework.so" || die
+ dosym "../../../lib${PN}_framework.so" "${PYTHON_SITEDIR}/${PN}/lib${PN}_framework.so" || die
+
+ python_optimize
+ }
+
+ if use python; then
+ python_foreach_impl run_in_build_dir do_install
+
+ rm -f "${D}"/usr/lib/python-exec/*/tensorboard || die "failed to remove tensorboard"
+
+ # Symlink to python-exec scripts
+ for i in "${D}"/usr/lib/python-exec/*/*; do
+ n="${i##*/}"
+ [[ -e "${D}/usr/bin/${n}" ]] || dosym ../lib/python-exec/python-exec2 "/usr/bin/$n"
+ done
+
+ python_setup
+ local MULTIBUILD_VARIANT="${EPYTHON/./_}"
+ cd "${S}-${MULTIBUILD_VARIANT}" || die
+ fi
+
+ einfo "Installing headers"
+ # Install c c++ and core header files
+ for i in $(find ${PN}/{c,cc,core} -name "*.h"); do
+ insinto /usr/include/${PN}/${i%/*}
+ doins ${i}
+ done
+
+ einfo "Installing generated headers"
+ for i in $(find bazel-genfiles/${PN}/{cc,core} -name "*.h"); do
+ j=${i#bazel-genfiles/}
+ insinto /usr/include/${PN}/${j%/*}
+ doins ${i}
+ done
+
+ einfo "Installing Eigen headers"
+ ebazel build //third_party/eigen3:install_eigen_headers
+ insinto /usr/include/${PN}/
+ doins -r bazel-genfiles/third_party/eigen3/include/*
+
+ einfo "Installing libs"
+ # Generate pkg-config file
+ ${PN}/c/generate-pc.sh --prefix=/usr --libdir=$(get_libdir) --version=${MY_PV} || die
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ${PN}.pc
+
+ dolib.so bazel-bin/tensorflow/lib${PN}_framework.so
+ dolib.so bazel-bin/tensorflow/lib${PN}.so
+ dolib.so bazel-bin/tensorflow/lib${PN}_cc.so
+
+ einstalldocs
+}