1 | # -*- 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 |
---|
2 | # $Id:$ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup cmake 1.0 |
---|
6 | PortGroup github 1.0 |
---|
7 | |
---|
8 | github.setup KDE clazy 3bf56cbf65f5b6fa9ba1defba3f2f770b88a9548 |
---|
9 | fetch.type git |
---|
10 | |
---|
11 | name clazy |
---|
12 | version 0 |
---|
13 | categories devel |
---|
14 | maintainers gmail.com:rjvbertin |
---|
15 | license GPL-2 |
---|
16 | description Qt oriented code checker based on LLVM. |
---|
17 | long_description The clazy static checker provides an LLVM plugin that can check and sometimes fix issues in C++ code. \ |
---|
18 | The included checks are oriented at development using Qt. |
---|
19 | platforms darwin |
---|
20 | |
---|
21 | # fetching via git means a more convenient constant distname can be used. |
---|
22 | distname ${name}-git |
---|
23 | checksums rmd160 e7d71b5ead2e2a79e16af8a9cace4656061b278a \ |
---|
24 | sha256 13781f00ce90b4abdc6441033e1b2e9f9854b862b3adfe1674a2c61c6cd7b889 |
---|
25 | |
---|
26 | variant system_cxx description {build using the system C++ compiler instead of the target clang++ version} {} |
---|
27 | |
---|
28 | patchfiles-append patch-CMakeLists.diff \ |
---|
29 | patch-wrapper.diff |
---|
30 | |
---|
31 | cmake.out_of_source yes |
---|
32 | |
---|
33 | # define subports for the supported/available Clang versions. Those are not complete |
---|
34 | # definitions, post-patch and post-destroot operations have to be done outside of |
---|
35 | # the definition loop. |
---|
36 | foreach lv {3.6 3.7 3.8} { |
---|
37 | subport ${name}-${lv} { |
---|
38 | depends_lib-append \ |
---|
39 | port:llvm-${lv} port:clang-${lv} |
---|
40 | configure.args-append \ |
---|
41 | -DLLVM_ROOT=${prefix}/libexec/llvm-${lv} |
---|
42 | if {![variant_isset system_cxx]} { |
---|
43 | configure.args-append \ |
---|
44 | -DCMAKE_C_COMPILER=${prefix}/bin/clang-mp-${lv} \ |
---|
45 | -DCMAKE_CXX_COMPILER=${prefix}/bin/clang++-mp-${lv} |
---|
46 | } |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | if {${subport} eq "${name}"} { |
---|
51 | pre-fetch { |
---|
52 | ui_error "This port provides the LLVM version-specific subports and is not supposed to be installed" |
---|
53 | return -code error "This port is not installable" |
---|
54 | } |
---|
55 | } else { |
---|
56 | array set lip { |
---|
57 | clazy-3.6 libexec/llvm-3.6 |
---|
58 | clazy-3.7 libexec/llvm-3.7 |
---|
59 | clazy-3.8 libexec/llvm-3.8 |
---|
60 | } |
---|
61 | array set ccxx { |
---|
62 | clazy-3.6 clang++-mp-3.6 |
---|
63 | clazy-3.7 clang++-mp-3.7 |
---|
64 | clazy-3.8 clang++-mp-3.8 |
---|
65 | } |
---|
66 | post-patch { |
---|
67 | # cmake's "find_package(clang ...)" command will provide an LLVM_INSTALL_PREFIX |
---|
68 | # variable, but that variable will be the normalised (resolved) full path if ever |
---|
69 | # ${prefix} is a symlink to, say, a directory on a different partition. |
---|
70 | # Ultimately the ClangClazy plugin would end up at the same location, but "base" |
---|
71 | # will complain about a destroot violation. |
---|
72 | # We avoid this by ensuring the file gets installed going through the symlink. |
---|
73 | # This is done outside of the subport-definition loop above because that would |
---|
74 | # set the install prefix to the one for the last defined subport ... |
---|
75 | if {[info exists lip(${subport})]} { |
---|
76 | reinplace "s|@LLVM_INSTALL_PREFIX@|${prefix}/$lip(${subport})|g" \ |
---|
77 | ${worksrcpath}/CMakeLists.txt |
---|
78 | } else { |
---|
79 | # this should only happen when a subport for a clang version was added or removed |
---|
80 | # above, and $lip wasn't updated. |
---|
81 | ui_error "post-patch for unknown subport ${subport}" |
---|
82 | return -code error "outdated Portfile" |
---|
83 | } |
---|
84 | } |
---|
85 | post-destroot { |
---|
86 | # reuse $lip(${subport}) without further need for testing if it exists |
---|
87 | system "install_name_tool -id ${prefix}/$lip(${subport})/lib/ClangLazy.dylib \ |
---|
88 | ${destroot}${prefix}/$lip(${subport})/lib/ClangLazy.dylib" |
---|
89 | reinplace "s|@CLANGPP@|$ccxx(${subport})|g" ${destroot}${prefix}/bin/clazy |
---|
90 | xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport} |
---|
91 | xinstall -m 644 ${worksrcpath}/README ${worksrcpath}/HOWTO \ |
---|
92 | ${destroot}${prefix}/share/doc/${subport} |
---|
93 | } |
---|
94 | } |
---|