-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathPortfile
569 lines (470 loc) · 24.3 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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# -*- 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 select 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup active_variants 1.1
PortGroup cmake 1.1
PortGroup legacysupport 1.1
PortGroup conflicts_build 1.0
# Do not propagate c/c++ standards as set by base
cmake.set_c_standard no
cmake.set_cxx_standard no
# link legacysupport statically for compilers
legacysupport.use_static yes
# Sysconf wrapping causes issues so disable
legacysupport.disable_function_wrap yes
categories lang
platforms {darwin >= 11}
license NCSA
maintainers nomaintainer
set llvm_version 17
set clang_exe_version ${llvm_version}
version ${llvm_version}.0.6
name llvm-${llvm_version}
revision 0
subport mlir-${llvm_version} { revision [ expr ${revision} + 0 ] }
subport clang-${llvm_version} { revision [ expr ${revision} + 0 ] }
subport lldb-${llvm_version} { revision [ expr ${revision} + 0 ] }
subport flang-${llvm_version} { revision [ expr ${revision} + 0 ] }
checksums rmd160 10f44d5a8e3d0d5fc1a1961a8adaac945733ec07 \
sha256 58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813 \
size 127838860
master_sites https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}
distname llvm-project-${version}.src
use_xz yes
dist_subdir llvm
set suffix mp-${llvm_version}
set sub_prefix ${prefix}/libexec/llvm-${llvm_version}
worksrcdir ${worksrcdir}/llvm
# https://github.com/macports/macports-ports/commit/a83a493bc21cbe7e14b1f5884379649ec8f31bae#commitcomment-132530885
conflicts_build-append libunwind libunwind-headers
# hand-tweaked, approximately c++ standard 2017
compiler.blacklist *gcc* {clang < 1001} macports-clang-3.*
# work/build/include/c++/v1/optional:224:5: error: destructor cannot be marked constexpr
# _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__optional_destruct_base()
compiler.blacklist-append {clang < 1204} {macports-clang-[5-9].0} {macports-clang-1[0-3]}
compiler.fallback clang macports-clang-14 macports-clang-15
# We can't use Ninja with our custom destrooting plan for llvm
#cmake.generator Ninja
cmake.install_prefix ${sub_prefix}
cmake.build_type Release
# clean up some cmake-PG added values we don't want to use, because we want @rpaths
cmake.install_rpath
configure.pre_args-delete \
-DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
-DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib
configure.pre_args-replace \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF
configure.pre_args-replace \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${cmake.install_prefix}\;${prefix}\;/usr"
configure.args-append \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_ENABLE_FFI=ON \
-DFFI_INCLUDE_DIR=${prefix}/include \
-DFFI_LIBRARY_DIR=${prefix}/lib
# Disable iOS support
# To Be reviewed with later versions
# https://reviews.llvm.org/D133273
configure.args-append -DCOMPILER_RT_ENABLE_IOS=OFF
# cctools is needed to handle objects from newer clang toolchains
if {[string match macports-clang-* ${configure.compiler}]} {
depends_build-append port:cctools
depends_skip_archcheck-append cctools
configure.args-append -DCMAKE_LIBTOOL=${prefix}/bin/libtool
}
# build fails on 10.6.8 with ld64-127, the current default
if {${os.platform} eq "darwin" && ${os.major} < 11} {
depends_build-append port:ld64-latest
depends_skip_archcheck-append ld64-latest
configure.ldflags-append -fuse-ld=${prefix}/bin/ld-latest
}
set py_ver 3.11
set py_ver_nodot [string map {. {}} ${py_ver}]
depends_build-append port:python${py_ver_nodot} \
port:py${py_ver_nodot}-pygments \
port:py${py_ver_nodot}-yaml
set pythonfullpath ${prefix}/bin/python${py_ver}
configure.args-append -DPython3_EXECUTABLE=${pythonfullpath}
platform darwin {
configure.cxx_stdlib libc++
depends_lib-append port:libcxx
if {${os.major} < 11} {
pre-fetch {
if {![file exists /usr/lib/libc++.dylib]} {
ui_error "$name requires a C++11 runtime, which your configuration does not allow"
error "unsupported configuration"
}
}
}
}
patch.dir ${workpath}/${distname}
patch.pre_args -p1
patchfiles-append \
0001-MacPorts-only-clang-use-MP-omp-locations.patch \
0002-MacPorts-Only-Don-t-embed-the-deployment-target-in-t.patch \
0003-MacPorts-Only-Prepare-clang-format-for-replacement-w.patch \
0004-MacPorts-Only-Fix-name-of-scan-view-executable-insid.patch \
0006-Define-EXC_MASK_CRASH-and-MACH_EXCEPTION_CODES-if-th.patch \
0007-Threading-Only-call-pthread_setname_np-if-we-have-it.patch \
0008-Threading-Only-call-setpriority-PRIO_DARWIN_THREAD-0.patch \
0009-lib-Support-Unix-Path.inc-define-COPYFILE_CLONE-if-n.patch \
0010-compiler-rt-cmake-config-ix.cmake-was-Leopard-No-ASA.patch \
0011-Fix-missing-long-long-math-prototypes-when-using-the.patch \
0012-compiler-rt-add-some-defs-missing-in-older-SDKs.patch \
0013-clang-add-back-runtime-libraries-used-on-10.4-and-10.patch \
0014-Fix-float.h-to-work-on-Snow-Leopard-and-earlier.patch \
0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
0025-lldb-add-defines-needed-for-older-SDKs.patch \
0026-llvm-set-memrchr-unavailable.patch \
0999-i386-fix.diff \
add-missed-i386-host.diff
if {${os.platform} eq "darwin" && ${os.major} < 14} {
patchfiles-append \
0016-10.10-and-less-compiler-rt-find-macosx-sdk.patch
}
if {${os.platform} eq "darwin" && ${os.major} < 11} {
patchfiles-append \
0017-10.6-and-less-libcxx-work-around-no-reexported_symbo.patch \
0017-10.6-and-less-libcxxabi-work-around-no-reexported_symbo.patch \
0020-10.6-and-less-work-around-no-directory-watcher-befor.patch \
0021-10.6-and-less-libcxx-disable-Availability-tests.patch
}
if {${os.platform} eq "darwin" && ${os.major} < 10} {
patchfiles-append \
0022-10.5-and-less-default-to-fno-blocks.patch \
0024-10.5-and-less-compiler-rt-work-around-no-libdispatch.patch \
0027-libcxx-link-gcc_s.1-on-macOS-before-10.6.patch \
0028-libcxx-use-malloc-free-only-on-macOS-before-10.6.patch
# inverse limit of building for macOS 10.7+
# See: https://github.com/llvm/llvm-project/commit/49d2071572d484a2b5dc356f59050bb173c8c77c
patchfiles-append \
49d2071572d484a2b5dc356f59050bb173c8c77c-inverse.patch
}
if {${os.platform} eq "darwin" && ${os.major} < 16} {
# error: 'TARGET_OS_OSX' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
patchfiles-append 0100-define-target-os-osx.patch
}
if {${os.platform} eq "darwin" && ${os.major} < 16} {
# Avoid attempts to use 'clonefile'
# llvm/lib/Support/Unix/Path.inc:1476:10: error: use of undeclared identifier 'clonefile'
patchfiles-append 0031-Avoid-Use-Of-Clonefile.patch
}
if {${os.platform} eq "darwin" && ${os.major} < 14} {
# Revert use of pthread/qos.h that is only available on macOS10.10 and newer
# https://trac.macports.org/ticket/65626#comment:5
# Created by reverting the commit
# https://github.com/llvm/llvm-project/commit/9902a0945d22cd5757b16ebe85fe07059723aa09
# > git revert 9902a0945d22cd5757b16ebe85fe07059723aa09
patchfiles-append 0110-Avoid-Pthread-QOS.patch
}
if {${os.platform} eq "darwin" && ${os.major} < 12} {
# On OSX10.7 and older revert call to add_security_warnings as fails with
# add_security_warnings Function invoked with incorrect arguments
post-patch {
reinplace "s|add_security_warnings\(|\#add_security_warnings\(|" \
${patch.dir}/compiler-rt/lib/builtins/CMakeLists.txt \
${patch.dir}/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
}
}
# https://trac.macports.org/ticket/67686
# revert commit that breaks rpath linkages in clang runtime
if {${os.platform} eq "darwin"} {
patchfiles-append b98da4c71edda3df0a0555b1ab63ec52e92252b4-inverse.patch
}
if {${os.platform} eq "darwin" && ${os.major} <= 16} {
# error: 'utimensat' is only available on macOS 10.13 or newer
patchfiles-append 0041-no-Werror-unguarded-availability-new.patch
}
if {${os.platform} eq "darwin" && ${os.major} <= 16} {
# https://github.com/llvm/llvm-project/issues/64226
patchfiles-append 0042-mbstate_t-not-defined.patch
}
post-patch {
reinplace "s|@@PREFIX@@|${prefix}|" \
${patch.dir}/clang/lib/Driver/ToolChains/Clang.cpp \
${patch.dir}/clang/lib/Driver/ToolChains/CommonArgs.cpp
reinplace "s|@CLANG_FORMAT_PATH@|${prefix}/bin/clang-format-${suffix}|g" \
${patch.dir}/clang/tools/clang-format/clang-format-bbedit.applescript \
${patch.dir}/clang/tools/clang-format/clang-format-diff.py \
${patch.dir}/clang/tools/clang-format/clang-format-sublime.py \
${patch.dir}/clang/tools/clang-format/clang-format.el \
${patch.dir}/clang/tools/clang-format/clang-format.py
}
# libc++ link step fails on OSX10.10 and older to correctly use static legacy support lib.
if {${os.platform} eq "darwin" && ${os.major} <= [option legacysupport.newest_darwin_requires_legacy] } {
post-patch {
reinplace "s|LIBCXX_LIBRARIES \"\"|LIBCXX_LIBRARIES \"[legacysupport::get_library_link_flags]\"|" ${patch.dir}/libcxx/CMakeLists.txt
}
}
if {${subport} eq "llvm-${llvm_version}"} {
homepage https://llvm.org/
description llvm is a next generation compiler infrastructure
long_description The LLVM Core libraries provide a modern source- and \
target-independent optimizer, along with code \
generation support for many popular CPUs (as well as \
some less common ones!) These libraries are built \
around a well specified code representation known as \
the LLVM intermediate representation ("LLVM IR").
depends_lib-append port:libedit port:libffi port:ncurses path:lib/libxar.dylib:xar port:zlib port:zstd
depends_run-append port:llvm_select
select.group llvm
select.file ${filespath}/mp-${subport}
configure.args-append \
-DLLVM_ENABLE_PROJECTS="polly"
}
if {${subport} eq "mlir-${llvm_version}"} {
homepage https://mlir.llvm.org
description The MLIR project is a novel approach to building reusable \
and extensible compiler infrastructure.
long_description {*}${description} MLIR aims to address software fragmentation, \
improve compilation for heterogeneous hardware, significantly \
reduce the cost of building domain specific compilers, and aid \
in connecting existing compilers together.
depends_lib-append port:llvm-${llvm_version}
configure.args-append \
-DLLVM_ENABLE_PROJECTS="mlir"
destroot {
# we have to run the destroot like this, because individual targets for each of the
# components we want to install are not available; we want "everything but llvm"
system "cd ${destroot.dir}/tools/mlir && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
}
}
if { ${subport} eq "clang-${llvm_version}" } {
homepage https://clang.llvm.org/
description C, C++, Objective C and Objective C++ compiler
long_description The Clang project provides a language front-end and tooling infrastructure \
for languages in the C language family (C, C++, Objective C/C++, OpenCL, \
CUDA, and RenderScript) for the LLVM project.
depends_run-append port:clang_select port:cctools
select.group clang
select.file ${filespath}/mp-${subport}
configure.args-append \
-DLLVM_ENABLE_PROJECTS="clang\;clang-tools-extra\;compiler-rt\;lld" \
-DLLVM_ENABLE_RUNTIMES="libcxx\;libcxxabi" \
-DLIBCXX_ENABLE_SHARED=ON \
-DLIBCXX_INSTALL_LIBRARY=ON
destroot {
# we have to run the destroot like this, because individual targets for each of the
# components we want to install are not available; we want "everything but llvm"
system "cd ${destroot.dir}/tools/clang && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
system "cd ${destroot.dir}/tools/lld && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
system "cd ${destroot.dir}/projects/compiler-rt && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
system "cd ${destroot.dir}/runtimes/runtimes-bins/libcxx && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
system "cd ${destroot.dir}/runtimes/runtimes-bins/libcxxabi && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
}
}
if { ${subport} eq "flang-${llvm_version}" } {
homepage https://flang.llvm.org/
description LLVM Fortran compiler
long_description {*}${description}
# CMakeLists.txt: flang isn't supported on 32 bit CPUs
supported_archs arm64 x86_64
configure.args-append \
-DLLVM_ENABLE_PROJECTS="clang\;flang\;compiler-rt\;mlir" \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBCXX_INSTALL_LIBRARY=OFF
depends_lib-append port:clang-${llvm_version} port:mlir-${llvm_version}
destroot {
# we have to run the destroot like this, because individual targets for each of the
# components we want to install are not available; we want "everything but llvm"
system "cd ${destroot.dir}/tools/flang && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
}
}
if { ${subport} eq "clang-${llvm_version}" || ${subport} eq "flang-${llvm_version}" } {
depends_lib-append port:libxml2 port:libomp port:llvm-${llvm_version}
depends_run-append port:ld64
depends_skip_archcheck-append ld64
# CMAKE_LINKER is used to determine the value for HOST_LINK_VERSION
configure.args-append \
-DCMAKE_LINKER=${prefix}/bin/ld \
-DCLANG_INCLUDE_TESTS=OFF \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DDARWIN_PREFER_PUBLIC_SDK=ON \
-DLLVM_BUILD_RUNTIME=ON
# the orc submodule is not building at present - can't find c_api.h
# https://trac.macports.org/ticket/65578
configure.args-append -DCOMPILER_RT_BUILD_ORC=OFF
if {${os.platform} eq "darwin" && ${os.major} <= 18} {
# on systems that might build i386, we need atomic builtins
# https://trac.macports.org/ticket/58712
configure.args-append -DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=OFF
}
if {${os.platform} eq "darwin" && ${os.major} <= 14} {
# compiler-rt does a broad search for an SDK it likes, but this
# search fails on older systems that don't have a MacOSX.sdk
# TODO: apply this always to all systems?
if {${configure.sdkroot} eq ""} {set configure.sdkroot "/"}
configure.args-append -DDARWIN_osx_SYSROOT="${configure.sdkroot}"
}
if {${os.platform} eq "darwin" && ${os.major} <= 15} {
# sanitizers in compiler_rt fail to build on older systems
# might be fixable with the use of newer SDK and/or effort if motivated
# all three toggles are needed to force them off
# Extended to 10.11 and older, see https://trac.macports.org/ticket/65887
configure.args-append -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_BUILD_MEMPROF=OFF
}
if {${os.platform} eq "darwin" && ${os.major} <= 11} {
# xpc.h available 10.7 but doesn't support nullable features
configure.args-append -DCLANGD_BUILD_XPC=OFF
}
if {${os.platform} eq "darwin" && ${os.major} <= 10} {
# avoid need for thread_local_storage
configure.args-append -DCLANG_ENABLE_CLANGD=OFF \
-DLLVM_ENABLE_BACKTRACES=OFF
}
}
if {${subport} eq "lldb-${llvm_version}"} {
homepage https://lldb.llvm.org/
description the LLVM debugger
long_description lldb is the "LLVM native" debugger.
depends_lib-append port:libedit port:libffi port:ncurses path:lib/libxar.dylib:xar port:zlib
depends_lib-append port:llvm-${llvm_version} port:clang-${llvm_version}
depends_build-append port:swig-python path:bin/doxygen:doxygen
depends_run-append port:lldb_select
select.group lldb
select.file ${filespath}/mp-${subport}
# error: use of undeclared identifier 'CPU_SUBTYPE_ARM64E
platforms {darwin >= 18}
configure.args-append \
-DLLDB_CODESIGN_IDENTITY=- \
-DLLDB_ENABLE_LUA=OFF
set worksrcpath ${workpath}/${distname}/lldb
notes "Please follow the instructions at https://lldb.llvm.org/resources/build.html#code-signing-on-macos and then codesign lldb-server with:\n--------------------\n"
notes-append "${sub_prefix}/scripts/lldb/macos-setup-codesign.sh"
if {${os.major} >= 13} {
notes-append "sudo codesign --force --deep --preserve-metadata=identifier,entitlements,resource-rules,requirements,flags,team-identifier --sign lldb_codesign ${sub_prefix}/bin/lldb-server"
} else {
notes-append "sudo codesign --force --deep --preserve-metadata=identifier,entitlements,resource-rules,requirements --sign lldb_codesign ${sub_prefix}/bin/lldb-server"
}
}
variant tests description {Enable building of test code} {
depends_test-append port:py${py_ver_nodot}-psutil
test.run yes
configure.args-append -DLLVM_INCLUDE_TESTS=ON
test.target check
if {${subport} eq "clang-${llvm_version}"} {
test.target check-all
}
if {${subport} eq "lldb-${llvm_version}"} {
pre-fetch {
ui_error "running the test suite on ${subport} is not supported on this os version at present."
return -code error {unsupported platform}
}
}
}
post-destroot {
if {${subport} eq "clang-${llvm_version}"} {
# remove the clang symlink and replace it with the actual binary
delete ${destroot}${sub_prefix}/bin/clang
file rename ${destroot}${sub_prefix}/bin/clang-${clang_exe_version} ${destroot}${sub_prefix}/bin/clang
}
# generate a versioned wrapper script for each file in the bin directory
foreach bin [glob ${destroot}${sub_prefix}/bin/*] {
set bin_filename [string map "${sub_prefix} ${prefix}" ${bin}]-${suffix}
set exec_path [string map "${destroot}${sub_prefix} ${sub_prefix}" ${bin}]
# see https://trac.macports.org/ticket/54985
if {${os.platform} eq "darwin" && [vercmp ${xcodeversion} 4.6] < 0} {
xinstall -m 755 "${filespath}/llvm-bin-compat" "${bin_filename}"
} else {
xinstall -m 755 "${filespath}/llvm-bin" "${bin_filename}"
}
reinplace "s:EXEC_PATH:${exec_path}:" "${bin_filename}"
}
if {${subport} eq "llvm-${llvm_version}"} {
# https://llvm.org/bugs/show_bug.cgi?id=19465
ln -s LLVMPolly.so ${destroot}${sub_prefix}/lib/LLVMPolly.dylib
}
if {${subport} eq "clang-${llvm_version}"} {
# fix the cmake scripts to point to the versioned files
reinplace "s|/bin/clang-${clang_exe_version}|/bin/clang|g" \
"${destroot}${sub_prefix}/lib/cmake/clang/ClangTargets-release.cmake"
# http://trac.macports.org/ticket/33207
ln -s ${prefix}/libexec/ld64/ld ${destroot}${sub_prefix}/bin/ld
}
if {${subport} eq "lldb-${llvm_version}"} {
delete ${destroot}${prefix}/bin/debugserver-${suffix}
set lldb_scripts_srcdir ${worksrcpath}/scripts
set lldb_scripts_destdir ${destroot}${sub_prefix}/scripts/lldb
xinstall -d ${lldb_scripts_destdir}
xinstall -m 755 -W ${lldb_scripts_srcdir} \
macos-setup-codesign.sh \
${lldb_scripts_destdir}
}
}
if {${subport} eq "clang-${llvm_version}"} {
variant analyzer description {Install clang static analyzer} {
# these have to be switched on or off together
configure.args-replace -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_STATIC_ANALYZER=ON
configure.args-replace -DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_ARCMT=ON
depends_run-append port:perl5
post-patch {
reinplace "s|/usr/bin/env perl|${prefix}/bin/perl5|g" \
${patch.dir}/clang/tools/scan-build/libexec/ccc-analyzer \
${patch.dir}/clang/tools/scan-build/libexec/c++-analyzer \
${patch.dir}/clang/tools/scan-build/bin/scan-build
}
}
# Avoid requiring a bootstrap version of perl5 on 10.6.
if {${os.major} >= 11} {
default_variants +analyzer
}
variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
patchfiles-append 0005-clang-support-macports-libstdcxx.patch
if {${os.major} < 11} {
# see https://trac.macports.org/ticket/61778
depends_run-append port:libstdcxx_clang_fix
}
post-patch {
reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
${patch.dir}/clang/lib/Lex/InitHeaderSearch.cpp \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
reinplace "s|@@MACPORTS_HOST_NAME@@|${configure.build_arch}-apple-darwin${os.major}|g" \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
# GCC was built for ${configure.build_arch}-apple-darwin${os.major}
# if GCC was also built universal, it has an extra include directory
# if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
# if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
# MacPorts GCC cannot compile across platforms
switch ${configure.build_arch} {
x86_64 {
reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
}
i386 {
reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
}
ppc64 {
reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
}
ppc {
reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
}
arm64 {
reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
}
}
}
}
if { ${cxx_stdlib} eq "libstdc++" } {
default_variants-append +libstdcxx
}
}
livecheck.type regex
livecheck.url https://github.com/llvm/llvm-project/tags
livecheck.regex llvmorg-(${llvm_version}.\[\\d.\]+).tar.gz