<!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>[76869] trunk/dports/python/py27-numpy</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="http://trac.macports.org/changeset/76869">76869</a></dd>
<dt>Author</dt> <dd>vince@macports.org</dd>
<dt>Date</dt> <dd>2011-03-11 08:42:54 -0800 (Fri, 11 Mar 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Allow a two-way universal build based on Atlas (+universal +atlas).
This should solve #28346 #27773 #28118 and #28454</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportspythonpy27numpyPortfile">trunk/dports/python/py27-numpy/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportspythonpy27numpyfileswrappertemplate">trunk/dports/python/py27-numpy/files/wrapper-template</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportspythonpy27numpyPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/python/py27-numpy/Portfile (76868 => 76869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/python/py27-numpy/Portfile  2011-03-11 16:41:31 UTC (rev 76868)
+++ trunk/dports/python/py27-numpy/Portfile     2011-03-11 16:42:54 UTC (rev 76869)
</span><span class="lines">@@ -54,20 +54,25 @@
</span><span class="cx"> # the +atlas variant) ...
</span><span class="cx"> set gcc_version ""
</span><span class="cx"> if {[variant_isset atlas]} {
</span><del>-    universal_variant no
</del><span class="cx"> 
</span><span class="cx">     # see if the user has set -gcc4X to disable using MacPorts'
</span><span class="cx">     # compiler; if not, either use what the user set (as +gcc4X) or
</span><span class="cx">     # default to gcc44.
</span><span class="cx"> 
</span><span class="cx">     variant gcc43 conflicts gcc44 gcc45 \
</span><del>-    description {Use the gcc43 compiler (enables fortran linking)} {}
</del><ins>+    description {Use the gcc43 compiler (enables fortran linking)} {
+       configure.compiler      macports-gcc-4.3
+    }
</ins><span class="cx"> 
</span><span class="cx">     variant gcc44 conflicts gcc43 gcc45 \
</span><del>-    description {Use the gcc44 compiler (enables fortran linking)} {}
</del><ins>+    description {Use the gcc44 compiler (enables fortran linking)} {
+       configure.compiler      macports-gcc-4.4
+    }
</ins><span class="cx"> 
</span><span class="cx">     variant gcc45 conflicts gcc43 gcc44 \
</span><del>-    description {Use the gcc45 compiler (enables fortran linking)} {}
</del><ins>+    description {Use the gcc45 compiler (enables fortran linking)} {
+       configure.compiler      macports-gcc-4.5
+    }
</ins><span class="cx"> 
</span><span class="cx">     if {![variant_isset gcc43] && ![variant_isset gcc45]} {
</span><span class="cx">         default_variants +gcc44
</span><span class="lines">@@ -115,14 +120,52 @@
</span><span class="cx">     reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
</span><span class="cx">         ${worksrcpath}/numpy/f2py/setup.py
</span><span class="cx"> 
</span><del>-    # disallow searching for any fortran executable except what is
-    # specified in this Portfile; NOTE: this change only works when
-    # setting the GCC version; if this flag is not set (meaning no
-    # +gcc4X variant is set), then F2PY may or not work.
-    if {${gcc_version} != ""} {
-        # set which fortran to use in the f2py Python scripts
-        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
-    }
</del><ins>+        if {[variant_isset universal] && [variant_isset atlas]} {
+               # Prepare wrappers
+               file copy -force ${filespath}/wrapper-template \
+                       ${worksrcpath}/c-wrapper
+               file copy -force ${filespath}/wrapper-template \
+                       ${worksrcpath}/f-wrapper
+               file copy -force ${filespath}/wrapper-template \
+                       ${worksrcpath}/cxx-wrapper
+
+               if {[variant_isset gcc43]} {
+                       set CC  "${prefix}/bin/gcc-mp-4.3"
+                       set CXX "${prefix}/bin/g++-mp-4.3"
+                       set F90 "${prefix}/bin/gfortran-mp-4.3"
+               } elseif {[variant_isset gcc44]} {
+                       set CC  "${prefix}/bin/gcc-mp-4.4"
+                       set CXX "${prefix}/bin/g++-mp-4.4"
+                       set F90 "${prefix}/bin/gfortran-mp-4.4"
+               } elseif {[variant_isset gcc45]} {
+                       set CC  "${prefix}/bin/gcc-mp-4.5"
+                       set CXX "${prefix}/bin/g++-mp-4.5"
+                       set F90 "${prefix}/bin/gfortran-mp-4.5"
+               }
+       
+               reinplace       "s|@@@|${CC}|" ${worksrcpath}/c-wrapper
+               reinplace       "s|---|\\\\.c|" ${worksrcpath}/c-wrapper
+               reinplace       "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper
+               
+               reinplace       "s|@@@|${CXX}|" ${worksrcpath}/cxx-wrapper
+               reinplace       "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \
+                       ${worksrcpath}/cxx-wrapper
+               reinplace       "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper
+               
+               reinplace       "s|@@@|${F90}|" ${worksrcpath}/f-wrapper
+               reinplace       "s|---|\\\\.f|" ${worksrcpath}/f-wrapper
+               reinplace       "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper
+
+               build.env-append        CC="${worksrcpath}/c-wrapper" \
+                                                       CXX="${worksrcpath}/cxx-wrapper" \
+                                                       F77="${worksrcpath}/f-wrapper" \
+                                                       F90="${worksrcpath}/f-wrapper"
+
+               destroot.env-append     CC="${worksrcpath}/c-wrapper" \
+                                                       CXX="${worksrcpath}/cxx-wrapper" \
+                                                       F77="${worksrcpath}/f-wrapper" \
+                                                       F90="${worksrcpath}/f-wrapper"
+       }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> livecheck.type  regex
</span></span></pre></div>
<a id="trunkdportspythonpy27numpyfileswrappertemplate"></a>
<div class="addfile"><h4>Added: trunk/dports/python/py27-numpy/files/wrapper-template (0 => 76869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/python/py27-numpy/files/wrapper-template                            (rev 0)
+++ trunk/dports/python/py27-numpy/files/wrapper-template       2011-03-11 16:42:54 UTC (rev 76869)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+#!/bin/sh
+COMPILER='@@@'
+SUFFIX='---'
+PREFIX='&&&'
+OUTPUT_O='NO'
+OUTPUT=''
+NAMED_OUTPUT=''
+LASTFILE=''
+INTEL='NO'
+SIZE32='NO'
+SIZE64='NO'
+NEWARGS=''
+
+SKIP='NO'
+
+for arg in $@
+do
+       if [ $SKIP = 'ARCH' ]; then
+               # intercept -arch option and set SIZEXX
+               SKIP='NO'
+               if [ $arg = 'x86_64' ] || [ $arg = 'ppc64' ]; then
+                       SIZE64='YES'
+               else
+                       SIZE32='YES'
+               fi
+               
+               # which architecture are we compiling for?
+               if [ $arg = 'x86_64' ] || [ $arg = 'i386' ]; then
+                       INTEL='YES'
+               fi
+               
+       elif [ $arg = '-arch' ]; then
+               SKIP='ARCH'
+               
+       elif [ $arg = '--version' ]; then
+               ${COMPILER} --version
+               exit 0
+               
+       else
+               NEWARGS+="$arg "
+               
+               # if the -c option is given, the output is .o
+               if [ $arg = '-c' ]; then
+                       OUTPUT_O='YES'
+               fi
+
+               # if the output file is given by a -o option, record it
+               if [ $SKIP = 'O' ]; then
+                       SKIP='NO'
+                       NAMED_OUTPUT=$arg
+               fi
+               
+               if [ $arg = '-o' ]; then
+                       SKIP='O'
+               fi
+               
+               # Note each file ending by ${SUFFIX} and remember the last one
+               # Transform them in .o 
+               if `echo $arg | grep -q "${SUFFIX}$"`; then
+                       LASTFILE=$arg
+                       OUTPUT+=`echo $arg | sed "s/${SUFFIX}/\.o/"`
+                       OUTPUT+=' '
+               fi
+       fi
+done
+
+# What is the output?
+
+if [ ${NAMED_OUTPUT}"X" != "X" ]; then
+       OUTPUT=$NAMED_OUTPUT
+
+elif [ $OUTPUT_O = 'NO' ]; then
+       # It is an executable whose is name is the LASTFILE without suffix
+       OUTPUT=`echo ${LASTFILE} | sed "s/${SUFFIX}//"`
+fi
+
+# Othewise, the output is just the ${OUTPUT} variable as computed before
+
+# For some reason, -dynamiclib and -lpython2.6 are missing when linking
+# .so files. Add them, except if -bundle is set (incompatible switches)
+if [ `echo $OUTPUT | sed -E 's|.*\.||'` = "so" ] && \
+       ! `echo $NEWARGS | grep -q bundle`; then
+       NEWARGS="${NEWARGS} ${PREFIX}/lib/libpython2.6.dylib -dynamiclib"
+fi
+
+# Now, compile
+
+if [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'NO' ]; then
+       # No size indication given, just proceed with default
+       if `${COMPILER} $NEWARGS`; then
+               exit 0
+       else
+               exit 1
+       fi
+
+elif [ $SIZE32 = 'YES' ] && [ $SIZE64 = 'NO' ]; then
+       # 32-bit
+       if `${COMPILER} -m32 $NEWARGS`; then
+               exit 0
+       else
+               exit 1
+       fi
+       
+elif [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'YES' ]; then
+       # 64-bit
+       if `${COMPILER} -m64 $NEWARGS`; then
+               exit 0
+       else
+               exit 1
+       fi
+
+else
+       # Universal case
+       if `${COMPILER} -m32 $NEWARGS`; then
+               for filename in ${OUTPUT}
+               do
+                       mv ${filename} ${filename}.32
+               done
+       
+               if `${COMPILER} -m64 $NEWARGS`; then
+                       for filename in ${OUTPUT}
+                       do
+                               mv ${filename} ${filename}.64
+                               if [ $INTEL = 'YES' ]; then
+                                       lipo -create -arch x86_64 ${filename}.64 \
+                                                -arch i386 ${filename}.32 \
+                                                -output ${filename}
+                               else
+                                       lipo -create -arch ppc64 ${filename}.64 \
+                                                -arch ppc ${filename}.32 \
+                                                -output ${filename}
+                               fi
+                       
+                               rm -f ${filename}.32 ${filename}.64
+                       done
+               else
+                       exit 1
+               fi
+       else
+               exit 1
+       fi
+fi
+exit 0
</ins><span class="cx">Property changes on: trunk/dports/python/py27-numpy/files/wrapper-template
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
</div>

</body>
</html>