30 | | build.args all home=${worksrcpath} |
31 | | destroot { |
32 | | xinstall -m 644 -v -W ${worksrcpath} libarpack.a ${destroot}${prefix}/lib |
| 27 | |
| 28 | # Fortran compilers can not cross-compile |
| 29 | if { ${os.arch}=="i386" } { |
| 30 | set universal_archs_supported "i386 x86_64" |
| 31 | } else { |
| 32 | set universal_archs_supported "ppc ppc64" |
| 33 | } |
| 34 | |
| 35 | if { ! [variant_isset universal]} { |
| 36 | build.args-append home=${worksrcpath} |
| 37 | if { ${build_arch}=="x86_64" || ${build_arch}=="ppc64" } { |
| 38 | build.args-append FFLAGS='-O2 -m64' |
| 39 | } else { |
| 40 | build.args-append FFLAGS='-O2 -m32' |
| 41 | } |
| 42 | } else { |
| 43 | foreach arch {x86_64 i386 ppc ppc64} { |
| 44 | set merger_build_args(${arch}) home=${worksrcpath}-${arch} |
| 45 | if { ${arch}=="x86_64" || ${arch}=="ppc64" } { |
| 46 | lappend merger_build_args(${arch}) FFLAGS='-O2 -m64' |
| 47 | } else { |
| 48 | lappend merger_build_args(${arch}) FFLAGS='-O2 -m32' |
| 49 | } |
| 50 | } |
| 51 | |
34 | | post-destroot { |
35 | | system "ranlib ${destroot}${prefix}/lib/libarpack.a" |
| 53 | |
| 54 | proc make_dylib { name lib_dir arch libs curVer } { |
| 55 | global destroot prefix gccnumber |
| 56 | |
| 57 | set comVer [join [lrange [split ${curVer} '.'] 0 0] '.'] |
| 58 | |
| 59 | set cmd "\ |
| 60 | /usr/bin/ld -arch ${arch} -dynamic -dylib -single_module -dead_strip \ |
| 61 | -x -all_load -L. -L${prefix}/lib/gcc${gccnumber}/${arch} -L${prefix}/lib/gcc${gccnumber} -L${prefix}/lib \ |
| 62 | -dylib_install_name ${prefix}/lib/lib${name}.${comVer}.dylib \ |
| 63 | -current_version ${curVer} \ |
| 64 | -compatibility_version ${comVer} \ |
| 65 | lib${name}.a -o lib${name}.${curVer}.dylib ${libs}" |
| 66 | |
| 67 | system "cd ${lib_dir} && ${cmd}" |
| 68 | } |
| 69 | |
| 70 | pre-build { |
| 71 | build.args-append FC=${configure.fc} MAKE=${build.cmd} |
| 72 | } |
| 73 | |
| 74 | post-build { |
| 75 | set curVer ${version} |
| 76 | set comVer [join [lrange [split ${version} '.'] 0 1 ] '.'] |
| 77 | |
| 78 | if { ![variant_isset universal] } { |
| 79 | set archs ${build_arch} |
| 80 | } else { |
| 81 | set archs ${universal_archs_to_use} |
| 82 | } |
| 83 | |
| 84 | foreach arch ${archs} { |
| 85 | if { ![variant_isset universal] } { |
| 86 | set dir ${worksrcpath} |
| 87 | } else { |
| 88 | set dir ${worksrcpath}-${arch} |
| 89 | } |
| 90 | |
| 91 | make_dylib arpack ${dir} ${arch} "-latlas -llapack -lgfortran -lSystem" ${version} |
| 92 | |
| 93 | if { [variant_isset mpi] } { |
| 94 | make_dylib parpack ${dir} ${arch} "-llapack -lgfortran -lmpi_f77 -lSystem -larpack.1" ${version} |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | post-configure { |
| 100 | if { [variant_isset mpi] } { |
| 101 | set stlibs "libarpack.a libparpack.a" |
| 102 | set shlibs "libarpack.1.dylib libparpack.1.dylib" |
| 103 | } else { |
| 104 | set stlibs "libarpack.a" |
| 105 | set shlibs "libarpack.1.dylib" |
| 106 | } |
| 107 | |
| 108 | if { ![variant_isset universal] } { |
| 109 | set fl [open ${worksrcpath}/Makefile "a"] |
| 110 | puts ${fl} "\n.PHONY install" |
| 111 | puts ${fl} "\t.install: ${stlibs} ${shlibs}" |
| 112 | foreach lib ${stlibs} { |
| 113 | puts ${fl} "\tinstall -m 644 -v ${lib}" |
| 114 | } |
| 115 | foreach lib ${shlibs} { |
| 116 | puts ${fl} "\tinstall -m 755 -v ${lib}" |
| 117 | } |
| 118 | close ${fl} |
| 119 | } else { |
| 120 | foreach arch ${universal_archs_to_use} { |
| 121 | set fl [open ${worksrcpath}-${arch}/Makefile "a"] |
| 122 | puts ${fl} "\n.PHONY: install" |
| 123 | puts ${fl} "install: ${stlibs} ${shlibs}" |
| 124 | foreach lib ${stlibs} { |
| 125 | puts ${fl} "\tinstall -m 644 -v ${lib} ${destroot}-${arch}${prefix}/lib" |
| 126 | } |
| 127 | foreach lib ${shlibs} { |
| 128 | puts ${fl} "\tinstall -m 755 -v ${lib} ${destroot}-${arch}${prefix}/lib" |
| 129 | } |
| 130 | close ${fl} |
| 131 | } |
| 132 | } |