<pre style='margin:0'>
Chris Jones (cjones051073) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/1c3d80687f3ff6f5ea66c203f9aa8744adca7b30">https://github.com/macports/macports-ports/commit/1c3d80687f3ff6f5ea66c203f9aa8744adca7b30</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 1c3d80687f3 py-tensorflow{1}: Migrate builds to use new bazel PG
</span>1c3d80687f3 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 1c3d80687f3ff6f5ea66c203f9aa8744adca7b30
</span>Author: Chris Jones <jonesc@macports.org>
AuthorDate: Mon Mar 22 18:58:37 2021 +0000
<span style='display:block; white-space:pre;color:#404040;'> py-tensorflow{1}: Migrate builds to use new bazel PG
</span>---
_resources/port1.0/group/bazel-1.0.tcl | 182 +++++++++++++++++++++++++++++++++
python/py-tensorflow/Portfile | 153 ++-------------------------
python/py-tensorflow1/Portfile | 142 ++-----------------------
3 files changed, 196 insertions(+), 281 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/_resources/port1.0/group/bazel-1.0.tcl b/_resources/port1.0/group/bazel-1.0.tcl
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..02913a8687a
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/_resources/port1.0/group/bazel-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,182 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Usage:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# PortGroup bazel 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup java 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+namespace eval bazel { }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+options bazel.min_xcode
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+default bazel.min_xcode 10.2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+options bazel.build_target
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+default bazel.build_target ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+options bazel.post_build_cmd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+default bazel.post_build_cmd ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+options bazel.version
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+default bazel.version "latest"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc bazel::use_mp_clang {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global configure.compiler xcodeversion
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [ expr ( [ string match macports-clang-* ${configure.compiler} ] || [ vercmp ${xcodeversion} [option bazel.min_xcode] ] < 0 ) ]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Required java version
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+java.version 11+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# LTS JDK port to install if required java not found
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+java.fallback openjdk11
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# JDK only needed at build time, but java PG sets lib dependency so
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# declare no conflict to allow redistribution of binaries.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+license_noconflict ${java.fallback}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# append to envs
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+configure.env-append JAVA_HOME=${java.home}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+build.env-append JAVA_HOME=${java.home}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+build.env-append TMPDIR=${workpath}/tmp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc set_bazel_dep { } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [option bazel.version] eq "latest" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_build-append port:bazel
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_build-append port:bazel-[option bazel.version]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+port::register_callback set_bazel_dep
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant mkl description {Enable Intel Math Kernel Library support} { }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Enable MKL by default on 10.12 and newer.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if {${os.major} >= 16} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# default_variants-append +mkl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant native description {Build from source for best native platform support} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Prevent precompiled binaries to let compilation optimise the library for the user processor
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ archive_sites
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc get_base_arch {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global configure.build_arch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Currently only supports intel
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { ${configure.build_arch} eq "x86_64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return "-march=x86-64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+supported_archs x86_64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set base_march [get_base_arch]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append CC_OPT_FLAGS=${base_march}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ build.env-append CC_OPT_FLAGS=${base_march}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notes "This version is built based on a base architecture for convenience,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ which may not be optimized for your system. To build a version
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ customized for your machine, use the +native variant"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc bazel_set_env {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [bazel::use_mp_clang] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ build.env-append BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+port::register_callback bazel_set_env
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Configure phase
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Remove all arguments
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+configure.args
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+configure.pre_args
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# configure command
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+configure.cmd ./configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Patch configuration
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+pre-configure {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # enforce correct build settings
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # note final / is because ${worksrcpath} is a sym-link
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach f [ exec find ${worksrcpath}/ -name "configure" -or -name "configure.py" -or -name "compile.sh" -or -name "*.tpl" -or -name "*.bzl" -or -name "CROSSTOOL" -or -name "configure.py" -or -name "MOCK_CROSSTOOL" ] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach cmd {ar nm strip libtool ld objdump} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|/usr/bin/${cmd}|${prefix}/bin/${cmd}|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|/usr/bin/clang|\"${configure.cc}\"|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|\"clang\"|\"${configure.cc}\"|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s| clang | ${configure.cc} |g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|/usr/local/include|${prefix}/include|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|std=c++0x|std=c++11|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|std=c++1y|std=c++14|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|std=c++1z|std=c++17|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # If not native build, make sure not used...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set base_march [get_base_arch]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach f [ exec find ${worksrcpath}/ -name "configure" -or -name "configure.py" -or -name "CMakeLists.txt" -or -name "Makefile" -or -name "*.sh" ] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -q "s|-march=native|${base_march}|g" ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Limit the number of parallel jobs to the number of physical, not logical, cpus.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# First current setting to ensure we would be reducing the current setting.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set physicalcpus [sysctl hw.physicalcpu]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if { ${build.jobs} > ${physicalcpus} } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ build.jobs ${physicalcpus}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+build {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # bazel cannot build if gcc is 'port selected'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # https://trac.macports.org/ticket/58569
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # https://trac.macports.org/ticket/58679
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Until it can be figured out how to stop bazel finding and using macports gcc
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # just detect when this situation arises and error out...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [file exists ${prefix}/bin/gcc] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "${subport} cannot be built with 'port select gcc' active."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "Please run 'sudo port select gcc none' and try again."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "Once the build is complete, you can safely re-select your preferred gcc."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error "build error"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Build using the wonderful bazel build system ...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_cmd "bazel --max_idle_secs=60 --output_user_root=${workpath}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "-s -c opt --verbose_failures --config=opt"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Limit bazel resource utilisation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "${bazel_build_opts} --jobs ${build.jobs} --local_ram_resources=HOST_RAM*0.5 --local_cpu_resources=HOST_CPUS*.5"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Explicitly pass SDK https://github.com/bazelbuild/rules_go/issues/1554
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Check versioned SDK actually exists... https://trac.macports.org/ticket/60317
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Disable but keep the code below commented for reference, for now, as need to see how it plays out
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # See https://trac.macports.org/ticket/62474
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if {[string first ${configure.sdk_version} ${configure.sdkroot}] != -1} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # set bazel_build_opts "${bazel_build_opts} --macos_sdk_version=${configure.sdk_version}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #} else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # ui_warn "configure.sdkroot='${configure.sdkroot}' does not match configure.sdk_version='${configure.sdk_version}'"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # hack to try and transfer MP c, c++ and ld options to bazel...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach opt [list {*}${configure.cflags} ] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "${bazel_build_opts} --conlyopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach opt [list {*}${configure.cxxflags} ] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "${bazel_build_opts} --cxxopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach opt [list {*}${configure.ldflags} ] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "${bazel_build_opts} --linkopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [bazel::use_mp_clang] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "${bazel_build_opts} --action_env CC=${configure.cc}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_cmd "BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 ${bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[variant_isset mkl]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "${bazel_build_opts} --config=mkl"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set base_march [get_base_arch]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_build_opts "${bazel_build_opts} --copt=${base_march}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set bazel_cmd "CC_OPT_FLAGS=${base_march} ${bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "Bazel build command : ${bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "Bazel build options : ${bazel_build_opts}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "Bazel build target : [option bazel.build_target]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Run the build
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system -W ${worksrcpath} "${bazel_cmd} build ${bazel_build_opts} [option bazel.build_target]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Post build command
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system -W ${worksrcpath} "[option bazel.post_build_cmd]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Clean up
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system -W ${worksrcpath} "${bazel_cmd} clean"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/python/py-tensorflow/Portfile b/python/py-tensorflow/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index e498d603935..8498165a473 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/python/py-tensorflow/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/python/py-tensorflow/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2,7 +2,6 @@
</span>
PortSystem 1.0
PortGroup python 1.0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-PortGroup java 1.0
</span> PortGroup github 1.0
PortGroup compilers 1.0
PortGroup compiler_blacklist_versions 1.0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -39,19 +38,7 @@ if { ${os.major} < ${min_darwin} } {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# Required java version
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-java.version 11+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# LTS JDK port to install if required java not found
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-java.fallback openjdk11
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# JDK only needed at build time, but java PG sets lib dependency so
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# declare no conflict to allow redistribution of binaries.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-license_noconflict ${java.fallback}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> compiler.cxx_standard 2014
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# The oldest Xcode version to use default Xcode compiler
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# https://github.com/tensorflow/tensorflow/issues/39262
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set tf_min_xcode 10.2
</span> compiler.blacklist-append {clang < 1001}
# https://trac.macports.org/ticket/59192
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -59,31 +46,14 @@ xcode_workaround.type avoid_xcode_compiler
</span> xcode_workaround.os_versions 18 19
xcode_workaround.fixed_xcode_version 11.4
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# Work out if we should be using macports clang
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set use_mp_clang [ expr ( [ string match macports-clang-* ${configure.compiler} ] || [ vercmp ${xcodeversion} ${tf_min_xcode} ] < 0 ) ]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-variant mkl description {Enable Intel Math Kernel Library support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Not obvious if this dep is needed ?
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #depends_lib-append port:libomp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Enable MKL by default on 10.12 and newer.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Currently not working due to
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# external/mkl_dnn_v1/src/common/dnnl_thread.hpp:42:10: fatal error: 'omp.h' file not found
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#if {${os.major} >= 16} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# default_variants-append +mkl
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-variant native description {Build from source for best native platform support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Prevent precompiled binaries to let compilation optimise the library for the user processor
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- archive_sites
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # Support python versions
<span style='display:block; white-space:pre;background:#ffe0e0;'>-python.versions 37 38 39
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-python.default_version 38
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+python.versions 37 38 39
</span>
if {${name} ne ${subport}} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ PortGroup bazel 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bazel.version "3.7"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # TF versions 1 and 2 cannot be installed at once
conflicts py${python.version}-tensorflow1
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -91,7 +61,6 @@ if {${name} ne ${subport}} {
</span> port:py${python.version}-future \
port:py${python.version}-pip \
port:py${python.version}-mock \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- port:bazel-3.7 \
</span> port:cctools
depends_lib-append \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -116,119 +85,9 @@ if {${name} ne ${subport}} {
</span> # Options passed to configure script via env vars
configure.env-append PYTHON_LIB_PATH=${python.prefix}/lib/python${python.branch}/site-packages
configure.env-append PYTHON_BIN_PATH=${prefix}/bin/python${python.branch}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.env-append JAVA_HOME=${java.home}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append TMPDIR=${workpath}/tmp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append JAVA_HOME=${java.home}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set base_march "-march=x86-64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.env-append CC_OPT_FLAGS=${base_march}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append CC_OPT_FLAGS=${base_march}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- notes "This version is built based on a base architecture for convenience,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- which may not be optimized for your system. To build a version
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- customized for your machine, use the +native variant"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Disable Xcode detection on older OSes, as we want the
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # MP provided commandline utilities to be used instead.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { ${use_mp_clang} } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.env-append BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Remove all arguments
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.pre_args
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # configure command
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cmd ./configure
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Patch configuration
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- pre-configure {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # enforce correct build settings
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # note final / is because ${worksrcpath} is a sym-link
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach f [ exec find ${worksrcpath}/ -name "configure" -or -name "configure.py" -or -name "compile.sh" -or -name "*.tpl" -or -name "*.bzl" -or -name "CROSSTOOL" -or -name "configure.py" -or -name "MOCK_CROSSTOOL" ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach cmd {ar nm strip libtool ld objdump} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|/usr/bin/${cmd}|${prefix}/bin/${cmd}|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|/usr/bin/clang|\"${configure.cc}\"|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|\"clang\"|\"${configure.cc}\"|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s| clang | ${configure.cc} |g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|/usr/local/include|${prefix}/include|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|std=c++0x|std=c++11|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|std=c++1y|std=c++14|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|std=c++1z|std=c++17|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # If not native build, make sure not used...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach f [ exec find ${worksrcpath}/ -name "configure" -or -name "configure.py" -or -name "CMakeLists.txt" -or -name "Makefile" -or -name "*.sh" ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|-march=native|${base_march}|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- build {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Limit the number of parallel jobs to the number of physical, not logical, cpus.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # First current setting to ensure we would be reducing the current setting.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set physicalcpus [sysctl hw.physicalcpu]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { ${build.jobs} > ${physicalcpus} } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.jobs ${physicalcpus}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # tensorflow(via bazel) cannot be built if gcc is 'port selected'
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # https://trac.macports.org/ticket/58569
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # https://trac.macports.org/ticket/58679
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Until it can be figured out how to stop bazel finding and using macports gcc
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # just detect when this situation arises and error out...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { [file exists ${prefix}/bin/gcc] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "${subport} cannot be built with 'port select gcc' active."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "Please run 'sudo port select gcc none' and try again."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "Once the build is complete, you can safely re-select your preferred gcc."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return -code error "build error"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Build using the wonderful bazel build system ...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_cmd "bazel --max_idle_secs=60 --output_user_root=${workpath}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "-s -c opt --verbose_failures --config=opt"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Limit bazel resource utilisation
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --jobs ${build.jobs} --local_ram_resources=HOST_RAM*0.5 --local_cpu_resources=HOST_CPUS*.5"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Explicitly pass SDK https://github.com/bazelbuild/rules_go/issues/1554
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Check versioned SDK actually exists... https://trac.macports.org/ticket/60317
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Disable but keep the code below commented for reference, for now, as need to see how it plays out
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # See https://trac.macports.org/ticket/62474
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if {[string first ${configure.sdk_version} ${configure.sdkroot}] != -1} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # set tf_bazel_build_opts "${tf_bazel_build_opts} --macos_sdk_version=${configure.sdk_version}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #} else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # ui_warn "configure.sdkroot='${configure.sdkroot}' does not match configure.sdk_version='${configure.sdk_version}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # hack to try and transfer MP c, c++ and ld options to bazel...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach opt [list {*}${configure.cflags} ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --conlyopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach opt [list {*}${configure.cxxflags} ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --cxxopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach opt [list {*}${configure.ldflags} ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --linkopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { ${use_mp_clang} } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --action_env CC=${configure.cc}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_cmd "BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 ${tf_bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[variant_isset mkl]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Hardcode disable MKL until build issue is addressed
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #set tf_bazel_build_opts "${tf_bazel_build_opts} --config=mkl"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Is this required ?
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #set tf_bazel_build_opts "${tf_bazel_build_opts} --cxxopt '-I${prefix}/include/libomp' --linkopt '-L${prefix}/lib/libomp'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --copt=${base_march}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_cmd "CC_OPT_FLAGS=${base_march} ${tf_bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "Bazel build command : ${tf_bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "Bazel build options : ${tf_bazel_build_opts}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Run the build
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system -W ${worksrcpath} "${tf_bazel_cmd} build ${tf_bazel_build_opts} //tensorflow/tools/pip_package:build_pip_package"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Build the python wheel
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system -W ${worksrcpath} "./bazel-bin/tensorflow/tools/pip_package/build_pip_package ${workpath}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Clean up
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system -W ${worksrcpath} "${tf_bazel_cmd} clean"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bazel.build_target "//tensorflow/tools/pip_package:build_pip_package"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bazel.post_build_cmd "./bazel-bin/tensorflow/tools/pip_package/build_pip_package ${workpath}"
</span>
destroot.cmd pip-${python.branch}
destroot.args \
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/python/py-tensorflow1/Portfile b/python/py-tensorflow1/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 6932c19c7cd..bb0e8e3978b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/python/py-tensorflow1/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/python/py-tensorflow1/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2,7 +2,6 @@
</span>
PortSystem 1.0
PortGroup python 1.0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-PortGroup java 1.0
</span> PortGroup github 1.0
PortGroup compilers 1.0
PortGroup compiler_blacklist_versions 1.0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -44,18 +43,6 @@ compiler.cxx_standard 2014
</span>
patch.pre_args -p1
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# Required java version
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-java.version 11+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# LTS JDK port to install if required java not found
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-java.fallback openjdk11
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# JDK only needed at build time, but java PG sets lib dependency so
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# declare no conflict to allow redistribution of binaries.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-license_noconflict ${java.fallback}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# The oldest Xcode version to use default Xcode compiler
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Note setting here should be in sync with that in bazel
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set tf_min_xcode 9.0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> patchfiles-append Fix-build-failures-for-python-3.8.patch
if {${os.major} < 16} {
# Work around for issues with clock_gettime(CLOCK_REALTIME, &ts);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -68,23 +55,15 @@ if {${os.major} < 16} {
</span> # https://github.com/tensorflow/tensorflow/issues/40688
patchfiles-append patch-numpy-1.19-fix.diff
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant mkl description {Enable Intel Math Kernel Library support} { }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Enable MKL by default on 10.12 and newer.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-if {${os.major} >= 16} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- default_variants-append +mkl
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-variant native description {Build from source for best native platform support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Prevent precompiled binaries to let compilation optimise the library for the user processor
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- archive_sites
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # Support python versions
<span style='display:block; white-space:pre;background:#ffe0e0;'>-python.versions 36 37 38 39
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-python.default_version 38
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+python.versions 36 37 38 39
</span>
if {${name} ne ${subport}} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ PortGroup bazel 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bazel.version "0.25"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bazel.min_xcode 9.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # TF versions 1 and 2 cannot be installed at once
conflicts py${python.version}-tensorflow
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -92,7 +71,6 @@ if {${name} ne ${subport}} {
</span> port:py${python.version}-future \
port:py${python.version}-pip \
port:py${python.version}-mock \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- port:bazel-0.25 \
</span> port:cctools
depends_lib-append \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -115,114 +93,10 @@ if {${name} ne ${subport}} {
</span> # Options passed to configure script via env vars
configure.env-append PYTHON_LIB_PATH=${python.prefix}/lib/python${python.branch}/site-packages
configure.env-append PYTHON_BIN_PATH=${prefix}/bin/python${python.branch}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.env-append JAVA_HOME=${java.home}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append TMPDIR=${workpath}/tmp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append JAVA_HOME=${java.home}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set base_march "-march=x86-64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.env-append CC_OPT_FLAGS=${base_march}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append CC_OPT_FLAGS=${base_march}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- notes "This version is built based on a base architecture for convenience,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- which may not be optimized for your system. To build a version
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- customized for your machine, use the +native variant"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Disable Xcode detection on older OSes, as we want the
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # MP provided commandline utilities to be used instead.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[vercmp ${xcodeversion} ${tf_min_xcode}] < 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.env-append BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Remove all arguments
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.pre_args
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # configure command
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cmd ./configure
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Patch configuration
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- pre-configure {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # enforce correct build settings
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach f [ exec find ${worksrcpath}/ -name "configure" -or -name "configure.py" -or -name "compile.sh" -or -name "*.tpl" -or -name "*.bzl" -or -name "CROSSTOOL" -or -name "configure.py" -or -name "MOCK_CROSSTOOL" ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach cmd {ar nm strip libtool ld objdump} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|/usr/bin/${cmd}|${prefix}/bin/${cmd}|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|/usr/bin/clang|\"${configure.cc}\"|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|\"clang\"|\"${configure.cc}\"|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s| clang | ${configure.cc} |g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|/usr/local/include|${prefix}/include|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|std=c++0x|std=c++11|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|std=c++1y|std=c++14|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|std=c++1z|std=c++17|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # If not native build, make sure not used...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach f [ exec find ${worksrcpath}/ -name "configure" -or -name "configure.py" -or -name "CMakeLists.txt" -or -name "Makefile" -or -name "*.sh" ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace -q "s|-march=native|${base_march}|g" ${f}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Limit the number of parallel jobs to the number of physical, not logical, cpus.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # First current setting to ensure we would be reducing the current setting.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set physicalcpus [sysctl hw.physicalcpu]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { ${build.jobs} > ${physicalcpus} } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.jobs ${physicalcpus}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # tensorflow(via bazel) cannot be built if gcc is 'port selected'
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # https://trac.macports.org/ticket/58569
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # https://trac.macports.org/ticket/58679
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Until it can be figured out how to stop bazel finding and using macports gcc
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # just detect when this situation arises and error out...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { [file exists ${prefix}/bin/gcc] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "${subport} cannot be built with 'port select gcc' active."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "Please run 'sudo port select gcc none' and try again."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "Once the build is complete, you can safely re-select your preferred gcc."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return -code error "build error"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Build using the wonderful bazel build system ...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_cmd "bazel --max_idle_secs=60 --output_user_root=${workpath}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "-s -c opt --config=opt"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Limit bazel resource utilisation
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --jobs ${build.jobs} --local_ram_resources=HOST_RAM*0.5 --local_cpu_resources=HOST_CPUS*.5"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Explicitly pass SDK https://github.com/bazelbuild/rules_go/issues/1554
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Check versioned SDK actually exists... https://trac.macports.org/ticket/60317
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[string first ${configure.sdk_version} ${configure.sdkroot}] != -1} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --macos_sdk_version=${configure.sdk_version}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "configure.sdkroot='${configure.sdkroot}' does not match configure.sdk_version='${configure.sdk_version}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # hack to try and transfer MP c, c++ and ld options to bazel...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach opt [list {*}${configure.cflags} ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --conlyopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach opt [list {*}${configure.cxxflags} ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --cxxopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach opt [list {*}${configure.ldflags} ] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --linkopt '${opt}'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[vercmp ${xcodeversion} ${tf_min_xcode}] < 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --action_env CC=${configure.cc}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_cmd "BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 ${tf_bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[variant_isset mkl]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --config=mkl"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![variant_isset native]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_build_opts "${tf_bazel_build_opts} --copt=${base_march}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set tf_bazel_cmd "CC_OPT_FLAGS=${base_march} ${tf_bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "Bazel build command : ${tf_bazel_cmd}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "Bazel build options : ${tf_bazel_build_opts}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Run the build
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system -W ${worksrcpath} "${tf_bazel_cmd} build ${tf_bazel_build_opts} //tensorflow/tools/pip_package:build_pip_package"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Build the python wheel
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system -W ${worksrcpath} "./bazel-bin/tensorflow/tools/pip_package/build_pip_package ${workpath}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Clean up
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system -W ${worksrcpath} "${tf_bazel_cmd} clean"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ bazel.build_target "//tensorflow/tools/pip_package:build_pip_package"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bazel.post_build_cmd "./bazel-bin/tensorflow/tools/pip_package/build_pip_package ${workpath}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> destroot.cmd pip-${python.branch}
destroot.args \
--ignore-installed \
</pre><pre style='margin:0'>
</pre>