-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Portfile
146 lines (118 loc) · 4.98 KB
/
Portfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup python 1.0
PortGroup github 1.0
PortGroup compilers 1.0
PortGroup compiler_blacklist_versions 1.0
name py-tensorflow
version 2.12.0
revision 0
github.setup tensorflow tensorflow ${version} v
license Apache-2
maintainers {emcrisostomo @emcrisostomo} openmaintainer
# Goal is darwin >= 18, but present failures prevent that for macOS 11.x+
platforms {darwin >= 18 <= 19}
supported_archs x86_64 arm64
description TensorFlow helps the tensors flow
long_description {*}${description}
homepage https://www.tensorflow.org/
known_fail yes
pre-fetch {
ui_error "${subport}: This port is presently broken on all macOS platforms"
return -code error "port broken"
}
github.livecheck.regex {([0-9.]+)}
checksums rmd160 26051c2456224f94f82e896aff4cb8512c2f6dc3 \
sha256 2b1725eccba5ee42347462f5a65b274a905f7946181fadafc7b44b5c85ba3041 \
size 69709103
use_xcode yes
compiler.cxx_standard 2017
compiler.blacklist-append {clang < 1000} {macports-clang-[4-9].0}
# Supported python versions
python.versions 39 310
if {${name} ne ${subport}} {
PortGroup bazel 1.0
# TF versions 1 and 2 cannot be installed at once
if { ${python.version} < 310 } {
conflicts py${python.version}-tensorflow1
}
# Conflicts with tensorflow-macos, tensorflow-metal
conflicts-append \
py${python.version}-tensorflow-macos \
py${python.version}-tensorflow-metal
# Relax Xcode minimum version, based on testing
bazel.min_xcode 10.3
variant mkl description {Enable Intel Math Kernel Library support} {
bazel.extra_build_opts-append --config=mkl
depends_lib-append port:py${python.version}-mkl
}
# Enable MKL by default on 10.15 and newer.
#if {${os.major} >= 19} {
# default_variants-append +mkl
#}
depends_build-append \
port:cctools \
port:ld64 \
port:py${python.version}-future \
port:py${python.version}-mock \
port:py${python.version}-pip
depends_lib-append \
port:py${python.version}-absl \
port:py${python.version}-astor \
port:py${python.version}-astunparse \
port:py${python.version}-flatbuffers \
port:py${python.version}-gast \
port:py${python.version}-google-pasta \
port:py${python.version}-grpcio \
port:py${python.version}-keras \
port:py${python.version}-numpy \
port:py${python.version}-opt_einsum \
port:py${python.version}-protobuf3 \
port:py${python.version}-six \
port:py${python.version}-tensorboard \
port:py${python.version}-tensorflow_estimator \
port:py${python.version}-termcolor \
port:py${python.version}-wheel \
port:py${python.version}-wrapt
use_configure yes
# Options passed to configure script via env vars
bazel::add_to_envs PYTHON_LIB_PATH=${python.prefix}/lib/python${python.branch}/site-packages
bazel::add_to_envs PYTHON_BIN_PATH=${prefix}/bin/python${python.branch}
# Use correct python in bazel build
bazel.python_version ${python.branch}
bazel.build_target "//tensorflow/tools/pip_package:build_pip_package"
bazel.post_build_cmd ./bazel-bin/tensorflow/tools/pip_package/build_pip_package [list $workpath]
# add -fuse-ld becase https://github.com/tensorflow/tensorflow/issues/58368
bazel.extra_build_opts-append \
--config=opt \
--linkopt="-fuse-ld=/usr/bin/ld"
bazel.limit_build_jobs no
# Overstep:
# target '@tf_runtime//:support' is not visible from target '//tensorflow/compiler/xla/pjrt:pjrt_future'
# See: https://github.com/tensorflow/tensorflow/issues/58825
bazel.extra_build_opts-append \
--noincompatible_fix_package_group_reporoot_syntax \
--noincompatible_validate_top_level_header_inclusions
destroot.cmd pip-${python.branch}
destroot.args \
--ignore-installed \
--no-cache-dir \
--no-dependencies \
--root ${destroot} \
${workpath}/tensorflow-*.whl
destroot.post_args
post-destroot {
file delete ${destroot}${python.prefix}/bin/tensorboard
file delete ${destroot}${prefix}/bin/tensorboard-${python.branch}
}
livecheck.type none
# If tensorflow-macos is available for this OS advertise it
if { ${os.major} > 19 } {
notes-append "
* A hardware accelerated MacOS optimised port of tensorflow from Apple\
is available as an alternative to ${subport}. To use run:
sudo port uninstall -f ${subport} ${subport}-addons
sudo port install ${subport}-macos
"
}
}