1 | # $Id: Portfile 38455 2008-07-21 14:30:08Z jmr@macports.org $ |
---|
2 | # vim: set syn=tcl: |
---|
3 | PortSystem 1.0 |
---|
4 | |
---|
5 | categories math |
---|
6 | name atlas |
---|
7 | version 3.8.2 |
---|
8 | |
---|
9 | # additional versions |
---|
10 | set lapackversion 3.2 |
---|
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 ${atlasdist} \ |
---|
32 | md5 dd888f5d066c1fafeaaf2ae6b37e0b85 \ |
---|
33 | sha1 2d1f2f789f57c9e7e8957f275b67c33176a36e0c \ |
---|
34 | rmd160 8160ccb3af7cd7365ba87c77d636fb68b24c62ae \ |
---|
35 | ${lapackdist} \ |
---|
36 | md5 db2e9b01bd157b65440f8306c0ba5446 \ |
---|
37 | sha1 398900bb2537f02578e5419c9d2e3580d705d2cc \ |
---|
38 | rmd160 5ceea89d61e9738ac970875f794b7f5e7897e176 |
---|
39 | # The following patch corrects an error in which Core 2 duos and Xeons |
---|
40 | # are mistakenly identified as PIII cpu's |
---|
41 | patchfiles patch-CONFIG-src-backend-archinf_x86.c.diff |
---|
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 | |
---|
51 | # Set fortran compiler flags |
---|
52 | set myf77 ${prefix}/bin/gfortran-mp-4.3 |
---|
53 | |
---|
54 | configure.args -C xc ${prefix}/bin/gcc-mp-4.3 \ |
---|
55 | -C gc ${prefix}/bin/gcc-mp-4.3 \ |
---|
56 | -C if ${myf77} \ |
---|
57 | -C ic ${prefix}/bin/gcc-mp-4.3 \ |
---|
58 | -C dm ${prefix}/bin/gcc-mp-4.3 \ |
---|
59 | -C sm ${prefix}/bin/gcc-mp-4.3 \ |
---|
60 | -C dk ${prefix}/bin/gcc-mp-4.3 \ |
---|
61 | -C sk ${prefix}/bin/gcc-mp-4.3 \ |
---|
62 | -b 32 \ |
---|
63 | -Fa alg -fPIC |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | # we are configuring from the build directory |
---|
68 | configure.dir ${workpath}/${name}-${version}/build |
---|
69 | configure.cmd ../configure |
---|
70 | |
---|
71 | # change the default compilers to those of gcc43 and make into shared library |
---|
72 | |
---|
73 | extract { |
---|
74 | # extract atlas and move to a consistent working directory name |
---|
75 | system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \ |
---|
76 | gnutar --no-same-owner -xf -" |
---|
77 | system "mv ${workpath}/ATLAS ${workpath}/${name}-${version}" |
---|
78 | |
---|
79 | # extract lapack |
---|
80 | system "cd ${workpath} && gunzip -dc ${distpath}/${lapackdist} | \ |
---|
81 | gnutar --no-same-owner -xf -" |
---|
82 | } |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | pre-configure { |
---|
87 | # Get some system specific variables for maximum optimization |
---|
88 | set cpufreq [expr {[exec sysctl -n hw.cpufrequency]/1000000}] |
---|
89 | ui_debug "Setting CPU Frequency for: ${cpufreq}" |
---|
90 | configure.args-append -D c -DPentiumCPS=${cpufreq} |
---|
91 | |
---|
92 | # first do a 'fack configure' of atlas so we get optimized lapack libraries |
---|
93 | # atlas docs: 3.1.2 |
---|
94 | set atlas_path ${workpath}/${name}-${version} |
---|
95 | file mkdir ${workpath}/${name}-${version}/temp |
---|
96 | system "cd ${atlas_path}/temp && \ |
---|
97 | ${configure.cmd} ${configure.args}" |
---|
98 | |
---|
99 | # Get the F77FLAGS |
---|
100 | set atlas_f77 [join [lrange [split [exec grep "F77 = " $atlas_path/temp/Make.inc ] =] 1 end] =] |
---|
101 | ui_debug "Found atlas F77: ${atlas_f77}" |
---|
102 | |
---|
103 | set atlas_fflags [join [lrange [split [exec grep "F77FLAGS = " $atlas_path/temp/Make.inc] =] 1 end] =] |
---|
104 | ui_debug "Found atlas F77FLAGS: ${atlas_fflags}" |
---|
105 | # Remove the old test configure directory |
---|
106 | system "rm -rf ${atlas_path}/temp" |
---|
107 | |
---|
108 | # compile lapack |
---|
109 | system "cd ${workpath}/${lapackname}-${lapackversion} && \ |
---|
110 | cp INSTALL/make.inc.gfortran make.inc" |
---|
111 | |
---|
112 | reinplace "s|gfortran|${atlas_f77}|" \ |
---|
113 | ${workpath}/${lapackname}-${lapackversion}/make.inc |
---|
114 | |
---|
115 | reinplace "s|OPTS = -O2|OPTS = ${atlas_fflags}|" \ |
---|
116 | ${workpath}/${lapackname}-${lapackversion}/make.inc |
---|
117 | |
---|
118 | reinplace "s|NOOPT = -O0|NOOPT = -O2 -m32|" \ |
---|
119 | ${workpath}/${lapackname}-${lapackversion}/make.inc |
---|
120 | |
---|
121 | reinplace "s|PLAT = _LINUX|PLAT = _darwin|" \ |
---|
122 | ${workpath}/${lapackname}-${lapackversion}/make.inc |
---|
123 | |
---|
124 | reinplace "s|LOADOPTS =|LOADOPTS = ${atlas_fflags}|" \ |
---|
125 | ${workpath}/${lapackname}-${lapackversion}/make.inc |
---|
126 | |
---|
127 | system "cd ${workpath}/${lapackname}-${lapackversion} && make lib" |
---|
128 | |
---|
129 | # create a build directory for atlas |
---|
130 | file mkdir ${workpath}/${name}-${version}/build |
---|
131 | |
---|
132 | configure.args-append --with-netlib-lapack=${workpath}/${lapackname}-${lapackversion}/lapack_darwin.a |
---|
133 | } |
---|
134 | |
---|
135 | post-configure { |
---|
136 | # recursively remove directories |
---|
137 | reinplace "s|rm -f|rm -rf|g" ${workpath}/${name}-${version}/build/Makefile |
---|
138 | |
---|
139 | # patch ${name}-${version}/build/Make.top to install dynamic libs |
---|
140 | system "cd ${worksrcpath}/build/ && \ |
---|
141 | patch -p0 < ${filespath}/${make_patch}" |
---|
142 | } |
---|
143 | |
---|
144 | pre-destroot { |
---|
145 | # We have to manually create the dylib shared libs as the default build does not do this |
---|
146 | set ld "ld -dynamic -arch i386 -dylib -single_module -dead_strip -x \ |
---|
147 | -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o -dylib_install_name" |
---|
148 | |
---|
149 | system "cd ${workpath}/${name}-${version}/build/lib && \ |
---|
150 | ${ld} libatlas.dylib libatlas.a -o libatlas.dylib -lSystem" |
---|
151 | |
---|
152 | system "cd ${workpath}/${name}-${version}/build/lib && \ |
---|
153 | ${ld} libptcblas.dylib libptcblas.a -o libptcblas.dylib -latlas -lSystem" |
---|
154 | |
---|
155 | system "cd ${workpath}/${name}-${version}/build/lib && \ |
---|
156 | ${ld} libptf77blas.dylib libptf77blas.a -o libptf77blas.dylib -lgfortran \ |
---|
157 | -latlas -lSystem" |
---|
158 | |
---|
159 | system "cd ${workpath}/${name}-${version}/build/lib && \ |
---|
160 | ${ld} liblapack.dylib liblapack.a -o liblapack.dylib -lptf77blas \ |
---|
161 | -lgfortran -lptcblas -latlas -lgcc_s.1 -lSystem" |
---|
162 | |
---|
163 | } |
---|
164 | |
---|
165 | #destroot { |
---|
166 | # xinstall -m 755 -d ${destroot}${prefix}/bin |
---|
167 | # xinstall -m 755 -d ${destroot}${prefix}/lib |
---|
168 | # xinstall -m 755 -d ${destroot}${prefix}/include |
---|
169 | # |
---|
170 | # xinstall -m 644 -d ${worksrcpath}/build/lib/libatlas.dylib ${destroot}${prefix}/lib |
---|
171 | # xinstall -m 644 -d ${worksrcpath}/build/lib/liblapack.dylib ${destroot}${prefix}/lib |
---|
172 | # xinstall -m 644 -d ${worksrcpath}/build/lib/libptcblas.dylib ${destroot}${prefix}/lib |
---|
173 | # xinstall -m 644 -d ${worksrcpath}/build/lib/libptf77blas.dylib ${destroot}${prefix}/lib |
---|
174 | # |
---|
175 | # |
---|
176 | #} |
---|
177 | # |
---|
178 | post-destroot { |
---|
179 | # we make soft links to the parallel built libs |
---|
180 | system "cd ${destroot}${prefix}/lib && \ |
---|
181 | ln -sf ./libptcblas.dylib libcblas.dylib && \ |
---|
182 | ln -sf ./libptf77blas.dylib libf77blas.dylib" |
---|
183 | } |
---|