| 73 | } elseif {${subport} eq "lldb-${llvm_version}"} { |
| 74 | homepage http://lldb.llvm.org/ |
| 75 | description the LLVM debugger |
| 76 | long_description Lldb is the "LLVM native" debugger. |
| 77 | |
| 78 | depends_lib port:libxml2 port:libomp port:llvm-${llvm_version} port:python27 \ |
| 79 | port:ncurses |
| 80 | depends_build-append port:cctools port:swig-python port:doxygen |
| 81 | depends_skip_archcheck-append cctools |
| 82 | |
| 83 | # Clang doesn't actually use any of these, but the LLVM makefile |
| 84 | # system overlinks its binaries. Remove (or convert to build deps?) |
| 85 | # after #46040 is resolved. |
| 86 | depends_lib-append port:libedit port:libffi port:ncurses port:zlib |
| 186 | if {${subport} eq "lldb-${llvm_version}"} { |
| 187 | # lldb needs the clang sources present, so we apply the applicable patches. |
| 188 | patchfiles-append \ |
| 189 | 1001-MacPorts-Only-Prepare-clang-format-for-replacement-w.patch \ |
| 190 | 1002-MacPorts-Only-Fix-name-of-scan-view-executable-insid.patch \ |
| 191 | 1003-Default-to-ppc7400-for-OSX-10.5.patch \ |
| 192 | 1004-Only-call-setpriority-PRIO_DARWIN_THREAD-0-PRIO_DARW.patch \ |
| 193 | 1005-Default-to-fragile-ObjC-runtime-when-targeting-darwi.patch \ |
| 194 | openmp-locations.patch |
| 195 | |
| 196 | # https://llvm.org/bugs/show_bug.cgi?id=25681 |
| 197 | if {${worksrcdir} eq "trunk" || ${worksrcdir} eq "release_${llvm_version_no_dot}"} { |
| 198 | # Cannot set cppflags due to https://cmake.org/Bug/view.php?id=12928 |
| 199 | # Cannot set cxxflags due to https://llvm.org/bugs/show_bug.cgi?id=25904 |
| 200 | #configure.cxxflags-append -DSVN_REVISION='"${svn.revision}"' |
| 201 | |
| 202 | post-patch { |
| 203 | reinplace "1 i \\ |
| 204 | #define SVN_REVISION \"${svn.revision}\" |
| 205 | " ${worksrcpath}/tools/clang/lib/Basic/Version.cpp |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | # we'll need to codesign the debugserver executable, but we'll do that |
| 210 | # in the post-activate step. |
| 211 | patchfiles-append patch-no-codesign-3.9.diff |
| 212 | } |
| 213 | patchfiles-append patch-accept-build_types.diff |
| 260 | } elseif {${subport} eq "lldb-${llvm_version}"} { |
| 261 | select.group lldb |
| 262 | select.file ${filespath}/mp-${subport} |
| 263 | |
| 264 | configure.args-append \ |
| 265 | -DCLANG_ENABLE_ARCMT=OFF \ |
| 266 | -DCLANG_INCLUDE_TESTS=OFF \ |
| 267 | -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ |
| 268 | -DLLVM_BUILD_RUNTIME=ON \ |
| 269 | -DLIBCXX_ENABLE_SHARED=OFF \ |
| 270 | -DLIBCXX_INSTALL_LIBRARY=OFF \ |
| 271 | -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7 \ |
| 272 | -DPYTHON_INCLUDE_DIR=${prefix}/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 |
| 273 | if {${os.major} <= 12} { |
| 274 | # We unfortunately don't have an option to just turn off tsan |
| 275 | # https://llvm.org/bugs/show_bug.cgi?id=27715 |
| 276 | configure.args-append \ |
| 277 | -DCOMPILER_RT_BUILD_SANITIZERS=OFF |
| 278 | } |
| 342 | if {${subport} ne "lldb-${llvm_version}"} { |
| 343 | variant static_libllvm description "Don't build the shared libLLVM.dylib, for instance to get a standalone redistributable libclang" { |
| 344 | configure.args-delete -DLLVM_LINK_LLVM_DYLIB=ON |
| 345 | configure.args-append -DLLVM_LINK_LLVM_DYLIB=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF |
| 346 | } |
| 347 | |
| 348 | variant nortti description "Don't build with internal RTTI support (increases compilation performance somewhat)" { |
| 349 | configure.args-delete -DLLVM_ENABLE_RTTI=ON |
| 350 | configure.args-append -DLLVM_ENABLE_RTTI=OFF |
| 351 | } |
| 352 | } |
| 353 | |
| 432 | if {![variant_isset static_libllvm]} { |
| 433 | # this is not a build that aims to be (more easily) relocatable |
| 434 | system "install_name_tool -id ${sub_prefix}/lib/libclang.dylib ${destroot}${sub_prefix}/lib/libclang.dylib" |
| 435 | system "install_name_tool -change @rpath/libLLVM.dylib ${sub_prefix}/lib/libLLVM.dylib ${destroot}${sub_prefix}/lib/libclang.dylib" |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | if {${subport} eq "lldb-${llvm_version}"} { |
| 441 | post-patch { |
| 442 | reinplace "s|@@PREFIX@@|${prefix}|" \ |
| 443 | ${worksrcpath}/tools/clang/lib/Driver/Tools.cpp |
| 444 | |
| 445 | reinplace "s|@CLANG_FORMAT_PATH@|${prefix}/bin/clang-format-${suffix}|g" \ |
| 446 | ${worksrcpath}/tools/clang/tools/clang-format/clang-format-bbedit.applescript \ |
| 447 | ${worksrcpath}/tools/clang/tools/clang-format/clang-format-diff.py \ |
| 448 | ${worksrcpath}/tools/clang/tools/clang-format/clang-format-sublime.py \ |
| 449 | ${worksrcpath}/tools/clang/tools/clang-format/clang-format.el \ |
| 450 | ${worksrcpath}/tools/clang/tools/clang-format/clang-format.py |
| 451 | } |
| 452 | |
| 453 | build.dir ${build.dir}/tools/lldb |
| 454 | |
| 455 | destroot { |
| 456 | destroot.target install/fast |
| 457 | system "cd ${destroot.dir} && ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}" |
| 458 | |
| 459 | foreach bin {lldb lldb-mi lldb-server} { |
| 460 | delete ${destroot}${sub_prefix}/bin/${bin} |
| 461 | file rename ${destroot}${sub_prefix}/bin/${bin}-${version} ${destroot}${sub_prefix}/bin/${bin} |
| 462 | } |
| 463 | # this is not a build that aims to be (more easily) relocatable |
| 464 | system "install_name_tool -id ${sub_prefix}/lib/liblldb.dylib ${destroot}${sub_prefix}/lib/liblldb.dylib" |
| 465 | system "install_name_tool -change @rpath/libLLVM.dylib ${sub_prefix}/lib/libLLVM.dylib ${destroot}${sub_prefix}/lib/liblldb.dylib" |
| 466 | xinstall -m 755 -d ${destroot}${prefix}/share/doc/lldb-${llvm_version} |
| 467 | xinstall -m 644 ${worksrcpath}/tools/lldb/docs/code-signing.txt ${destroot}${prefix}/share/doc/lldb-${llvm_version}/ |
| 468 | } |
| 469 | post-activate { |
| 470 | if {[codesign ${sub_prefix}/bin/debugserver lldb_codesign] ne 0} { |
| 471 | ui_msg "Please follow the instructions in ${prefix}/lldb-${llvm_version}/code-signing.txt and then reinstall this port" |
| 472 | } |