-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathPortfile
396 lines (343 loc) · 14.8 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# -*- 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 cmake 1.1
PortGroup github 1.0
PortGroup boost 1.0
PortGroup active_variants 1.1
boost.version 1.81
github.setup apache arrow 12.0.0 apache-arrow-
revision 3
name ${github.author}-${github.project}
categories devel
license Apache-2
maintainers nomaintainer
description Powering In-Memory Analytics
long_description Apache Arrow is a development platform for in-memory \
analytics. It contains a set of technologies that \
enable big data systems to process and move data fast.
checksums rmd160 060f7b3ea56d418b089aee4632c363fb03381abb \
sha256 34bc4f650a3807c832ebd299cb73c60fae34ec81efba23df2435548a166d5ca8 \
size 19843276
compiler.cxx_standard \
2017
universal_variant no
# Build instructions: https://github.com/apache/arrow/blob/master/docs/source/developers/python.rst#build-and-test
cmake.generator Ninja
cmake.source_dir ${worksrcpath}/cpp
cmake.build_type Release
set cmake_build_type \
[string tolower ${cmake.build_type}]
# LLVM only needed for Gandiva: https://github.com/apache/arrow/issues/34999
# I.e. it is here for no reason: Gandiva is not built by default and not asked to be built in configure.args.
# At least remove a dependency on LLVM for PPC, where it is broken.
# If Gandiva is added to the build, please add it inside the clause below.
if {${build_arch} ni [list ppc ppc64]} {
set llvm_version 14
set llvm_prefix ${prefix}/libexec/llvm-${llvm_version}
set llvm_bin ${llvm_prefix}/bin
cmake.module_path-append \
${llvm_prefix}/lib/cmake/llvm
depends_lib-append \
port:llvm-${llvm_version}
configure.args-append \
-DLLVM_ROOT:PATH=${llvm_prefix}
}
cmake.module_path-append \
${prefix}/lib/cmake/grpc/modules
depends_build-append \
port:pkgconfig
depends_lib-append \
port:abseil \
path:lib/libssl.dylib:openssl \
port:brotli \
port:bzip2 \
port:c-ares \
port:gmake \
port:grpc \
path:lib/libglog.dylib:google-glog \
port:jemalloc \
port:libutf8proc \
port:lz4 \
port:ninja \
port:protobuf3-cpp \
path:lib/pkgconfig/RapidJSON.pc:rapidjson \
port:re2 \
port:snappy \
port:thrift \
port:wget \
port:zlib \
port:zstd
# https://github.com/apache/arrow/pull/35046
patchfiles-append patch-io_util.diff
# https://github.com/apache/arrow/issues/35833
patchfiles-append patch-absl-ver.diff
# Remove incorrect make dependency on SDK that cmake adds on some systems
# See https://github.com/grpc/grpc/issues/24902
post-configure {
set macos_sdk [file tail ${configure.sdkroot}]
set cmakefiles_dirs {}
fs-traverse f ${cmake.build_dir} {
if { [file isdirectory ${f}]
&& [string match "CMakeFiles" [file tail ${f}]] } {
append cmakefiles_dirs " " ${f}
}
}
foreach d ${cmakefiles_dirs} {
foreach f [glob -nocomplain -type f ${d}/*.dir/*.make] {
reinplace -q -E "/:\[\[:space:]]+\\/\[^\[:space:]]+\\/${macos_sdk}\\/\[^\[:space:]]+\\/CoreFoundation\\.framework/d" ${f}
}
foreach f [glob -nocomplain -type f ${d}/*.dir/link.txt] {
reinplace -q -E "s|(\[\[:space:]]+)/\[^\[:space:]]+/${macos_sdk}/\[^\[:space:]]+/CoreFoundation\.framework\[\[:space:]]*| |g" ${f}
}
}
}
# used for both apache-arrow and py*-pyarrow
# macOS wheel:
# https://github.com/apache/arrow/blob/main/ci/scripts/python_wheel_macos_build.sh
# Re rpath see: https://arrow.apache.org/docs/r/articles/developers/setup.html#rpath-issues
# Also: https://github.com/apache/arrow/issues/35045
configure.args-append \
-DARROW_ACERO:BOOL=OFF \
-DARROW_BUILD_SHARED:BOOL=ON \
-DARROW_BUILD_STATIC:BOOL=OFF \
-DARROW_COMPUTE:BOOL=ON \
-DARROW_CSV:BOOL=ON \
-DARROW_DATASET:BOOL=ON \
-DARROW_DEPENDENCY_USE_SHARED:BOOL=ON \
-DARROW_EXTRA_ERROR_CONTEXT:BOOL=ON \
-DARROW_FILESYSTEM:BOOL=ON \
-DARROW_FLIGHT:BOOL=ON \
-DARROW_GCS:BOOL=ON \
-DARROW_HDFS:BOOL=ON \
-DARROW_INSTALL_NAME_RPATH:BOOL=OFF \
-DARROW_JEMALLOC:BOOL=ON \
-DARROW_JSON:BOOL=ON \
-DARROW_MIMALLOC:BOOL=ON \
-DARROW_ORC:BOOL=ON \
-DARROW_PACKAGE_KIND="python-wheel-macos" \
-DARROW_PARQUET:BOOL=ON \
-DARROW_PLASMA:BOOL=ON \
-DARROW_PROTOBUF_USE_SHARED:BOOL=ON \
-DARROW_PYTHON:BOOL=OFF \
-DARROW_RPATH_ORIGIN:BOOL=OFF \
-DARROW_S3:BOOL=OFF \
-DARROW_SUBSTRAIT:BOOL=OFF \
-DARROW_USE_CCACHE:BOOL=ON \
-DARROW_TENSORFLOW:BOOL=OFF \
-DARROW_UTF8PROC_USE_SHARED:BOOL=ON \
-DARROW_WITH_BROTLI:BOOL=ON \
-DARROW_WITH_BZ2:BOOL=ON \
-DARROW_WITH_LZ4:BOOL=ON \
-DARROW_WITH_SNAPPY:BOOL=ON \
-DARROW_WITH_ZLIB:BOOL=ON \
-DARROW_WITH_ZSTD:BOOL=ON \
-Dc-ares_INCLUDE_DIR:PATH=${prefix}/include \
-DgRPC_ROOT:PATH=${prefix} \
-Djemalloc_SOURCE:STRING=SYSTEM \
-DRE2_SOURCE:STRING=SYSTEM
if {${os.platform} eq "darwin" && ${os.major} < 12} {
# arrow downloads mimalloc version which is broken for < 10.8 due to missing MACH_TASK_BASIC_INFO_COUNT etc.
configure.args-replace \
-DARROW_MIMALLOC:BOOL=ON -DARROW_MIMALLOC:BOOL=OFF
}
# Build auto-detects cache if it is installed and a part of it attempts
# to write to CCACHE_DIR which is not allow if configure.ccache=off.
# So have to set CCACHE_DIR to the build area to avoid this...
if {![option configure.ccache]} {
configure.env-append CCACHE_DIR=${workpath}/.ccache
build.env-append CCACHE_DIR=${workpath}/.ccache
destroot.env-append CCACHE_DIR=${workpath}/.ccache
configure.args-replace -DARROW_USE_CCACHE:BOOL=ON \
-DARROW_USE_CCACHE:BOOL=OFF
}
destroot.target install
if {${name} eq ${subport}} {
configure.args-append \
-DARROW_BUILD_UTILITIES:BOOL=ON
variant tensorflow description {Build with tensorflow support enabled} {
configure.args-replace \
-DARROW_TENSORFLOW:BOOL=OFF \
-DARROW_TENSORFLOW:BOOL=ON
}
}
# lib[^[:space:]]+
proc change_arrow_rpath { binname libname_re } {
global prefix python.pkgd
foreach path [exec bash -c \
"otool -L \"${binname}\" | grep -E -o -e '@rpath/${libname_re}' || true"] {
set newpath [strsed ${path} "s|@rpath|${python.pkgd}/pyarrow|"]
if {[file tail ${binname}] eq [file tail ${path}]} {
system "install_name_tool -id \"${newpath}\" \"${binname}\""
} else {
system "install_name_tool -change \"${path}\" \"${newpath}\" \"${binname}\""
}
}
}
# create Python subports
set python_versions [list 39 310]
foreach v ${python_versions} {
subport py${v}-py${github.project} {
set python.version ${v}
}
}
# Python bindings for supported Python versions
if {[string match "py*" ${subport}]} {
PortGroup python 1.0
categories-prepend devel
python.versions {*}${python_versions}
github.setup ${github.author} ${github.project} ${github.version} ${github.tag_prefix}
fetch.type git
depends_build-append \
port:bash \
port:cctools \
port:py${python.version}-pip \
port:py${python.version}-setuptools \
port:py${python.version}-setuptools_scm \
port:py${python.version}-wheel
depends_lib-append \
port:apache-arrow \
port:py${python.version}-brotli \
port:py${python.version}-cython \
port:py${python.version}-pycares \
port:py${python.version}-numpy
depends_test-append \
port:py${python.version}-cffi \
port:py${python.version}-hypothesis \
port:py${python.version}-pandas \
port:py${python.version}-pytest \
port:py${python.version}-pytest-lazy-fixture \
port:py${python.version}-tz
post-fetch {
system -W ${worksrcpath} "git submodule update --init --recursive"
}
# the build must link against its own libraries
cmake.install_rpath
use_configure yes
# install apache-arrow for this ${python.branch} in ${configure_destdir}
set configure_destdir ${workpath}/${name}-DESTDIR
post-extract {
# see portdestroot::destroot_start
set mtree [findBinary mtree ${portutil::autoconf::mtree_path}]
file mkdir "${configure_destdir}"
if { ${os.platform} eq "darwin" } {
system -W ${configure_destdir} "${mtree} -e -U -f [file join ${portsharepath} install macosx.mtree]"
file mkdir "${configure_destdir}${applications_dir}"
file mkdir "${configure_destdir}${frameworks_dir}"
}
file mkdir "${configure_destdir}${prefix}"
system -W ${configure_destdir}${prefix} "${mtree} -e -U -f [file join ${portsharepath} install prefix.mtree]"
}
post-configure {
system -W ${configure.dir} \
"ninja all -j${build.jobs} -v"
system -W ${configure.dir} \
"export DESTDIR=${configure_destdir}; \
ninja install"
}
cmake.module_path-prepend \
${configure_destdir}${prefix}/lib/cmake
compiler.library_path \
"${configure_destdir}${prefix}/lib:${prefix}/lib"
configure.ldflags-prepend \
-L${configure_destdir}${prefix}/lib
configure.pre_args-delete \
--prefix=${prefix}
configure.pre_args-replace \
{-DCMAKE_C_COMPILER="$CC"} \
-DCMAKE_C_COMPILER:FILEPATH=${configure.cc}
configure.pre_args-replace \
{-DCMAKE_CXX_COMPILER="$CXX"} \
-DCMAKE_CXX_COMPILER:FILEPATH=${configure.cxx}
if {${cmake.generator} ne {Ninja}} {
configure.pre_args-replace \
"-DCMAKE_MAKE_PROGRAM=${python.bin} setup.py --no-user-cfg" \
-DCMAKE_MAKE_PROGRAM:STRING=[portbuild::build_getmaketype]
}
# macOS wheel:
# https://github.com/apache/arrow/blob/main/ci/scripts/python_wheel_macos_build.sh
configure.args-replace \
-DARROW_PYTHON:BOOL=OFF \
-DARROW_PYTHON:BOOL=ON
configure.args-replace \
-DARROW_RPATH_ORIGIN:BOOL=OFF \
-DARROW_RPATH_ORIGIN:BOOL=ON
configure.args-append \
-DPython3_EXECUTABLE:FILEPATH=${python.bin} \
-Dre2_DIR:PATH=${prefix}/lib/cmake/grpc/modules
build.env-append \
"PKG_CONFIG_PATH=/usr/lib/pkgconfig:${build.dir}/install/lib/pkgconfig" \
PYARROW_BOOST_USE_SHARED=1 \
PYARROW_BUILD_TYPE=${cmake_build_type} \
PYARROW_BUNDLE_ARROW_CPP=1 \
PYARROW_CMAKE_OPTIONS=[exec echo {*}${configure.pre_args}] \
PYARROW_INSTALL_TESTS=1 \
PYARROW_CMAKE_GENERATOR=${cmake.generator} \
PYARROW_WITH_DATASET=1 \
PYARROW_WITH_FLIGHT=1 \
PYARROW_WITH_HDFS=1 \
PYARROW_WITH_ORC=1 \
PYARROW_WITH_PARQUET=1 \
PYARROW_WITH_PLASMA=1 \
PYARROW_WITH_S3=0 \
PYARROW_WITH_TENSORFLOW=0
variant tensorflow description {Build with tensorflow support enabled} {
require_active_variants apache-arrow tensorflow
build.env-replace \
PYARROW_WITH_TENSORFLOW=0 \
PYARROW_WITH_TENSORFLOW=1
# py-tensorflow-macos requires minimum macOS 12.0 and Python 3.8
if {${os.major} >= 21 && ${python.version} >= 38} {
depends_lib-append \
path:${python.pkgd}/tensorflow:py${python.version}-tensorflow-macos
} else {
depends_lib-append \
path:${python.pkgd}/tensorflow:py${python.version}-tensorflow
}
}
build.dir ${worksrcpath}/python
build.cmd ${python.bin} setup.py --no-user-cfg
build.target bdist_wheel
build.post_args
pre-destroot {
foreach f [glob ${build.dir}/dist/py${github.project}-${version}*.whl] {
destroot.args-append \
${f}
}
}
destroot.cmd pip-${python.branch}
destroot.args --ignore-installed \
--no-cache-dir \
--no-dependencies \
--root ${destroot}
destroot.post_args
post-destroot {
fs-traverse f ${destroot}${python.pkgd}/pyarrow {
if {[file isfile ${f}]
&& [regexp {\.(so|dylib)$} ${f}]} {
change_arrow_rpath ${f} {lib[^[:space:]]+}
}
}
}
post-destroot {
set docdir ${prefix}/share/doc/${subport}
xinstall -d ${destroot}${docdir}
xinstall -m 0644 -W ${worksrcpath} LICENSE.txt README.md ${destroot}${docdir}
foreach f [glob -nocomplain ${destroot}${prefix}/bin/*] {
move ${f} ${f}-${python.branch}
}
}
test.run yes
test.env-append \
ARROW_TEST_DATA=${worksrcpath}/testing/data \
PARQUET_TEST_DATA=${worksrcpath}/cpp/submodules/parquet-testing/data
test.target
livecheck.type none
} else {
github.livecheck.regex {([0-9.]+)}
}
if { ![variant_isset tensorflow] } {
notes-append "\
- ${subport} is now built with tensorflow support disabled by default.\
To enable it, install the port with '+tensorflow'.\
"
}