1 | | # $Id: Portfile 52257 2009-06-13 05:10:01Z jameskyle@macports.org $ |
2 | | |
3 | | PortSystem 1.0 |
4 | | |
5 | | categories math |
6 | | name atlas |
7 | | version 3.8.3 |
8 | | |
9 | | # additional versions |
10 | | set lapackversion 3.2.1 |
11 | | set lapackname lapack |
12 | | set atlasdist ${name}${version}.tar.bz2 |
13 | | set lapackdist ${lapackname}.tgz |
14 | | |
15 | | maintainers cornell.edu:ajb78 |
16 | | platforms darwin |
17 | | |
18 | | description Portable optimal linear algebra software |
19 | | long_description The current version provides a complete BLAS and LAPACK API.\ |
20 | | For many operations, ATLAS achieves performance on par with\ |
21 | | machine-specific tuned libraries. |
22 | | |
23 | | homepage http://math-atlas.sourceforge.net/ |
24 | | |
25 | | master_sites sourceforge:math-atlas/${name}${version}.tar.bz2:atlas \ |
26 | | http://www.netlib.org/lapack:lapack |
27 | | |
28 | | distfiles ${atlasdist}:atlas \ |
29 | | ${lapackdist}:lapack |
30 | | |
31 | | checksums atlas3.8.3.tar.bz2 \ |
32 | | md5 6c13be94a87178e7582111c08e9503bc \ |
33 | | sha1 c7546210df4796457d9e96a00444adc4c0f2e77f \ |
34 | | rmd160 0425e630d9d0c5b7aae81427a41b7eaa18447e90 \ |
35 | | lapack.tgz \ |
36 | | md5 a3202a4f9e2f15ffd05d15dab4ac7857 \ |
37 | | sha1 c75223fdef3258c461370af5d2b889d580d7f38a \ |
38 | | rmd160 e8fabba2fdd944afbc02a83599cf45a0d721030d |
39 | | |
40 | | |
41 | | # the following patch corrects extension conventions for osx's dynamic libs |
42 | | set make_patch patch-build-Make.top.diff |
43 | | use_parallel_build no |
44 | | build.target build |
45 | | build.dir ${workpath}/${name}-${version}/build |
46 | | |
47 | | destroot.dir ${build.dir} |
48 | | destroot.destdir DESTDIR=${destroot}${prefix} |
49 | | depends_lib port:gcc43 \ |
50 | | port:bzip2 \ |
51 | | port:gzip |
52 | | |
53 | | # Set fortran compiler flags |
54 | | set myf77 ${prefix}/bin/gfortran-mp-4.3 |
55 | | |
56 | | configure.args -C xc ${prefix}/bin/gcc-mp-4.3 \ |
57 | | -C gc ${prefix}/bin/gcc-mp-4.3 \ |
58 | | -C if ${myf77} \ |
59 | | -C ic ${prefix}/bin/gcc-mp-4.3 \ |
60 | | -C dm ${prefix}/bin/gcc-mp-4.3 \ |
61 | | -C sm ${prefix}/bin/gcc-mp-4.3 \ |
62 | | -C dk ${prefix}/bin/gcc-mp-4.3 \ |
63 | | -C sk ${prefix}/bin/gcc-mp-4.3 \ |
64 | | --cc=${prefix}/bin/gcc-mp-4.3 \ |
65 | | -b 32 \ |
66 | | -Fa alg -fPIC |
67 | | |
68 | | configure.compiler macports-gcc-4.3 |
69 | | |
70 | | |
71 | | |
72 | | # we are configuring from the build directory |
73 | | configure.dir ${workpath}/${name}-${version}/build |
74 | | configure.cmd ../configure |
75 | | |
76 | | # change the default compilers to those of gcc43 and make into shared library |
77 | | |
78 | | extract { |
79 | | # extract atlas and move to a consistent working directory name |
80 | | system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \ |
81 | | gnutar --no-same-owner -xf -" |
82 | | system "mv ${workpath}/ATLAS ${workpath}/${name}-${version}" |
83 | | |
84 | | # extract lapack |
85 | | system "cd ${workpath} && gunzip -dc ${distpath}/${lapackdist} | \ |
86 | | gnutar --no-same-owner -xf -" |
87 | | } |
88 | | |
89 | | |
90 | | |
91 | | pre-configure { |
92 | | # Get some system specific variables for maximum optimization |
93 | | set cpufreq [expr {[exec sysctl -n hw.cpufrequency]/1000000}] |
94 | | ui_debug "Setting CPU Frequency for: ${cpufreq}" |
95 | | configure.args-append -D c -DPentiumCPS=${cpufreq} |
96 | | |
97 | | # first do a 'fake configure' of atlas so we get optimized lapack libraries |
98 | | ui_debug "performing fake configure of atlas for optimized lapack" |
99 | | # atlas docs: 3.1.2 |
100 | | set atlas_path ${workpath}/${name}-${version} |
101 | | file mkdir ${workpath}/${name}-${version}/temp |
102 | | ui_debug "Assembled Command: '${configure.cmd} ${configure.args}" |
103 | | system "cd ${atlas_path}/temp && \ |
104 | | ${configure.cmd} ${configure.args}" |
105 | | |
106 | | # Get the F77FLAGS |
107 | | set atlas_f77 [join [lrange [split [exec grep "F77 = " $atlas_path/temp/Make.inc ] =] 1 end] =] |
108 | | ui_debug "Found atlas F77: ${atlas_f77}" |
109 | | |
110 | | set atlas_fflags [join [lrange [split [exec grep "F77FLAGS = " $atlas_path/temp/Make.inc] =] 1 end] =] |
111 | | ui_debug "Found atlas F77FLAGS: ${atlas_fflags}" |
112 | | # Remove the old test configure directory |
113 | | system "rm -rf ${atlas_path}/temp" |
114 | | |
115 | | # compile lapack |
116 | | system "cd ${workpath}/${lapackname}-${lapackversion} && \ |
117 | | cp INSTALL/make.inc.gfortran make.inc" |
118 | | reinplace "s|gfortran|${atlas_f77}|" \ |
119 | | ${workpath}/${lapackname}-${lapackversion}/make.inc |
120 | | reinplace "s|OPTS = -O2|OPTS = ${atlas_fflags}|" \ |
121 | | ${workpath}/${lapackname}-${lapackversion}/make.inc |
122 | | |
123 | | reinplace "s|NOOPT = -O0|NOOPT = -O2 -m32|" \ |
124 | | ${workpath}/${lapackname}-${lapackversion}/make.inc |
125 | | |
126 | | reinplace "s|PLAT = _LINUX|PLAT = _darwin|" \ |
127 | | ${workpath}/${lapackname}-${lapackversion}/make.inc |
128 | | |
129 | | reinplace "s|LOADOPTS =|LOADOPTS = ${atlas_fflags}|" \ |
130 | | ${workpath}/${lapackname}-${lapackversion}/make.inc |
131 | | |
132 | | system "cd ${workpath}/${lapackname}-${lapackversion} && make lib" |
133 | | |
134 | | # create a build directory for atlas |
135 | | file mkdir ${workpath}/${name}-${version}/build |
136 | | |
137 | | |
138 | | configure.args-append --with-netlib-lapack=${workpath}/${lapackname}-${lapackversion}/lapack_darwin.a |
139 | | } |
140 | | |
141 | | post-configure { |
142 | | # recursively remove directories |
143 | | reinplace "s|rm -f|rm -rf|g" ${workpath}/${name}-${version}/build/Makefile |
144 | | |
145 | | # patch ${name}-${version}/build/Make.top to install dynamic libs |
146 | | system "cd ${worksrcpath}/build/ && \ |
147 | | patch -p0 < ${filespath}/${make_patch}" |
148 | | } |
149 | | |
150 | | pre-destroot { |
151 | | # We have to manually create the dylib shared libs as the default build does not do this |
152 | | set ld "ld -dynamic -arch i386 -dylib -single_module -dead_strip -x \ |
153 | | -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o -dylib_install_name" |
154 | | |
155 | | system "cd ${workpath}/${name}-${version}/build/lib && \ |
156 | | ${ld} libatlas.dylib libatlas.a -o libatlas.dylib -lSystem" |
157 | | |
158 | | system "cd ${workpath}/${name}-${version}/build/lib && \ |
159 | | ${ld} libptcblas.dylib libptcblas.a -o libptcblas.dylib -latlas -lSystem" |
160 | | |
161 | | system "cd ${workpath}/${name}-${version}/build/lib && \ |
162 | | ${ld} libptf77blas.dylib libptf77blas.a -o libptf77blas.dylib -lgfortran \ |
163 | | -latlas -lSystem" |
164 | | |
165 | | system "cd ${workpath}/${name}-${version}/build/lib && \ |
166 | | ${ld} liblapack.dylib liblapack.a -o liblapack.dylib -lptf77blas \ |
167 | | -lgfortran -lptcblas -latlas -lgcc_s.1 -lSystem" |
168 | | |
169 | | } |
170 | | |
171 | | post-destroot { |
172 | | # we make soft links to the parallel built libs |
173 | | system "cd ${destroot}${prefix}/lib && \ |
174 | | ln -sf ./libptcblas.dylib libcblas.dylib && \ |
175 | | ln -sf ./libptf77blas.dylib libf77blas.dylib" |
176 | | } |