Ticket #24923: Portfile.diff
File Portfile.diff, 12.3 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 14 years ago) |
---|
-
Portfile
old new 1 1 # $Id: Portfile 67706 2010-05-16 16:35:35Z mcalhoun@macports.org $ 2 2 3 3 PortSystem 1.0 4 PortGroup muniversal 1.0 4 5 5 6 categories math 6 7 name atlas … … 47 48 build.target build 48 49 build.dir ${workpath}/${name}-${version}/build 49 50 51 variant gcc43 conflicts gcc42 conflicts universal {} 52 variant gcc42 conflicts gcc43 conflicts universal {} 53 54 if { [variant_isset gcc42] } { 55 set gccversion 4.2 56 } elseif { [variant_isset gcc43] } { 57 set gccversion 4.3 58 } else { 59 set gccversion 4.4 60 } 61 62 set gccnumber [join [split ${gccversion} .] ""] 63 50 64 destroot.dir ${build.dir} 51 65 destroot.destdir DESTDIR=${destroot}${prefix} 52 depends_lib port:gcc 43\66 depends_lib port:gcc${gccnumber} \ 53 67 port:bzip2 \ 54 68 port:gzip 55 69 56 universal_variant no 70 configure.compiler macports-gcc-${gccversion} 57 71 58 # Set fortran compiler flags 59 set myf77 ${prefix}/bin/gfortran-mp-4.3 72 if { ${os.arch}=="i386" } { 73 set universal_archs_supported { i386 x86_64 } 74 } else { 75 set universal_archs_supported { ppc ppc64 } 76 } 60 77 61 78 if {${build_arch} == "x86_64" || ${build_arch} == "ppc64" } { 62 79 set my_arch 64 … … 64 81 set my_arch 32 65 82 } 66 83 67 configure.args -C xc ${ prefix}/bin/gcc-mp-4.3\68 -C gc ${ prefix}/bin/gcc-mp-4.3\69 -C if ${ myf77} \70 -C ic ${ prefix}/bin/gcc-mp-4.3\71 -C dm ${ prefix}/bin/gcc-mp-4.3\72 -C sm ${ prefix}/bin/gcc-mp-4.3\73 -C dk ${ prefix}/bin/gcc-mp-4.3\74 -C sk ${ prefix}/bin/gcc-mp-4.3\75 --cc=${ prefix}/bin/gcc-mp-4.3\84 configure.args -C xc ${configure.cc} \ 85 -C gc ${configure.cc} \ 86 -C if ${configure.f77} \ 87 -C ic ${configure.cc} \ 88 -C dm ${configure.cc} \ 89 -C sm ${configure.cc} \ 90 -C dk ${configure.cc} \ 91 -C sk ${configure.cc} \ 92 --cc=${configure.cc} \ 76 93 -b ${my_arch} \ 77 94 -Fa alg -fPIC 78 95 79 configure.compiler macports-gcc-4.3 80 configure.cc ${prefix}/bin/gcc-mp-4.3 81 configure.cxx ${prefix}/bin/g++-mp-4.3 82 build.env-append "CC=${prefix}/bin/gcc-mp-4.3 CXX=${prefix}/bin/g++-mp-4.3" 96 if { [variant_isset universal] } { 97 configure.universal_args-delete --disable-dependency-tracking 98 configure.args-delete -b ${my_arch} 99 lappend merger_configure_args(ppc) -b 32 100 lappend merger_configure_args(ppc64) -b 64 101 lappend merger_configure_args(i386) -b 32 102 lappend merger_configure_args(x86_64) -b 64 103 } else { 104 lappend merger_configure_args(ppc) 105 lappend merger_configure_args(ppc64) 106 lappend merger_configure_args(i386) 107 lappend merger_configure_args(x86_64) 108 } 109 110 build.env-append "CC=${configure.cc} CXX=${configure.cxx}" 83 111 84 112 85 113 # we are configuring from the build directory … … 87 115 configure.cmd ../configure 88 116 89 117 90 # change the default compilers to those of gcc 43and make into shared library118 # change the default compilers to those of gcc and make into shared library 91 119 extract { 92 120 # extract atlas and move to a consistent working directory name 93 121 system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \ … … 103 131 reinplace "s|__MACPORTS_GCC__|${configure.cc}|g" ${workpath}/${name}-${version}/CONFIG/src/SpewMakeInc.c 104 132 } 105 133 106 107 134 pre-configure { 108 reinplace "s|cc=gcc|cc=${prefix}/bin/gcc-mp-4.3|g" ${worksrcpath}/configure 135 if { [variant_isset universal] } { 136 foreach arch ${universal_archs_to_use} { 137 copy ${workpath}/${name}-${version} ${workpath}/${name}-${version}-${arch} 138 copy ${workpath}/${lapackname}-${lapackversion} ${workpath}/${lapackname}-${lapackversion}-${arch} 139 } 140 } 141 142 reinplace "s|cc=gcc|cc=${configure.cc}|g" ${worksrcpath}/configure 109 143 reinplace "s|-no-cpp-precomp||g" ${workpath}/${name}-${version}/CONFIG/src/atlcomp.txt 110 144 111 145 # Get some system specific variables for maximum optimization … … 117 151 } else { 118 152 configure.args-append -D c -DPentiumCPS=${cpufreq} 119 153 } 154 155 if { [variant_isset universal] } { 156 set archs ${universal_archs_to_use} 157 } else { 158 set archs ${build_arch} 159 } 160 161 foreach arch ${archs} { 120 162 121 163 # first do a 'fake configure' of atlas so we get optimized lapack libraries 122 164 ui_debug "performing fake configure of atlas for optimized lapack" 123 165 # atlas docs: 3.1.2 124 set atlas_path ${workpath}/${name}-${version} 166 if { ! [variant_isset universal] } { 167 set atlas_path ${workpath}/${name}-${version} 168 set lapack_path ${workpath}/${lapackname}-${lapackversion} 169 } else { 170 set atlas_path ${workpath}/${name}-${version}-${arch} 171 set lapack_path ${workpath}/${lapackname}-${lapackversion}-${arch} 172 } 125 173 ui_debug "Clean out old temp directory if exists" 126 174 file delete -force ${atlas_path}/temp 127 175 file mkdir ${atlas_path}/temp 128 ui_debug "Assembled Command: '${configure.cmd} ${configure.args} "176 ui_debug "Assembled Command: '${configure.cmd} ${configure.args} $merger_configure_args(${arch})" 129 177 system "cd ${atlas_path}/temp && \ 130 ${configure.cmd} ${configure.args} "178 ${configure.cmd} ${configure.args} $merger_configure_args(${arch})" 131 179 132 180 # Get the F77FLAGS 133 181 set atlas_f77 [join [lrange [split [exec grep "F77 = " $atlas_path/temp/Make.inc ] =] 1 end] =] … … 140 188 file delete -force ${atlas_path}/temp 141 189 142 190 # compile lapack 143 system "cd ${ workpath}/${lapackname}-${lapackversion} && \191 system "cd ${lapack_path} && \ 144 192 cp INSTALL/make.inc.gfortran make.inc" 145 193 reinplace "s|gfortran|${atlas_f77}|" \ 146 ${ workpath}/${lapackname}-${lapackversion}/make.inc194 ${lapack_path}/make.inc 147 195 reinplace "s|OPTS = -O2|OPTS = ${atlas_fflags}|" \ 148 ${ workpath}/${lapackname}-${lapackversion}/make.inc196 ${lapack_path}/make.inc 149 197 150 reinplace "s|NOOPT = -O0|NOOPT = -O2 -m${my_arch}|" \ 151 ${workpath}/${lapackname}-${lapackversion}/make.inc 198 if { ! [variant_isset universal] } { 199 reinplace "s|NOOPT = -O0|NOOPT = -O2 -m${my_arch}|" \ 200 ${lapack_path}/make.inc 201 } else { 202 if { ${arch}=="i386" || ${arch}=="ppc" } { 203 reinplace "s|NOOPT = -O0|NOOPT = -O2 -m32|" \ 204 ${lapack_path}/make.inc 205 } else { 206 reinplace "s|NOOPT = -O0|NOOPT = -O2 -m64|" \ 207 ${lapack_path}/make.inc 208 } 209 } 152 210 153 211 reinplace "s|PLAT = _LINUX|PLAT = _darwin|" \ 154 ${ workpath}/${lapackname}-${lapackversion}/make.inc212 ${lapack_path}/make.inc 155 213 156 214 reinplace "s|LOADOPTS =|LOADOPTS = ${atlas_fflags}|" \ 157 ${ workpath}/${lapackname}-${lapackversion}/make.inc215 ${lapack_path}/make.inc 158 216 159 system "cd ${ workpath}/${lapackname}-${lapackversion} && make lib"217 system "cd ${lapack_path} && make lib" 160 218 161 219 # create a build directory for atlas 162 file mkdir ${ workpath}/${name}-${version}/build220 file mkdir ${atlas_path}/build 163 221 164 165 configure.args-append --with-netlib-lapack=${workpath}/${lapackname}-${lapackversion}/lapack_darwin.a 222 if { ! [variant_isset universal] } { 223 configure.args-append --with-netlib-lapack=${lapack_path}/lapack_darwin.a 224 } else { 225 lappend merger_configure_args(${arch}) --with-netlib-lapack=${lapack_path}/lapack_darwin.a 226 } 227 } 166 228 } 167 229 168 230 post-configure { 231 if { [variant_isset universal] } { 232 set archs ${universal_archs_to_use} 233 } else { 234 set archs ${build_arch} 235 } 236 237 foreach arch ${archs} { 238 if { ! [variant_isset universal] } { 239 set atlas_path ${workpath}/${name}-${version} 240 } else { 241 set atlas_path ${workpath}/${name}-${version}-${arch} 242 } 243 169 244 # recursively remove directories 170 245 ui_debug "reinplace for make to recursively remove directories on clean" 171 reinplace "s|rm -f|rm -rf|g" ${workpath}/${name}-${version}/build/Makefile 246 reinplace "s|rm -f|rm -rf|g" ${atlas_path}/build/Makefile 247 } 172 248 } 173 249 174 proc make_dylib { lib lib s } {175 global destroot prefix myarch176 system "cd ${ destroot}/${prefix}/lib&& \250 proc make_dylib { lib lib_dir arch libs } { 251 global destroot prefix gccnumber 252 system "cd ${lib_dir} && \ 177 253 ( test ! -e ${lib}.a || 178 ld -arch ${myarch} -dynamic -dylib -single_module -dead_strip \179 -x -all_load -L. -L${prefix}/lib/gcc 43-ldylib1.o \254 /usr/bin/ld -arch ${arch} -dynamic -dylib -single_module -dead_strip \ 255 -x -all_load -L. -L${prefix}/lib/gcc${gccnumber}/${arch} -L${prefix}/lib/gcc${gccnumber} -ldylib1.o \ 180 256 -dylib_install_name ${prefix}/lib/${lib}.dylib \ 181 ${lib}.a -o ${lib}.dylib ${libs} && rm -f ${lib}.a)"257 ${lib}.a -o ${lib}.dylib ${libs} )" 182 258 } 183 259 184 185 post-destroot { 260 post-build { 186 261 # We have to manually create the dylib shared libs as the default build does not do this 187 global myarch188 262 189 if {[string equal "${os.arch}" "powerpc"]} { 190 if {${my_arch} == "64" } { 191 set myarch "ppc64" 192 } else { 193 set myarch "ppc" 194 } 195 } else { 196 if {${my_arch} == "64" } { 197 set myarch "x86_64" 263 set ncpu [exec sysctl -n hw.ncpu] 264 265 if { [variant_isset universal] } { 266 set archs ${universal_archs_to_use} 198 267 } else { 199 set myarch "i386"268 set archs ${build_arch} 200 269 } 201 } 202 203 set ncpu [exec sysctl -n hw.ncpu] 270 271 foreach arch ${archs} { 272 if { ! [variant_isset universal] } { 273 set atlas_path ${workpath}/${name}-${version} 274 } else { 275 set atlas_path ${workpath}/${name}-${version}-${arch} 276 } 277 set lib_dir ${atlas_path}/build/lib 204 278 205 make_dylib libatlas { -lSystem }279 make_dylib libatlas ${lib_dir} ${arch} { -lSystem } 206 280 207 281 if {${ncpu} == "1" } { 208 282 # there are no threaded libraries (libpt*) on single-core machines 209 make_dylib libcblas { -latlas -lSystem }210 make_dylib libf77blas { -lgfortran -latlas -lSystem }283 make_dylib libcblas ${lib_dir} ${arch} { -latlas -lSystem } 284 make_dylib libf77blas ${lib_dir} ${arch} { -lgfortran -latlas -lSystem } 211 285 } else { 212 make_dylib libptcblas { -latlas -lSystem } 213 make_dylib libptf77blas { -lgfortran -latlas -lSystem } 286 make_dylib libptcblas ${lib_dir} ${arch} { -latlas -lSystem } 287 make_dylib libptf77blas ${lib_dir} ${arch} { -lgfortran -latlas -lSystem } 288 } 214 289 215 # we make soft links to the parallel built libs 216 system "cd ${destroot}${prefix}/lib && \ 217 ln -s ./libptcblas.dylib libcblas.dylib && \ 218 ln -s ./libptf77blas.dylib libf77blas.dylib" 290 make_dylib liblapack ${lib_dir} ${arch} { -lf77blas -lcblas -latlas -lgfortran -lgcc_s.1 -lSystem } 291 } 292 } 219 293 220 file delete ${destroot}/${prefix}/lib/libcblas.a 221 file delete ${destroot}/${prefix}/lib/libf77blas.a 222 } 294 pre-destroot { 295 if { [variant_isset universal] } { 296 set archs ${universal_archs_to_use} 297 } else { 298 set archs ${build_arch} 299 } 300 301 foreach arch ${archs} { 302 if { ! [variant_isset universal] } { 303 set atlas_path ${workpath}/${name}-${version} 304 set dest_path ${destroot}${prefix}/lib/ 305 } else { 306 set atlas_path ${workpath}/${name}-${version}-${arch} 307 set dest_path ${destroot}-${arch}${prefix}/lib/ 308 } 309 set lib_dir ${atlas_path}/build/lib 223 310 224 make_dylib liblapack { -lf77blas -lcblas -latlas -lgfortran -lgcc_s.1 -lSystem } 311 file mkdir ${dest_path} 312 eval xinstall -m 755 [glob ${lib_dir}/*.dylib] ${dest_path} 313 } 314 } 315 316 post-destroot { 317 if { ![file exists ${destroot}${prefix}/lib/libcblas.dylib] && [file exists ${destroot}${prefix}/lib/libptcblas.dylib]} { 318 ln -s libptcblas.dylib ${destroot}${prefix}/lib/libcblas.dylib 319 } 320 if { ![file exists ${destroot}${prefix}/lib/libf77blas.dylib] && [file exists ${destroot}${prefix}/lib/libptf77blas.dylib]} { 321 ln -s libptf77blas.dylib ${destroot}${prefix}/lib/libf77blas.dylib 322 } 225 323 } 226 324 227 325 livecheck.name math-atlas