| 1 | # $Id: Portfile 73586 2010-11-19 13:52:57Z jmr@macports.org $ |
|---|
| 2 | |
|---|
| 3 | PortSystem 1.0 |
|---|
| 4 | PortGroup muniversal 1.0 |
|---|
| 5 | |
|---|
| 6 | categories math |
|---|
| 7 | name atlas |
|---|
| 8 | version 3.9.33 |
|---|
| 9 | #revision 4 |
|---|
| 10 | |
|---|
| 11 | # additional versions |
|---|
| 12 | set lapackversion 3.3.0 |
|---|
| 13 | set lapackname lapack |
|---|
| 14 | set atlasdist ${name}${version}.tar.bz2 |
|---|
| 15 | set lapackdist ${lapackname}-${lapackversion}.tgz |
|---|
| 16 | |
|---|
| 17 | maintainers jameskyle |
|---|
| 18 | platforms darwin |
|---|
| 19 | |
|---|
| 20 | description Portable optimal linear algebra software |
|---|
| 21 | long_description The current version provides a complete BLAS and LAPACK API.\ |
|---|
| 22 | For many operations, ATLAS achieves performance on par with\ |
|---|
| 23 | machine-specific tuned libraries. |
|---|
| 24 | |
|---|
| 25 | homepage http://math-atlas.sourceforge.net/ |
|---|
| 26 | |
|---|
| 27 | master_sites sourceforge:math-atlas:atlas \ |
|---|
| 28 | http://www.netlib.org/lapack:lapack |
|---|
| 29 | |
|---|
| 30 | distfiles ${atlasdist}:atlas \ |
|---|
| 31 | ${lapackdist}:lapack |
|---|
| 32 | |
|---|
| 33 | patchfiles patch-SpewMakeInc.c.diff |
|---|
| 34 | |
|---|
| 35 | checksums atlas3.9.33.tar.bz2 \ |
|---|
| 36 | md5 8f518f386b69bdfd1f5061704aa196f9 \ |
|---|
| 37 | sha1 8dbc6015318458ff7abd178964d90350a18ce9fa \ |
|---|
| 38 | rmd160 810033a9f81c11994a5221dc268e3da84e2367d7 \ |
|---|
| 39 | lapack-3.3.0.tgz \ |
|---|
| 40 | md5 84213fca70936cc5f1b59a7b1bf71697 \ |
|---|
| 41 | sha1 4f0b103da52110e7f60d1d7676727103aca9785e \ |
|---|
| 42 | rmd160 cc72e7c93ab13464fd892d684b00b910cbbd3b3e |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | use_parallel_build no |
|---|
| 46 | build.target build |
|---|
| 47 | build.dir ${workpath}/${name}-${version}/build |
|---|
| 48 | |
|---|
| 49 | variant gcc45 conflicts gcc42 gcc43 gcc44 description {build using macports-gcc-4.5} {} |
|---|
| 50 | variant gcc44 conflicts gcc42 gcc43 description {build using macports-gcc-4.4} {} |
|---|
| 51 | variant gcc43 conflicts gcc42 gcc44 conflicts universal description {build using macports-gcc-4.3} {} |
|---|
| 52 | variant gcc42 conflicts gcc43 gcc44 conflicts universal description {build using macports-gcc-4.2} {} |
|---|
| 53 | |
|---|
| 54 | if { [variant_isset gcc42] } { |
|---|
| 55 | set gccversion 4.2 |
|---|
| 56 | } elseif { [variant_isset gcc43] } { |
|---|
| 57 | set gccversion 4.3 |
|---|
| 58 | } elseif { [variant_isset gcc45 ] } { |
|---|
| 59 | set gccversion 4.5 |
|---|
| 60 | } else { |
|---|
| 61 | default_variants +gcc44 |
|---|
| 62 | set gccversion 4.4 |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | set gccnumber [join [split ${gccversion} .] ""] |
|---|
| 66 | |
|---|
| 67 | destroot.dir ${build.dir} |
|---|
| 68 | destroot.destdir DESTDIR=${destroot}${prefix} |
|---|
| 69 | depends_lib port:gcc${gccnumber} \ |
|---|
| 70 | port:bzip2 \ |
|---|
| 71 | port:gzip |
|---|
| 72 | |
|---|
| 73 | if {[info exists depends_skip_archcheck]} { |
|---|
| 74 | depends_skip_archcheck gcc${gccnumber} |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | configure.compiler macports-gcc-${gccversion} |
|---|
| 78 | |
|---|
| 79 | if { ${os.arch}=="i386" } { |
|---|
| 80 | set universal_archs_supported { i386 x86_64 } |
|---|
| 81 | } else { |
|---|
| 82 | set universal_archs_supported { ppc ppc64 } |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | if {${build_arch} == "x86_64" || ${build_arch} == "ppc64" } { |
|---|
| 86 | set my_arch 64 |
|---|
| 87 | } else { |
|---|
| 88 | set my_arch 32 |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | configure.args -C xc ${configure.cc} \ |
|---|
| 92 | -C gc ${configure.cc} \ |
|---|
| 93 | -C if ${configure.f77} \ |
|---|
| 94 | -C ic ${configure.cc} \ |
|---|
| 95 | -C dm ${configure.cc} \ |
|---|
| 96 | -C sm ${configure.cc} \ |
|---|
| 97 | -C dk ${configure.cc} \ |
|---|
| 98 | -C sk ${configure.cc} \ |
|---|
| 99 | --cc=${configure.cc} \ |
|---|
| 100 | --with-netlib-lapack-tarfile=${distpath}/${lapackdist} \ |
|---|
| 101 | -O 12 \ |
|---|
| 102 | -b ${my_arch} \ |
|---|
| 103 | -Fa alg -fPIC |
|---|
| 104 | |
|---|
| 105 | if { [variant_isset universal] } { |
|---|
| 106 | configure.universal_args-delete --disable-dependency-tracking |
|---|
| 107 | configure.args-delete --cc=${configure.cc} \ |
|---|
| 108 | -b ${my_arch} \ |
|---|
| 109 | -Fa alg -fPIC |
|---|
| 110 | |
|---|
| 111 | lappend merger_configure_args(ppc) --cc='${configure.cc} -m32' \ |
|---|
| 112 | -b 32 \ |
|---|
| 113 | -s gas_ppc \ |
|---|
| 114 | -Fa alg '-fPIC -m32' |
|---|
| 115 | lappend merger_configure_args(ppc64) --cc='${configure.cc} -m64' \ |
|---|
| 116 | -b 64 \ |
|---|
| 117 | -s gas_ppc \ |
|---|
| 118 | -Fa alg '-fPIC -m64' |
|---|
| 119 | lappend merger_configure_args(i386) --cc='${configure.cc} -m32' \ |
|---|
| 120 | -b 32 \ |
|---|
| 121 | -s gas_x86_32 \ |
|---|
| 122 | -Fa alg '-fPIC -m32' |
|---|
| 123 | lappend merger_configure_args(x86_64) --cc='${configure.cc} -m64' \ |
|---|
| 124 | -b 64 \ |
|---|
| 125 | -s gas_x86_64 \ |
|---|
| 126 | -Fa alg '-fPIC -m64' |
|---|
| 127 | } else { |
|---|
| 128 | lappend merger_configure_args(ppc) |
|---|
| 129 | lappend merger_configure_args(ppc64) |
|---|
| 130 | lappend merger_configure_args(i386) |
|---|
| 131 | lappend merger_configure_args(x86_64) |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | build.env-append "CC=${configure.cc} CXX=${configure.cxx}" |
|---|
| 135 | |
|---|
| 136 | # we are configuring from the build directory |
|---|
| 137 | configure.dir ${workpath}/${name}-${version}/build |
|---|
| 138 | configure.cmd ../configure |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | # change the default compilers to those of gcc and make into shared library |
|---|
| 142 | extract { |
|---|
| 143 | # extract atlas and move to a consistent working directory name |
|---|
| 144 | system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \ |
|---|
| 145 | gnutar --no-same-owner -xf -" |
|---|
| 146 | system "mv ${workpath}/ATLAS ${workpath}/${name}-${version}" |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | post-patch { |
|---|
| 150 | reinplace "s|__MACPORTS_GCC__|${configure.cc}|g" \ |
|---|
| 151 | ${workpath}/${name}-${version}/CONFIG/src/SpewMakeInc.c |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | pre-configure { |
|---|
| 155 | if { [variant_isset universal] } { |
|---|
| 156 | foreach arch ${universal_archs_to_use} { |
|---|
| 157 | copy ${workpath}/${name}-${version} ${workpath}/${name}-${version}-${arch} |
|---|
| 158 | } |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | reinplace "s|cc=gcc|cc=${configure.cc}|g" ${worksrcpath}/configure |
|---|
| 162 | reinplace "s|-no-cpp-precomp||g" ${workpath}/${name}-${version}/CONFIG/src/atlcomp.txt |
|---|
| 163 | |
|---|
| 164 | # Get some system specific variables for maximum optimization |
|---|
| 165 | set cpufreq [expr {[exec sysctl -n hw.cpufrequency]/1000000}] |
|---|
| 166 | ui_debug "Setting CPU Frequency for: ${cpufreq}" |
|---|
| 167 | |
|---|
| 168 | if {[string equal "${os.arch}" "powerpc"]} { |
|---|
| 169 | configure.args-append -D c -DWALL |
|---|
| 170 | } else { |
|---|
| 171 | configure.args-append -D c -DPentiumCPS=${cpufreq} |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | if { [variant_isset universal] } { |
|---|
| 175 | set archs ${universal_archs_to_use} |
|---|
| 176 | } else { |
|---|
| 177 | set archs ${build_arch} |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | foreach arch ${archs} { |
|---|
| 181 | |
|---|
| 182 | if { ! [variant_isset universal] } { |
|---|
| 183 | set atlas_path ${workpath}/${name}-${version} |
|---|
| 184 | } else { |
|---|
| 185 | set atlas_path ${workpath}/${name}-${version}-${arch} |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | file mkdir ${atlas_path}/build |
|---|
| 189 | } |
|---|
| 190 | } |
|---|
| 191 | |
|---|
| 192 | post-configure { |
|---|
| 193 | if { [variant_isset universal] } { |
|---|
| 194 | set archs ${universal_archs_to_use} |
|---|
| 195 | } else { |
|---|
| 196 | set archs ${build_arch} |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | foreach arch ${archs} { |
|---|
| 200 | if { ! [variant_isset universal] } { |
|---|
| 201 | set atlas_path ${workpath}/${name}-${version} |
|---|
| 202 | } else { |
|---|
| 203 | set atlas_path ${workpath}/${name}-${version}-${arch} |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | # recursively remove directories |
|---|
| 207 | ui_debug "reinplace for make to recursively remove directories on clean" |
|---|
| 208 | reinplace "s|rm -f|rm -rf|g" ${atlas_path}/build/Makefile |
|---|
| 209 | } |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | proc make_dylib { lib lib_dir arch libs } { |
|---|
| 213 | global destroot prefix gccnumber |
|---|
| 214 | system "cd ${lib_dir} && \ |
|---|
| 215 | ( test ! -e ${lib}.a || |
|---|
| 216 | /usr/bin/ld -arch ${arch} -dynamic -dylib -single_module -dead_strip \ |
|---|
| 217 | -x -all_load -L. -L${prefix}/lib/gcc${gccnumber}/${arch} -L${prefix}/lib/gcc${gccnumber} -ldylib1.o \ |
|---|
| 218 | -dylib_install_name ${prefix}/lib/${lib}.dylib \ |
|---|
| 219 | ${lib}.a -o ${lib}.dylib ${libs} )" |
|---|
| 220 | } |
|---|
| 221 | |
|---|
| 222 | post-build { |
|---|
| 223 | # We have to manually create the dylib shared libs as the default build does not do this |
|---|
| 224 | |
|---|
| 225 | set ncpu [exec sysctl -n hw.ncpu] |
|---|
| 226 | |
|---|
| 227 | if { [variant_isset universal] } { |
|---|
| 228 | set archs ${universal_archs_to_use} |
|---|
| 229 | } else { |
|---|
| 230 | set archs ${build_arch} |
|---|
| 231 | } |
|---|
| 232 | |
|---|
| 233 | foreach arch ${archs} { |
|---|
| 234 | if { ! [variant_isset universal] } { |
|---|
| 235 | set atlas_path ${workpath}/${name}-${version} |
|---|
| 236 | } else { |
|---|
| 237 | set atlas_path ${workpath}/${name}-${version}-${arch} |
|---|
| 238 | } |
|---|
| 239 | set lib_dir ${atlas_path}/build/lib |
|---|
| 240 | |
|---|
| 241 | make_dylib libatlas ${lib_dir} ${arch} { -lSystem } |
|---|
| 242 | |
|---|
| 243 | if {${ncpu} == "1" } { |
|---|
| 244 | # there are no threaded libraries (libpt*) on single-core machines |
|---|
| 245 | make_dylib libcblas ${lib_dir} ${arch} { -latlas -lSystem } |
|---|
| 246 | make_dylib libf77blas ${lib_dir} ${arch} { -lgfortran -latlas -lSystem } |
|---|
| 247 | } else { |
|---|
| 248 | make_dylib libptcblas ${lib_dir} ${arch} { -latlas -lSystem } |
|---|
| 249 | make_dylib libptf77blas ${lib_dir} ${arch} { -lgfortran -latlas -lSystem } |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | make_dylib liblapack ${lib_dir} ${arch} { -lf77blas -lcblas -latlas -lgfortran -lgcc_s.1 -lSystem } |
|---|
| 253 | } |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | pre-destroot { |
|---|
| 257 | if { [variant_isset universal] } { |
|---|
| 258 | set archs ${universal_archs_to_use} |
|---|
| 259 | } else { |
|---|
| 260 | set archs ${build_arch} |
|---|
| 261 | } |
|---|
| 262 | |
|---|
| 263 | foreach arch ${archs} { |
|---|
| 264 | if { ! [variant_isset universal] } { |
|---|
| 265 | set atlas_path ${workpath}/${name}-${version} |
|---|
| 266 | set dest_path ${destroot}${prefix}/lib/ |
|---|
| 267 | } else { |
|---|
| 268 | set atlas_path ${workpath}/${name}-${version}-${arch} |
|---|
| 269 | set dest_path ${destroot}-${arch}${prefix}/lib/ |
|---|
| 270 | } |
|---|
| 271 | set lib_dir ${atlas_path}/build/lib |
|---|
| 272 | |
|---|
| 273 | file mkdir ${dest_path} |
|---|
| 274 | eval xinstall -m 755 [glob ${lib_dir}/*.dylib] ${dest_path} |
|---|
| 275 | } |
|---|
| 276 | } |
|---|
| 277 | |
|---|
| 278 | post-destroot { |
|---|
| 279 | if { ![file exists ${destroot}${prefix}/lib/libcblas.dylib] && [file exists ${destroot}${prefix}/lib/libptcblas.dylib]} { |
|---|
| 280 | ln -s libptcblas.dylib ${destroot}${prefix}/lib/libcblas.dylib |
|---|
| 281 | } |
|---|
| 282 | if { ![file exists ${destroot}${prefix}/lib/libf77blas.dylib] && [file exists ${destroot}${prefix}/lib/libptf77blas.dylib]} { |
|---|
| 283 | ln -s libptf77blas.dylib ${destroot}${prefix}/lib/libf77blas.dylib |
|---|
| 284 | } |
|---|
| 285 | } |
|---|
| 286 | |
|---|
| 287 | livecheck.name math-atlas |
|---|
| 288 | livecheck.distname Stable |
|---|