From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EAA8C1382C5 for ; Fri, 4 May 2018 03:13:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 110C9E098F; Fri, 4 May 2018 03:13:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CA3EFE098F for ; Fri, 4 May 2018 03:13:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EC168335C73 for ; Fri, 4 May 2018 03:12:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E3F8D32 for ; Fri, 4 May 2018 03:12:56 +0000 (UTC) From: "Jason Zaman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jason Zaman" Message-ID: <1525403554.c87e038a646e968a95d07b5df51ab02409921951.perfinion@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/tensorflow/ X-VCS-Repository: repo/gentoo X-VCS-Files: sci-libs/tensorflow/tensorflow-1.8.0.ebuild X-VCS-Directories: sci-libs/tensorflow/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: c87e038a646e968a95d07b5df51ab02409921951 X-VCS-Branch: master Date: Fri, 4 May 2018 03:12:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8c37b407-f2aa-45c9-b1bb-a21845882a30 X-Archives-Hash: 91613423f5a94ecc9b53f333a9a80587 commit: c87e038a646e968a95d07b5df51ab02409921951 Author: Jason Zaman gentoo org> AuthorDate: Fri May 4 03:08:43 2018 +0000 Commit: Jason Zaman gentoo org> CommitDate: Fri May 4 03:12:34 2018 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c87e038a sci-libs/tensorflow: Add more *FLAGS handling from sci overlay Package-Manager: Portage-2.3.24, Repoman-2.3.6 sci-libs/tensorflow/tensorflow-1.8.0.ebuild | 38 +++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/sci-libs/tensorflow/tensorflow-1.8.0.ebuild b/sci-libs/tensorflow/tensorflow-1.8.0.ebuild index 9ab15ae9453..c12a3e04ae0 100644 --- a/sci-libs/tensorflow/tensorflow-1.8.0.ebuild +++ b/sci-libs/tensorflow/tensorflow-1.8.0.ebuild @@ -103,6 +103,31 @@ PATCHES=( "${FILESDIR}/0001-pip_package-modularize-build-script-to-allow-distros.patch" ) +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 ${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 @@ -118,7 +143,8 @@ setup_bazelrc() { echo "startup --batch" > "${T}/bazelrc" || die # make bazel respect $MAKEOPTS - echo "build --jobs=$(makeopts_jobs)" >> "${T}/bazelrc" || die + echo "build --jobs=$(makeopts_jobs) $(bazel-get-flags)" >> "${T}/bazelrc" || die + echo "build --compilation_mode=opt --host_compilation_mode=opt" >> "${T}/bazelrc" || die # Use standalone strategy to deactivate the bazel sandbox, since it # conflicts with FEATURES=sandbox. @@ -187,16 +213,8 @@ src_prepare() { src_configure() { do_configure() { - local cc_opt_flags=( ${CFLAGS} ) - - # 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} && cc_opt_flags+=( -m${i/_/.} ) - done - use cpu_flags_x86_fma3 && cc_opt_flags+=( -mfma ) - python_export PYTHON_SITEDIR - export CC_OPT_FLAGS="${cc_opt_flags[*]}" + export CC_OPT_FLAGS="${CFLAGS} $(bazel-get-cpu-flags)" export GCC_HOST_COMPILER_PATH=$(tc-getCC) export TF_NEED_JEMALLOC=$(usex jemalloc 1 0) export TF_NEED_GCP=0