Le 23 avr. 09 à 09:37, MacPorts a écrit :

#19397: scipy not completely universal
------------------------------------------- +--------------------------------
Reporter:  daweonl...@…                   |       Owner:  j...@…
   Type:  defect                         |      Status:  new
Priority:  Normal                         |   Milestone:  Port Bugs
Component:  ports                          |     Version:  1.7.1
Keywords:  scipy python universal binary  |        Port:  py26-scipy
------------------------------------------- +--------------------------------

Comment(by daweonl...@…):

I've done modifying this line

265             for arch in ["i686", "x86_64"]:

in

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6
/site-packages/numpy/distutils/fcompiler/gnu.py

and installing without macports... It should be said this way used
gfortran-4.2 downloaded here

[http://www.maths.otago.ac.nz/~fonnesbeck/gfortran-4.2.3.dmg]

This version of gfortran is also available here : 
http://r.research.att.com/tools/

But the way it handles the command line is buggy. For example :

-> /usr/local/bin/gfortran -arch i386
i686-apple-darwin8-gfortran-4.2: no input files
-> /usr/local/bin/gfortran -arch i386 -arch x86_64
->

Strange, no? If two archs flags are present, there is no stderr output.

Here is a way to build a universal scipy with this compiler located in /usr/local/bin:

1. Add this file in the ${portpath} file directory, it wraps /usr/ local/bin/gfortran-4.2, fixes the bug above and another one in the building process (automatic addition of -arch i686 and -arch ppc; why ???):

-> more files/gf.in
#!/bin/sh

NOF=yes
IGNORE=no
ARGS=

for i in $@ ; do
 if [ $IGNORE == 'yes' ]; then
   IGNORE=no
 else
   if [ $i == '-arch' ]; then
     IGNORE=yes
   else
     ARGS=`echo $ARGS " " $i`
     if [ $i == '-o' ]; then
       NOF=no
     fi
   fi
 fi
done

if [ $NOF == 'yes' ]; then
 /usr/local/bin/gfortran-4.2 $@
else
 /usr/local/bin/gfortran-4.2 XXX $ARGS
fi

2. Add this variant to Portfile

variant gf42univ conflicts gcc42 gcc43 gcc44 description "Use gfortan-4.2 from http://r.research.att.com/tools to build universal binaries" {

 if {! [file exists /usr/local/bin/gfortran-4.2]} then {
puts "> Please install gfortran universal from http://// r.research.att.com//tools//"
    exit 1
 }

set fc_options "build_clib --fcompiler=gnu95 build_ext -- fcompiler=gnu95 config_fc --fcompiler=gnu95 \
                  --f77exec ${portpath}/files/gf --f90exec ${portpath}/files/gf"

 set uarch ""
 foreach arch ${universal_archs} {
        append uarch "-arch " ${arch} " "
 }

 delete ${portpath}/files/gf
 copy ${portpath}/files/gf.in ${portpath}/files/gf
 reinplace "s|XXX|${uarch}|" ${portpath}/files/gf

 build.cmd-append      ${fc_options}
 destroot.cmd-append   ${fc_options}
}

Vincent

_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev

Reply via email to