source: trunk/dports/lang/llvm-devel/Portfile

Last change on this file was 153834, checked in by jeremyhu@…, 13 months ago

llvm-devel: Bump to r284098

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 23.7 KB
Line 
1# $Id: Portfile 153834 2016-10-13 04:09:07Z ryandesign@macports.org $
2
3# TODO:
4#  * Update clang subport to build against installed llvm
5
6PortSystem              1.0
7PortGroup select        1.0
8PortGroup compiler_blacklist_versions 1.0
9PortGroup active_variants 1.1
10PortGroup cmake         1.0
11
12set llvm_version        devel
13set llvm_version_no_dot devel
14set clang_executable_version 4.0
15set lldb_executable_version 4.0.0
16name                    llvm-${llvm_version}
17revision                0
18subport                 clang-${llvm_version} {}
19subport                 lldb-${llvm_version} {}
20set suffix              mp-${llvm_version}
21set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
22dist_subdir             llvm
23categories              lang
24platforms               darwin
25license                 NCSA
26maintainers             jeremyhu larryv
27
28if {${subport} eq "llvm-${llvm_version}"} {
29    homepage            http://llvm.org/
30    description         llvm is a next generation compiler infrastructure
31    long_description    The LLVM Core libraries provide a modern source- and \
32                        target-independent optimizer, along with code \
33                        generation support for many popular CPUs (as well as \
34                        some less common ones!) These libraries are built \
35                        around a well specified code representation known as \
36                        the LLVM intermediate representation ("LLVM IR").
37
38    depends_lib         port:libedit port:libffi port:ncurses port:zlib
39    depends_run         bin:perl:perl5 port:llvm_select
40} elseif {${subport} eq "clang-${llvm_version}"} {
41    homepage            http://clang.llvm.org/
42    description         C, C++, Objective C and Objective C++ compiler
43    long_description    Clang is an "LLVM native" C/C++/Objective-C compiler, \
44                        which aims to deliver amazingly fast compiles (e.g. \
45                        about 3x faster than GCC when compiling Objective-C \
46                        code in a debug configuration), extremely useful error \
47                        and warning messages and to provide a platform for \
48                        building great source level tools. The included Clang \
49                        Static Analyzer is a tool that automatically finds bugs in \
50                        your code, and is a great example of the sort of tool \
51                        that can be built using the Clang frontend as a \
52                        library to parse C/C++ code.
53
54    depends_lib         port:libxml2 port:libomp port:llvm-${llvm_version} port:python27
55    depends_run         port:clang_select port:ld64
56    depends_build-append port:cctools
57    depends_skip_archcheck-append cctools ld64 subversion
58
59    # Clang doesn't actually use any of these, but the LLVM makefile
60    # system overlinks its binaries. Remove (or convert to build deps?)
61    # after #46040 is resolved.
62    depends_lib-append  port:libedit port:libffi port:ncurses port:zlib
63
64    default_variants    +analyzer
65} elseif {${subport} eq "lldb-${llvm_version}"} {
66    homepage            http://lldb.llvm.org/
67    description         the LLVM debugger
68    long_description    Lldb is the "LLVM native" debugger.
69
70    depends_lib         port:libxml2 port:libomp port:llvm-${llvm_version} port:python27 \
71                        port:ncurses
72    depends_build-append port:cctools port:swig-python port:doxygen
73    depends_skip_archcheck-append cctools
74
75    # Clang doesn't actually use any of these, but the LLVM makefile
76    # system overlinks its binaries. Remove (or convert to build deps?)
77    # after #46040 is resolved.
78    depends_lib-append  port:libedit port:libffi port:ncurses port:zlib
79}
80
81fetch.type              svn
82svn.revision            284098
83
84depends_extract-append  port:subversion
85
86set compiler_rt_rev     ${svn.revision}
87set libcxx_rev          ${svn.revision}
88set clang-modernize_rev ${svn.revision}
89version                 ${llvm_version}-r${svn.revision}
90worksrcdir              trunk
91svn.url                 https://llvm.org/svn/llvm-project/llvm/trunk
92#worksrcdir              release_${llvm_version_no_dot}
93#svn.url                 https://llvm.org/svn/llvm-project/llvm/branches/release_${llvm_version_no_dot}
94default_variants-append +assertions
95default_variants-append +debug
96
97#version                 ${llvm_version}.0
98#epoch                   1
99#master_sites            http://llvm.org/releases/${version}
100#use_xz                  yes
101#extract.suffix          .tar.xz
102#distfiles               llvm-${version}.src${extract.suffix}
103#worksrcdir              llvm-${version}.src
104
105if {${distfiles} ne ""} {
106    if {${subport} eq "llvm-${llvm_version}"} {
107        if {[variant_isset polly]} {
108            distfiles-append     polly-${version}.src${extract.suffix}
109        }
110    } elseif {${subport} eq "clang-${llvm_version}"} {
111        distfiles-append     cfe-${version}.src${extract.suffix} compiler-rt-${version}.src${extract.suffix} libcxx-${version}.src${extract.suffix} clang-tools-extra-${version}.src${extract.suffix}
112    } elseif {${subport} eq "lldb-${llvm_version}"} {
113        distfiles-append     cfe-${version}.src${extract.suffix} lldb-${version}.src${extract.suffix}
114    }
115}
116
117patch.pre_args  -p1
118patchfiles \
119        0001-Set-the-Mach-O-CPU-Subtype-to-ppc7400-when-targeting.patch \
120        0002-Define-EXC_MASK_CRASH-and-MACH_EXCEPTION_CODES-if-th.patch \
121        0003-MacPorts-Only-Don-t-embed-the-deployment-target-in-t.patch
122
123if {${subport} eq "clang-${llvm_version}"} {
124    patchfiles-append \
125        1001-MacPorts-Only-Prepare-clang-format-for-replacement-w.patch \
126        1002-MacPorts-Only-Fix-name-of-scan-view-executable-insid.patch \
127        1003-Default-to-ppc7400-for-OSX-10.5.patch \
128        1004-Only-call-setpriority-PRIO_DARWIN_THREAD-0-PRIO_DARW.patch \
129        1005-Default-to-fragile-ObjC-runtime-when-targeting-darwi.patch \
130        2001-MacPorts-Only-Don-t-check-for-the-macosx.internal-SD.patch \
131        3001-buildit-build-fix-for-Leopard.patch \
132        3002-buildit-Set-compatibility-version-to-RC_ProjectSourc.patch \
133        3003-Fix-local-and-iterator-when-building-with-Lion-and-n.patch \
134        3004-Fix-missing-long-long-math-prototypes-when-using-the.patch \
135        3005-implement-atomic-using-mutex-lock_guard-for-64b-ops-.patch \
136        openmp-locations.patch
137
138    # https://llvm.org/bugs/show_bug.cgi?id=25681
139    if {${worksrcdir} eq "trunk" || ${worksrcdir} eq "release_${llvm_version_no_dot}"} {
140        # Cannot set cppflags due to https://cmake.org/Bug/view.php?id=12928
141        # Cannot set cxxflags due to https://llvm.org/bugs/show_bug.cgi?id=25904
142        #configure.cxxflags-append -DSVN_REVISION='"${svn.revision}"'
143
144        post-patch {
145            reinplace "1 i \\                             
146                #define SVN_REVISION \"${svn.revision}\"
147            " ${worksrcpath}/tools/clang/lib/Basic/Version.cpp
148        }
149    }
150}
151if {${subport} eq "lldb-${llvm_version}"} {
152    # lldb needs the clang sources present, so we apply the applicable patches.
153    patchfiles-append \
154        1001-MacPorts-Only-Prepare-clang-format-for-replacement-w.patch \
155        1002-MacPorts-Only-Fix-name-of-scan-view-executable-insid.patch \
156        1003-Default-to-ppc7400-for-OSX-10.5.patch \
157        1004-Only-call-setpriority-PRIO_DARWIN_THREAD-0-PRIO_DARW.patch \
158        1005-Default-to-fragile-ObjC-runtime-when-targeting-darwi.patch \
159        openmp-locations.patch
160
161    # https://llvm.org/bugs/show_bug.cgi?id=25681
162    if {${worksrcdir} eq "trunk" || ${worksrcdir} eq "release_${llvm_version_no_dot}"} {
163        # Cannot set cppflags due to https://cmake.org/Bug/view.php?id=12928
164        # Cannot set cxxflags due to https://llvm.org/bugs/show_bug.cgi?id=25904
165        #configure.cxxflags-append -DSVN_REVISION='"${svn.revision}"'
166
167        post-patch {
168            reinplace "1 i \\                             
169                #define SVN_REVISION \"${svn.revision}\"
170            " ${worksrcpath}/tools/clang/lib/Basic/Version.cpp
171        }
172    }
173}
174
175configure.post_args         ../${worksrcdir}
176default configure.dir       {${workpath}/build}
177default build.dir           {${workpath}/build}
178
179# https://llvm.org/bugs/show_bug.cgi?id=25664
180configure.ldflags-append    -Wl,-rpath,@loader_path
181
182# https://trac.macports.org/ticket/51542
183configure.ldflags-append    -Wl,-rpath,@loader_path/
184
185configure.args-append \
186    -DLLVM_LINK_LLVM_DYLIB=ON \
187    -DCMAKE_INSTALL_PREFIX="${sub_prefix}" \
188    -DLLVM_ENABLE_ASSERTIONS=OFF \
189    -DLLVM_ENABLE_RTTI=ON \
190    -DLLVM_INCLUDE_TESTS=OFF \
191    -DLLVM_INCLUDE_EXAMPLES=OFF \
192    -DLLVM_ENABLE_FFI=ON \
193    -DLLVM_BINDINGS_LIST=none \
194    -DFFI_INCLUDE_DIR=${prefix}/include \
195    -DFFI_LIBRARY_DIR=${prefix}/lib
196
197if {${subport} eq "llvm-${llvm_version}"} {
198    select.group        llvm
199    select.file         ${filespath}/mp-${subport}
200} elseif {${subport} eq "clang-${llvm_version}"} {
201    select.group        clang
202    select.file         ${filespath}/mp-${subport}
203
204    configure.args-append \
205        -DCLANG_INCLUDE_TESTS=OFF \
206        -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
207        -DLLVM_BUILD_RUNTIME=ON \
208        -DLIBCXX_ENABLE_SHARED=OFF \
209        -DLIBCXX_INSTALL_LIBRARY=OFF
210
211    # TODO: libc++ shouldn't be built at all.
212    #       https://llvm.org/bugs/show_bug.cgi?id=25666
213
214    if {${os.major} <= 12} {
215        # We unfortunately don't have an option to just turn off tsan
216        # https://llvm.org/bugs/show_bug.cgi?id=27715
217        configure.args-append \
218            -DCOMPILER_RT_BUILD_SANITIZERS=OFF
219    }
220} elseif {${subport} eq "lldb-${llvm_version}"} {
221    #select.group        lldb
222    #select.file         ${filespath}/mp-${subport}
223
224    configure.args-append \
225        -DLLDB_CODESIGN_IDENTITY=- \
226        -DCLANG_ENABLE_ARCMT=OFF \
227        -DCLANG_INCLUDE_TESTS=OFF \
228        -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
229        -DLLVM_BUILD_RUNTIME=ON \
230        -DLIBCXX_ENABLE_SHARED=OFF \
231        -DLIBCXX_INSTALL_LIBRARY=OFF \
232        -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7 \
233        -DPYTHON_INCLUDE_DIR=${prefix}/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
234}
235
236# llvm-3.5 and later requires a C++11 runtime
237# XCode 4.3's clang (318.x) fails per https://trac.macports.org/ticket/44161
238# XCode 4.5's clang (421.11.66) fails due to http://llvm.org/bugs/show_bug.cgi?id=20184
239# Xcode 4.6.3's clang (425.0.28) fails due to http://trac.macports.org/ticket/46897
240# Xcode 4.6.3's clang (425.0.28) fails due to https://llvm.org/bugs/show_bug.cgi?id=30384
241compiler.blacklist *gcc* {clang < 500}
242
243if {${subport} eq "clang-${llvm_version}"} {
244    # Xcode 6.2's clang (600.0.57) fails due to https://llvm.org/bugs/show_bug.cgi?id=25753
245    # clang older than 3.5 fail due to https://llvm.org/bugs/show_bug.cgi?id=25753
246    compiler.blacklist-append {clang < 602} macports-clang-3.3 macports-clang-3.4
247 
248    # Remove this when loosening the blacklist above or when a newer base is released
249    compiler.fallback-append macports-clang-3.7 macports-clang-3.6 macports-clang-3.5
250
251    # Don't self-host.  We may have issues if we have a slightly newer llvm version that
252    # is not binary compatible with the older clang version we're trying to use.
253
254    compiler.blacklist-append macports-clang-${llvm_version}
255}
256
257# blacklist current and future versions if they're not available in order to
258# help break potential dependency cycles.
259foreach ver {devel} {
260    if {![file exists ${prefix}/bin/clang-mp-${ver}]} {
261        compiler.blacklist-append macports-clang-${ver}
262    }
263}
264
265platform darwin {
266    # Note that we are forcing this choice.  This means that anything linking
267    # against llvm-3.5 needs to also be using libc++.  This is possibly
268    # problematic, but luckily there is just a limited set of such dependents.
269
270    configure.cxx_stdlib libc++
271    depends_lib-append port:libcxx
272    supported_archs i386 x86_64
273
274    pre-fetch {
275        if {![file exists /usr/lib/libc++.dylib]} {
276            ui_error "$name requires a C++11 runtime, which your configuration does not allow"
277            error "unsupported configuration"
278        }
279    }
280}
281
282variant universal {
283    post-extract {
284        # workaround a bug in Apple's shipped gcc driver-driver, patched in
285        # ours with driverdriver-num_infiles.patch
286        if {${configure.compiler} eq "gcc-4.0" ||
287            ${configure.compiler} eq "gcc-4.2" ||
288            ${configure.compiler} eq "llvm-gcc-4.2"} {
289            system "echo \"static int ___ignoreme;\" > ${worksrcpath}/tools/llvm-shlib/ignore.c"
290        }
291    }
292}
293
294variant assertions description "Enable assertions for error detection (has performance impacts, especially on JIT)" {
295    configure.args-delete -DLLVM_ENABLE_ASSERTIONS=OFF
296    configure.args-append -DLLVM_ENABLE_ASSERTIONS=ON
297}
298
299platform darwin {
300    if {[string match "*ppc*" [get_canonical_archs]]} {
301        # http://trac.macports.org/ticket/33987
302        configure.optflags    -Os
303    }
304
305    if {${subport} eq "clang-${llvm_version}" && [vercmp $xcodeversion 5.0] < 0} {
306        # https://llvm.org/bugs/show_bug.cgi?id=13671
307        patchfiles-append leopard-no-asan.patch
308        configure.args-append -DCOMPILER_RT_BUILD_SANITIZERS=OFF
309    }
310
311    if {${subport} eq "clang-${llvm_version}" && ${os.major} <= 9} {
312        patchfiles-append leopard-no-blocks.patch
313    }
314
315    if {${os.major} < 11} {
316        # Proxy for eliminating the dependency on native TLS
317        # http://trac.macports.org/ticket/46887
318        configure.args-append -DLLVM_ENABLE_BACKTRACES=OFF
319
320        # https://llvm.org/bugs/show_bug.cgi?id=25680
321        configure.cxxflags-append -U__STRICT_ANSI__
322    }
323
324    # https://llvm.org/bugs/show_bug.cgi?id=25674
325    configure.cxxflags-append -std=c++11
326}
327
328post-extract {
329    # Get HTTP proxy arguments if required, assuming we can use the same proxy for all repositories
330    set proxy_args [portfetch::svn_proxy_args https://llvm.org/svn/llvm-project/cfe/trunk]
331    if {${subport} eq "llvm-${llvm_version}"} {
332        if {[variant_isset polly]} {
333            if {${worksrcdir} eq "trunk"} {
334                system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/polly/trunk polly"
335            } elseif {${worksrcdir} eq "release_${llvm_version_no_dot}" } {
336                system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/polly/branches/release_${llvm_version_no_dot} polly"
337            } else {
338                file rename ${workpath}/polly-${version}.src ${worksrcpath}/tools/polly
339            }
340        }
341    } elseif {${subport} eq "clang-${llvm_version}"} {
342        if {${worksrcdir} eq "trunk"} {
343            system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/cfe/trunk clang"
344            system -W ${worksrcpath}/projects "svn ${proxy_args} co -r ${compiler_rt_rev} https://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt"
345            system -W ${worksrcpath}/projects "svn ${proxy_args} co -r ${libcxx_rev} https://llvm.org/svn/llvm-project/libcxx/trunk libcxx"
346            system -W ${worksrcpath}/tools/clang/tools "svn ${proxy_args} co -r ${clang-modernize_rev} https://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra"
347        } elseif {${worksrcdir} eq "release_${llvm_version_no_dot}" } {
348            system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/cfe/branches/release_${llvm_version_no_dot} clang"
349            system -W ${worksrcpath}/projects "svn ${proxy_args} co -r ${compiler_rt_rev} https://llvm.org/svn/llvm-project/compiler-rt/branches/release_${llvm_version_no_dot} compiler-rt"
350            system -W ${worksrcpath}/projects "svn ${proxy_args} co -r ${libcxx_rev} https://llvm.org/svn/llvm-project/libcxx/branches/release_${llvm_version_no_dot} libcxx"
351            system -W ${worksrcpath}/tools/clang/tools "svn ${proxy_args} co -r ${clang-modernize_rev} https://llvm.org/svn/llvm-project/clang-tools-extra/branches/release_${llvm_version_no_dot} extra"
352        } else {
353            file rename ${workpath}/cfe-${version}.src ${worksrcpath}/tools/clang
354            file rename ${workpath}/compiler-rt-${version}.src ${worksrcpath}/projects/compiler-rt
355            file rename ${workpath}/libcxx-${version}.src ${worksrcpath}/projects/libcxx
356            file rename ${workpath}/clang-tools-extra-${version}.src ${worksrcpath}/tools/clang/tools/extra
357        }
358    } elseif {${subport} eq "lldb-${llvm_version}"} {
359        if {${worksrcdir} eq "trunk"} {
360            system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/cfe/trunk clang"
361            system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/lldb/trunk lldb"
362        } elseif {${worksrcdir} eq "release_${llvm_version_no_dot}" } {
363            system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/cfe/branches/release_${llvm_version_no_dot} clang"
364            system -W ${worksrcpath}/tools "svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/lldb/branches/release_${llvm_version_no_dot} lldb"
365        } else {
366            file rename ${workpath}/cfe-${version}.src ${worksrcpath}/tools/clang
367            file rename ${workpath}/lldb-${version}.src ${worksrcpath}/tools/lldb
368        }
369    }
370}
371
372if {${subport} eq "clang-${llvm_version}"} {
373    destroot {
374        system "cd ${destroot.dir}/tools/clang && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
375        system "cd ${destroot.dir}/projects/compiler-rt && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
376        system "cd ${destroot.dir}/projects/libcxx && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
377
378        delete ${destroot}${sub_prefix}/bin/clang
379        file rename ${destroot}${sub_prefix}/bin/clang-${clang_executable_version} ${destroot}${sub_prefix}/bin/clang
380    }
381}
382
383if {${subport} eq "lldb-${llvm_version}"} {
384    post-patch {
385        reinplace "s|@@PREFIX@@|${prefix}|" \
386            ${worksrcpath}/tools/clang/lib/Driver/Tools.cpp
387
388        reinplace "s|@CLANG_FORMAT_PATH@|${prefix}/bin/clang-format-${suffix}|g" \
389            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-bbedit.applescript \
390            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-diff.py            \
391            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-sublime.py         \
392            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.el                 \
393            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.py
394    }
395
396    build.dir   ${build.dir}/tools/lldb
397
398    destroot {
399        destroot.target     install/fast
400        system "cd ${destroot.dir} && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}"
401
402        foreach bin {lldb lldb-mi lldb-server} {
403            delete ${destroot}${sub_prefix}/bin/${bin}
404            file rename ${destroot}${sub_prefix}/bin/${bin}-${lldb_executable_version} ${destroot}${sub_prefix}/bin/${bin}
405        }
406
407        xinstall -m 755 -d ${destroot}${prefix}/share/doc/lldb-${llvm_version}
408        xinstall -m 644 ${worksrcpath}/tools/lldb/docs/code-signing.txt ${destroot}${prefix}/share/doc/lldb-${llvm_version}/
409    }
410    post-activate {
411        ui_msg "Please follow the instructions in ${prefix}/lldb-${llvm_version}/code-signing.txt and then codesign the debugserver with:"
412        ui_msg "   sudo codesign --force --deep --preserve-metadata=identifier,entitlements,resource-rules,requirements,flags,team-identifier --sign <identity> ${sub_prefix}/bin/debugserver"
413    }
414}
415
416post-destroot {
417    foreach bin [glob ${destroot}${sub_prefix}/bin/*] {
418        set bin_filename [string map "${sub_prefix} ${prefix}" ${bin}]-${suffix}
419        set exec_path [string map "${destroot}${sub_prefix} ${sub_prefix}" ${bin}]
420
421        xinstall -m 755 "${filespath}/llvm-bin" "${bin_filename}"
422        reinplace "s:EXEC_PATH:${exec_path}:" "${bin_filename}"
423    }
424
425    if {${subport} eq "llvm-${llvm_version}"} {
426        # r156389 (a5d2435409858728970202226d0bbbee508fe408) temporarilary removed llvm man pages
427        #foreach man [glob ${destroot}${sub_prefix}/share/man/man1/*.1] {
428        #    set basename [string map "${destroot}${sub_prefix}/share/man/man1/ {}" ${man}]
429        #    file rename ${man} ${destroot}${prefix}/share/man/man1/[string map ".1 -${suffix}.1" ${basename}]
430        #}
431
432        # https://llvm.org/bugs/show_bug.cgi?id=19465
433        if {[variant_isset polly]} {
434            ln -s LLVMPolly.so ${destroot}${sub_prefix}/lib/LLVMPolly.dylib
435        }
436    } elseif {${subport} eq "clang-${llvm_version}"} {
437        system "ditto ${worksrcpath}/projects/libcxx/include ${destroot}${sub_prefix}/lib/c++/v1"
438
439        # http://trac.macports.org/ticket/33207
440        ln -s ${prefix}/libexec/ld64/ld ${destroot}${sub_prefix}/bin/ld
441    } elseif {${subport} eq "lldb-${llvm_version}"} {
442        delete ${destroot}${prefix}/bin/debugserver-${suffix}
443    }
444}
445
446if {${subport} eq "llvm-${llvm_version}"} {
447    variant polly description {Provide the polly polyhedral optimizer} {}
448
449    # Unless upstream reverts to their old OCaml detection mechanism,
450    # this variant will be broken until #46161 is resolved.
451    variant ocaml description {Enable generation of OCaml binding} {
452        depends_lib-append   port:ocaml
453
454        configure.args-delete -DLLVM_BINDINGS_LIST=none
455        configure.args-append -DLLVM_BINDINGS_LIST=ocaml
456
457        destroot.args-append  OVERRIDE_libdir=${sub_prefix}/lib
458    }
459} elseif {${subport} eq "clang-${llvm_version}"} {
460    if {[variant_isset assertions]} {
461        # Need to match llvm +-assertions
462        require_active_variants port:llvm-${llvm_version} assertions
463    } else {
464        # Need to match llvm +-assertions
465        require_active_variants port:llvm-${llvm_version} {} assertions
466    }
467
468    variant analyzer description {Install clang static analyzer} {
469        configure.args-delete \
470            -DCLANG_ENABLE_STATIC_ANALYZER=OFF
471        configure.args-append \
472            -DCLANG_ENABLE_STATIC_ANALYZER=ON
473
474        depends_run-append port:perl5
475
476        post-patch {
477            reinplace "s|/usr/bin/env perl|${prefix}/bin/perl5|g" \
478                ${worksrcpath}/tools/clang/tools/scan-build/libexec/ccc-analyzer \
479                ${worksrcpath}/tools/clang/tools/scan-build/libexec/c++-analyzer \
480                ${worksrcpath}/tools/clang/tools/scan-build/bin/scan-build
481            reinplace "s|/usr/bin/env python|${prefix}/bin/python2.7|g" \
482                ${worksrcpath}/tools/clang/tools/scan-build/bin/set-xcode-analyzer \
483                ${worksrcpath}/tools/clang/tools/scan-view/bin/scan-view
484        }
485    }
486
487    post-patch {
488        reinplace "s|@@PREFIX@@|${prefix}|" \
489            ${worksrcpath}/tools/clang/lib/Driver/Tools.cpp
490
491        reinplace "s|@CLANG_FORMAT_PATH@|${prefix}/bin/clang-format-${suffix}|g" \
492            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-bbedit.applescript \
493            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-diff.py            \
494            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-sublime.py         \
495            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.el                 \
496            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.py
497    }
498
499    post-destroot {
500        file mkdir ${destroot}${sub_prefix}/libexec
501        file copy ${worksrcpath}/tools/clang/tools/clang-format ${destroot}${sub_prefix}/libexec/clang-format
502
503        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/.svn
504        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/Makefile
505        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/Release+Debug+Asserts
506        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/CMakeLists.txt
507        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/ClangFormat.cpp
508    }
509}
510
511livecheck.type          none
Note: See TracBrowser for help on using the repository browser.