<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[152453] trunk/dports/lang/llvm-devel/Portfile</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/152453">152453</a></dd>
<dt>Author</dt> <dd>jeremyhu@macports.org</dd>
<dt>Date</dt> <dd>2016-09-09 13:59:31 -0700 (Fri, 09 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>llvm-devel: Initial stab at an lldb subport (#45251)</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportslangllvmdevelPortfile">trunk/dports/lang/llvm-devel/Portfile</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportslangllvmdevelPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/lang/llvm-devel/Portfile (152452 => 152453)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/lang/llvm-devel/Portfile        2016-09-09 20:47:19 UTC (rev 152452)
+++ trunk/dports/lang/llvm-devel/Portfile        2016-09-09 20:59:31 UTC (rev 152453)
</span><span class="lines">@@ -12,9 +12,11 @@
</span><span class="cx"> set llvm_version        devel
</span><span class="cx"> set llvm_version_no_dot devel
</span><span class="cx"> set clang_executable_version 4.0
</span><ins>+set lldb_executable_version 4.0.0
</ins><span class="cx"> name                    llvm-${llvm_version}
</span><span class="cx"> revision                0
</span><span class="cx"> subport                 clang-${llvm_version} {}
</span><ins>+subport                 lldb-${llvm_version} {}
</ins><span class="cx"> set suffix              mp-${llvm_version}
</span><span class="cx"> set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
</span><span class="cx"> dist_subdir             llvm
</span><span class="lines">@@ -67,6 +69,20 @@
</span><span class="cx">     depends_lib-append  port:libedit port:libffi port:ncurses port:zlib
</span><span class="cx"> 
</span><span class="cx">     default_variants    +analyzer
</span><ins>+} elseif {${subport} eq &quot;lldb-${llvm_version}&quot;} {
+    homepage            http://lldb.llvm.org/
+    description         the LLVM debugger
+    long_description    Lldb is the &quot;LLVM native&quot; debugger.
+
+    depends_lib         port:libxml2 port:libomp port:llvm-${llvm_version} port:python27 \
+                        port:ncurses
+    depends_build-append port:cctools port:swig-python port:doxygen
+    depends_skip_archcheck-append cctools
+
+    # Clang doesn't actually use any of these, but the LLVM makefile
+    # system overlinks its binaries. Remove (or convert to build deps?)
+    # after #46040 is resolved.
+    depends_lib-append  port:libedit port:libffi port:ncurses port:zlib
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> fetch.type              svn
</span><span class="lines">@@ -98,6 +114,8 @@
</span><span class="cx">         }
</span><span class="cx">     } elseif {${subport} eq &quot;clang-${llvm_version}&quot;} {
</span><span class="cx">         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}
</span><ins>+    } elseif {${subport} eq &quot;lldb-${llvm_version}&quot;} {
+        distfiles-append     cfe-${version}.src${extract.suffix} lldb-${version}.src${extract.suffix}
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -135,7 +153,30 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+if {${subport} eq &quot;lldb-${llvm_version}&quot;} {
+    # lldb needs the clang sources present, so we apply the applicable patches.
+    patchfiles-append \
+        1001-MacPorts-Only-Prepare-clang-format-for-replacement-w.patch \
+        1002-MacPorts-Only-Fix-name-of-scan-view-executable-insid.patch \
+        1003-Default-to-ppc7400-for-OSX-10.5.patch \
+        1004-Only-call-setpriority-PRIO_DARWIN_THREAD-0-PRIO_DARW.patch \
+        1005-Default-to-fragile-ObjC-runtime-when-targeting-darwi.patch \
+        openmp-locations.patch
</ins><span class="cx"> 
</span><ins>+    # https://llvm.org/bugs/show_bug.cgi?id=25681
+    if {${worksrcdir} eq &quot;trunk&quot; || ${worksrcdir} eq &quot;release_${llvm_version_no_dot}&quot;} {
+        # Cannot set cppflags due to https://cmake.org/Bug/view.php?id=12928
+        # Cannot set cxxflags due to https://llvm.org/bugs/show_bug.cgi?id=25904
+        #configure.cxxflags-append -DSVN_REVISION='&quot;${svn.revision}&quot;'
+
+        post-patch {
+            reinplace &quot;1 i \\                             
+                #define SVN_REVISION \&quot;${svn.revision}\&quot;
+            &quot; ${worksrcpath}/tools/clang/lib/Basic/Version.cpp
+        }
+    }
+}
+
</ins><span class="cx"> configure.post_args         ../${worksrcdir}
</span><span class="cx"> default configure.dir       {${workpath}/build}
</span><span class="cx"> default build.dir           {${workpath}/build}
</span><span class="lines">@@ -181,6 +222,20 @@
</span><span class="cx">         configure.args-append \
</span><span class="cx">             -DCOMPILER_RT_BUILD_SANITIZERS=OFF
</span><span class="cx">     }
</span><ins>+} elseif {${subport} eq &quot;lldb-${llvm_version}&quot;} {
+    #select.group        lldb
+    #select.file         ${filespath}/mp-${subport}
+
+    configure.args-append \
+        -DLLDB_CODESIGN_IDENTITY=- \
+        -DCLANG_ENABLE_ARCMT=OFF \
+        -DCLANG_INCLUDE_TESTS=OFF \
+        -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
+        -DLLVM_BUILD_RUNTIME=ON \
+        -DLIBCXX_ENABLE_SHARED=OFF \
+        -DLIBCXX_INSTALL_LIBRARY=OFF \
+        -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7 \
+        -DPYTHON_INCLUDE_DIR=${prefix}/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # llvm-3.5 and later requires a C++11 runtime
</span><span class="lines">@@ -303,6 +358,17 @@
</span><span class="cx">             file rename ${workpath}/libcxx-${version}.src ${worksrcpath}/projects/libcxx
</span><span class="cx">             file rename ${workpath}/clang-tools-extra-${version}.src ${worksrcpath}/tools/clang/tools/extra
</span><span class="cx">         }
</span><ins>+    } elseif {${subport} eq &quot;lldb-${llvm_version}&quot;} {
+        if {${worksrcdir} eq &quot;trunk&quot;} {
+            system -W ${worksrcpath}/tools &quot;svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/cfe/trunk clang&quot;
+            system -W ${worksrcpath}/tools &quot;svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/lldb/trunk lldb&quot;
+        } elseif {${worksrcdir} eq &quot;release_${llvm_version_no_dot}&quot; } {
+            system -W ${worksrcpath}/tools &quot;svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/cfe/branches/release_${llvm_version_no_dot} clang&quot;
+            system -W ${worksrcpath}/tools &quot;svn ${proxy_args} co -r ${svn.revision} https://llvm.org/svn/llvm-project/lldb/branches/release_${llvm_version_no_dot} lldb&quot;
+        } else {
+            file rename ${workpath}/cfe-${version}.src ${worksrcpath}/tools/clang
+            file rename ${workpath}/lldb-${version}.src ${worksrcpath}/tools/lldb
+        }
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -317,6 +383,39 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+if {${subport} eq &quot;lldb-${llvm_version}&quot;} {
+    post-patch {
+        reinplace &quot;s|@@PREFIX@@|${prefix}|&quot; \
+            ${worksrcpath}/tools/clang/lib/Driver/Tools.cpp
+
+        reinplace &quot;s|@CLANG_FORMAT_PATH@|${prefix}/bin/clang-format-${suffix}|g&quot; \
+            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-bbedit.applescript \
+            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-diff.py            \
+            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-sublime.py         \
+            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.el                 \
+            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.py
+    }
+
+    build.dir   ${build.dir}/tools/lldb
+
+    destroot {
+        destroot.target     install/fast
+        system &quot;cd ${destroot.dir} &amp;&amp; ${destroot.cmd} ${destroot.pre_args} ${destroot.target} ${destroot.post_args}&quot;
+
+        foreach bin {lldb lldb-mi lldb-server} {
+            delete ${destroot}${sub_prefix}/bin/${bin}
+            file rename ${destroot}${sub_prefix}/bin/${bin}-${lldb_executable_version} ${destroot}${sub_prefix}/bin/${bin}
+        }
+
+        xinstall -m 755 -d ${destroot}${prefix}/share/doc/lldb-${llvm_version}
+        xinstall -m 644 ${worksrcpath}/tools/lldb/docs/code-signing.txt ${destroot}${prefix}/share/doc/lldb-${llvm_version}/
+    }
+    post-activate {
+        ui_msg &quot;Please follow the instructions in ${prefix}/lldb-${llvm_version}/code-signing.txt and then codesign the debugserver with:&quot;
+        ui_msg &quot;   sudo codesign --force --deep --preserve-metadata=identifier,entitlements,resource-rules,requirements,flags,team-identifier --sign &lt;identity&gt; ${sub_prefix}/bin/debugserver&quot;
+    }
+}
+
</ins><span class="cx"> post-destroot {
</span><span class="cx">     foreach bin [glob ${destroot}${sub_prefix}/bin/*] {
</span><span class="cx">         set bin_filename [string map &quot;${sub_prefix} ${prefix}&quot; ${bin}]-${suffix}
</span><span class="lines">@@ -342,6 +441,8 @@
</span><span class="cx"> 
</span><span class="cx">         # http://trac.macports.org/ticket/33207
</span><span class="cx">         ln -s ${prefix}/libexec/ld64/ld ${destroot}${sub_prefix}/bin/ld
</span><ins>+    } elseif {${subport} eq &quot;lldb-${llvm_version}&quot;} {
+        delete ${destroot}${prefix}/bin/debugserver-${suffix}
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>