<!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>[148218] trunk/dports/lang/phobos</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/148218">148218</a></dd>
<dt>Author</dt> <dd>mcalhoun@macports.org</dd>
<dt>Date</dt> <dd>2016-04-30 08:38:59 -0700 (Sat, 30 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>phobos: allow universal build</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportslangphobosPortfile">trunk/dports/lang/phobos/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportslangphobosfilesmakefile_macports_install">trunk/dports/lang/phobos/files/makefile_macports_install</a></li>
<li><a href="#trunkdportslangphobosfilespatchposixdiff">trunk/dports/lang/phobos/files/patch-posix.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportslangphobosPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/lang/phobos/Portfile (148217 => 148218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/lang/phobos/Portfile        2016-04-30 15:35:29 UTC (rev 148217)
+++ trunk/dports/lang/phobos/Portfile        2016-04-30 15:38:59 UTC (rev 148218)
</span><span class="lines">@@ -3,6 +3,8 @@
</span><span class="cx"> 
</span><span class="cx"> PortSystem          1.0
</span><span class="cx"> PortGroup           github 1.0
</span><ins>+PortGroup           muniversal 1.0
+PortGroup           active_variants 1.1
</ins><span class="cx"> 
</span><span class="cx"> github.setup        D-Programming-Language phobos 2.069.2 v
</span><span class="cx"> categories          lang
</span><span class="lines">@@ -19,39 +21,70 @@
</span><span class="cx"> 
</span><span class="cx"> depends_lib         port:druntime
</span><span class="cx"> 
</span><del>-patchfiles          patch-gzlib.c.diff
</del><ins>+patchfiles          patch-gzlib.c.diff \
+                    patch-posix.diff
</ins><span class="cx"> 
</span><span class="cx"> use_configure       no
</span><span class="cx"> 
</span><del>-if {${build_arch} eq &quot;x86_64&quot;} {
-    set model 64
-} else {
-    set model 32
</del><ins>+post-extract {
+    xinstall -m 0644 ${filespath}/makefile_macports_install ${build.dir}
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+post-patch {
+    reinplace &quot;s|__MACPORTS_CFLAGS__|${configure.cflags}|g&quot; \
+        ${worksrcpath}/posix.mak
+}
+
+pre-configure {
+    # dmd compiler can not handle universal files, so create thin versions of archive files from libdruntime.a
+    if { ![variant_isset universal] } {
+        set all_archs ${build_arch}
+    } else {
+        set all_archs ${universal_archs}
+    }
+    foreach arch ${all_archs} {
+        file mkdir ${workpath}/druntime/${arch}
+    }
+    if {[active_variants port:druntime universal &quot;&quot;]} {
+        # libdruntime.a is universal, so create a thin version
+        foreach arch ${all_archs} {
+            system \
+                -W ${workpath}/druntime/${arch} \
+                &quot;/usr/bin/lipo -thin ${arch} ${prefix}/lib/libdruntime.a -output libdruntime.a&quot;
+        }
+    } else {
+        # libdruntime.a is NOT universal, so just copy it
+        foreach arch ${all_archs} {
+            file copy ${prefix}/lib/libdruntime.a ${workpath}/druntime/${arch}/libdruntime.a
+        }
+    }
+}
+
</ins><span class="cx"> pre-build {
</span><span class="cx">     file mkdir ${workpath}/dmd
</span><span class="cx">     system &quot;echo ${version} &gt; ${workpath}/dmd/VERSION&quot;
</span><span class="cx"> }
</span><span class="cx"> build.args          -f posix.mak \
</span><del>-                    DRUNTIME=${prefix}/lib/libdruntime.a \
</del><span class="cx">                     DRUNTIME_PATH=${prefix}/include/druntime \
</span><span class="cx">                     CC=${configure.cc} \
</span><del>-                    CFLAGS=&quot;${configure.cppflags} ${configure.cflags} [get_canonical_archflags cc]&quot; \
-                    DMD=${prefix}/bin/dmd \
-                    DFLAGS=&quot;-w -d -m${model} -O -release&quot; \
-                    MODEL=${model}
</del><ins>+                    DMD=${prefix}/bin/dmd
</ins><span class="cx"> build.target        &quot;&quot;
</span><span class="cx"> 
</span><del>-destroot {
-    xinstall -m 755 -d ${destroot}${prefix}/lib
-    xinstall -m 644 ${worksrcpath}/generated/osx/release/${model}/lib${name}2.a \
-        ${destroot}${prefix}/lib
-    xinstall -d -m 755 ${destroot}${prefix}/include
-    xinstall -d -m 755 ${destroot}${prefix}/include/${name}
-    eval xinstall -m 644 [glob ${worksrcpath}/*.d] ${destroot}${prefix}/include/${name}
-    file copy ${worksrcpath}/etc ${destroot}${prefix}/include/${name}
-    file copy ${worksrcpath}/std ${destroot}${prefix}/include/${name}
</del><ins>+if { ![variant_isset universal] } {
+    if { ${build_arch} eq &quot;x86_64&quot; || ${build_arch} eq &quot;ppc64&quot; } {
+        build.args-append MODEL=64 DRUNTIME=${workpath}/druntime/${build_arch}/libdruntime.a
+    } else {
+        build.args-append MODEL=32 DRUNTIME=${workpath}/druntime/${build_arch}/libdruntime.a
+    }
+} else {
+    lappend merger_build_args(x86_64) MODEL=64 DRUNTIME=${workpath}/druntime/x86_64/libdruntime.a
+    lappend merger_build_args(i386)   MODEL=32 DRUNTIME=${workpath}/druntime/i386/libdruntime.a
+    lappend merger_build_args(ppc64)  MODEL=64 DRUNTIME=${workpath}/druntime/ppc64/libdruntime.a
+    lappend merger_build_args(ppc)    MODEL=32 DRUNTIME=${workpath}/druntime/ppc/libdruntime.a
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+destroot.args \
+    -f makefile_macports_install \
+    PREFIX=${prefix}
+
</ins><span class="cx"> livecheck.regex     archive/[join ${github.tag_prefix} &quot;&quot;](\[^&quot;-\]+)${extract.suffix}
</span></span></pre></div>
<a id="trunkdportslangphobosfilesmakefile_macports_install"></a>
<div class="addfile"><h4>Added: trunk/dports/lang/phobos/files/makefile_macports_install (0 => 148218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/lang/phobos/files/makefile_macports_install                                (rev 0)
+++ trunk/dports/lang/phobos/files/makefile_macports_install        2016-04-30 15:38:59 UTC (rev 148218)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+# -*- mode: makefile -*-
+
+INSTALL=/usr/bin/install
+DCOPY=/bin/cp -r
+
+install:
+        $(INSTALL) -m 755 -d $(DESTDIR)$(PREFIX)/lib
+        $(INSTALL) -m 644 generated/osx/release/*/*.a \
+                $(DESTDIR)$(PREFIX)/lib
+        $(INSTALL) -d -m 755 $(DESTDIR)$(PREFIX)/include
+        $(INSTALL) -d -m 755 $(DESTDIR)$(PREFIX)/include/phobos
+        $(INSTALL) -m 644 *.d $(DESTDIR)$(PREFIX)/include/phobos
+        $(DCOPY) etc $(DESTDIR)$(PREFIX)/include/phobos
+        $(DCOPY) std $(DESTDIR)$(PREFIX)/include/phobos
</ins></span></pre></div>
<a id="trunkdportslangphobosfilespatchposixdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/lang/phobos/files/patch-posix.diff (0 => 148218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/lang/phobos/files/patch-posix.diff                                (rev 0)
+++ trunk/dports/lang/phobos/files/patch-posix.diff        2016-04-30 15:38:59 UTC (rev 148218)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+--- posix.mak.orig        2015-11-29 14:40:29.000000000 -0700
++++ posix.mak        2016-04-30 05:43:27.000000000 -0700
+@@ -96,7 +96,7 @@
+ ifeq ($(BUILD),debug)
+         CFLAGS += -g
+ else
+-        CFLAGS += -O3
++        CFLAGS += __MACPORTS_CFLAGS__
+ endif

+ # Set DFLAGS
</ins></span></pre>
</div>
</div>

</body>
</html>