summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaman <perfinion@gentoo.org>2018-05-19 18:21:51 +0800
committerJason Zaman <perfinion@gentoo.org>2018-05-20 21:45:52 +0800
commit7379cdb578b0c070c846c3fa9f71470e2c5d1320 (patch)
treec08af7598174cf7efa8ab1eeb33d2764b555f244 /sci-libs
parentnet-libs/libtorrent: clarify openssl <1.1 requirement (diff)
downloadgentoo-7379cdb578b0c070c846c3fa9f71470e2c5d1320.tar.gz
gentoo-7379cdb578b0c070c846c3fa9f71470e2c5d1320.tar.bz2
gentoo-7379cdb578b0c070c846c3fa9f71470e2c5d1320.zip
sci-libs/tensorflow: bazel build fixes
Properly include bazelrc, only one is read so include our generated one instead. dont sanitize $HOME otherwise .keras ends up in /var/tmp/portage/ (bug 655368) patch BUILD file so it doesnt strip the outputs Closes: https://bugs.gentoo.org/655368 Package-Manager: Portage-2.3.24, Repoman-2.3.6
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/tensorflow/files/tensorflow-1.8.0-0002-dont-strip.patch29
-rw-r--r--sci-libs/tensorflow/tensorflow-1.8.0-r1.ebuild (renamed from sci-libs/tensorflow/tensorflow-1.8.0.ebuild)42
2 files changed, 56 insertions, 15 deletions
diff --git a/sci-libs/tensorflow/files/tensorflow-1.8.0-0002-dont-strip.patch b/sci-libs/tensorflow/files/tensorflow-1.8.0-0002-dont-strip.patch
new file mode 100644
index 000000000000..9f828f3c8efc
--- /dev/null
+++ b/sci-libs/tensorflow/files/tensorflow-1.8.0-0002-dont-strip.patch
@@ -0,0 +1,29 @@
+diff --git a/tensorflow/BUILD b/tensorflow/BUILD
+index cfafffdd13..8ed22ccfea 100644
+--- a/tensorflow/BUILD
++++ b/tensorflow/BUILD
+@@ -470,7 +470,7 @@ tf_cc_shared_object(
+ # excludes all but a subset of function names.
+ # On MacOS, the linker does not support version_script, but has an
+ # an "-exported_symbols_list" command. -z defs disallows undefined
+-# symbols in object files and -s strips the output.
++# symbols in object files.
+
+ tf_cc_shared_object(
+ name = "libtensorflow.so",
+@@ -484,7 +484,6 @@ tf_cc_shared_object(
+ "//tensorflow:windows_msvc": [],
+ "//conditions:default": [
+ "-z defs",
+- "-s",
+ "-Wl,--version-script", # This line must be directly followed by the version_script.lds file
+ "$(location //tensorflow/c:version_script.lds)",
+ ],
+@@ -510,7 +509,6 @@ tf_cc_shared_object(
+ "//tensorflow:windows_msvc": [],
+ "//conditions:default": [
+ "-z defs",
+- "-s",
+ "-Wl,--version-script", # This line must be directly followed by the version_script.lds file
+ "$(location //tensorflow:tf_version_script.lds)",
+ ],
diff --git a/sci-libs/tensorflow/tensorflow-1.8.0.ebuild b/sci-libs/tensorflow/tensorflow-1.8.0-r1.ebuild
index c12a3e04ae05..98643e5d2ceb 100644
--- a/sci-libs/tensorflow/tensorflow-1.8.0.ebuild
+++ b/sci-libs/tensorflow/tensorflow-1.8.0-r1.ebuild
@@ -3,7 +3,7 @@
EAPI=6
-PYTHON_COMPAT=( python3_{5,6} )
+PYTHON_COMPAT=( python2_7 python3_{5,6} )
MY_PV=${PV/_rc/-rc}
MY_P=${PN}-${MY_PV}
@@ -101,6 +101,7 @@ S="${WORKDIR}/${MY_P}"
DOCS=( AUTHORS CONTRIBUTING.md ISSUE_TEMPLATE.md README.md RELEASE.md )
PATCHES=(
"${FILESDIR}/0001-pip_package-modularize-build-script-to-allow-distros.patch"
+ "${FILESDIR}/tensorflow-1.8.0-0002-dont-strip.patch"
)
bazel-get-cpu-flags() {
@@ -140,24 +141,32 @@ setup_bazelrc() {
# https://github.com/bazelbuild/bazel/blob/76555482873ffcf1d32fb40106f89231b37f850a/src/main/tools/linux-sandbox-pid1.cc#L113
addpredict /proc
- echo "startup --batch" > "${T}/bazelrc" || die
+ 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
- echo "build --jobs=$(makeopts_jobs) $(bazel-get-flags)" >> "${T}/bazelrc" || die
- echo "build --compilation_mode=opt --host_compilation_mode=opt" >> "${T}/bazelrc" || die
+ # 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.
- echo "build --verbose_failures --spawn_strategy=standalone --genrule_strategy=standalone" >> "${T}/bazelrc" || die
- echo "build --noshow_loading_progress" >> "${T}/bazelrc" || die
- echo "test --verbose_failures --spawn_strategy=standalone --genrule_strategy=standalone" >> "${T}/bazelrc" || die
- echo "test --verbose_test_summary --noshow_loading_progress" >> "${T}/bazelrc" || die
+ 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
- mkdir -p "${T}/bazel-cache" || die
- mkdir -p "${T}/bazel-distdir" || die
- echo "fetch --repository_cache=${T}/bazel-cache/ --experimental_distdir=${T}/bazel-distdir/" >> "${T}/bazelrc" || die
- echo "build --repository_cache=${T}/bazel-cache/ --experimental_distdir=${T}/bazel-distdir/" >> "${T}/bazelrc" || die
+ fetch --repository_cache=${T}/bazel-cache/ --experimental_distdir=${T}/bazel-distdir/
+ build --repository_cache=${T}/bazel-cache/ --experimental_distdir=${T}/bazel-distdir/
+ EOF
}
bazel_multibuild_wrapper() {
@@ -170,8 +179,8 @@ bazel_multibuild_wrapper() {
ebazel() {
setup_bazelrc
- echo Running: bazel --bazelrc="${T}/bazelrc" --output_base="${BAZEL_OUTPUT_BASE}" "$@"
- bazel --bazelrc="${T}/bazelrc" --output_base="${BAZEL_OUTPUT_BASE}" $@ || die
+ echo Running: bazel --output_base="${BAZEL_OUTPUT_BASE}" "$@"
+ bazel --output_base="${BAZEL_OUTPUT_BASE}" $@ || die
}
load_distfiles() {
@@ -235,6 +244,9 @@ src_configure() {
export PYTHON_BIN_PATH="${PYTHON}"
export PYTHON_LIB_PATH="${PYTHON_SITEDIR}"
+ # only one bazelrc is read, import our one before configure sets its options
+ echo "import ${T}/bazelrc" >> ./.bazelrc
+
# this is not autoconf
./configure || die
}