Ticket #23349: atlas-mp-23349.diff

File atlas-mp-23349.diff, 5.1 KB (added by mklein-de (Michael Klein), 15 years ago)

Portfile patch

  • files/patch-build-Make.top.diff

     
    1 --- Make.top.old        2009-01-24 15:06:37.000000000 -0800
    2 +++ Make.top    2009-01-24 15:08:49.000000000 -0800
    3 @@ -289,14 +289,11 @@
    4         cp $(INCAdir)/* $(INSTdir)/atlas/.
    5         - chmod 0644 $(INSTdir)/atlas/*
    6  install_lib:
    7 -       cp $(LIBdir)/libatlas.a $(INSTdir)/.
    8 -       cp $(LIBdir)/libcblas.a $(INSTdir)/.
    9 -       cp $(LIBdir)/liblapack.a $(INSTdir)/.
    10 -       chmod 0644 $(INSTdir)/libatlas.a  $(INSTdir)/liblapack.a \
    11 -                   $(INSTdir)/libcblas.a
    12 -       - cp $(LIBdir)/libf77blas.a $(INSTdir)/.
    13 -       - chmod 0644 $(INSTdir)/libf77blas.a
    14 -       - cp $(LIBdir)/libptcblas.a $(INSTdir)/.
    15 -       - cp $(LIBdir)/libptf77blas.a $(INSTdir)/.
    16 -       - chmod 0644 $(INSTdir)/libptcblas.a $(INSTdir)/libptf77blas.a
    17 +       cp $(LIBdir)/libatlas.dylib $(INSTdir)/.
    18 +       cp $(LIBdir)/libptcblas.dylib $(INSTdir)/.
    19 +       cp $(LIBdir)/liblapack.dylib $(INSTdir)/.
    20 +       chmod 0644 $(INSTdir)/libatlas.dylib  $(INSTdir)/liblapack.dylib \
    21 +                   $(INSTdir)/libptcblas.dylib
    22 +       - cp $(LIBdir)/libptf77blas.dylib $(INSTdir)/.
    23 +       - chmod 0644 $(INSTdir)/libptf77blas.dylib
    24  
  • Portfile

     
    4242                    rmd160  e8fabba2fdd944afbc02a83599cf45a0d721030d
    4343
    4444
    45 # the following patch corrects extension conventions for osx's dynamic libs
    46 set make_patch      patch-build-Make.top.diff
    4745use_parallel_build  no
    48 build.target build
     46build.target        build
    4947build.dir           ${workpath}/${name}-${version}/build
    5048
    5149destroot.dir        ${build.dir}
     
    167165    # recursively remove directories
    168166    ui_debug "reinplace for make to recursively remove directories on clean"
    169167    reinplace "s|rm -f|rm -rf|g" ${workpath}/${name}-${version}/build/Makefile
     168}
    170169
    171     ui_debug "patch ${name}-${version}/build/Make.top to install dynamic libs"
    172     system "cd ${worksrcpath}/build/ && \
    173             patch -p0 < ${filespath}/${make_patch}"
     170proc make_dylib { lib libs } {
     171    global destroot prefix myarch
     172    system "cd ${destroot}/${prefix}/lib && \
     173            ( test ! -e ${lib}.a ||
     174              ld -arch ${myarch} -dynamic -dylib -single_module -dead_strip \
     175              -x -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o \
     176              -dylib_install_name ${prefix}/lib/${lib}.dylib \
     177              ${lib}.a -o ${lib}.dylib ${libs} && rm -f ${lib}.a)"
    174178}
    175179
    176 pre-destroot {
     180
     181post-destroot {
    177182  # We have to manually create the dylib shared libs as the default build does not do this
     183  global myarch
     184
    178185  if {[string equal "${os.arch}" "powerpc"]} {
    179186    if {${my_arch} == "64" } {
    180187      set myarch "ppc64"
    181188    } else {
    182189      set myarch "ppc"
    183190    }
     191  } else {
     192    if {${my_arch} == "64" } {
     193      set myarch "x86_64"
    184194    } else {
    185       if {${my_arch} == "64" } {
    186         set myarch "x86_64"
    187       } else {
    188         set myarch "i386"
    189       }
     195      set myarch "i386"
    190196    }
     197  }
    191198
    192   set ld "ld -arch ${myarch} -dynamic -dylib -single_module -dead_strip -x \
    193           -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o -dylib_install_name"
     199  set ncpu [exec sysctl -n hw.ncpu]
    194200
    195   system "cd ${workpath}/${name}-${version}/build/lib && \
    196           ${ld} ${prefix}/lib/libatlas.dylib libatlas.a -o libatlas.dylib \
    197            -lSystem"
     201  make_dylib libatlas { -lSystem }
    198202
    199   system "cd ${workpath}/${name}-${version}/build/lib && \
    200           ${ld} ${prefix}/lib/libptcblas.dylib libptcblas.a -o \
    201            libptcblas.dylib -latlas \
    202            -lSystem"
     203  if {${ncpu} == "1" } {
     204    # there are no threaded libraries (libpt*) on single-core machines
     205    make_dylib libcblas   { -latlas -lSystem }
     206    make_dylib libf77blas { -lgfortran -latlas -lSystem }
     207  } else {
     208    make_dylib libptcblas   { -latlas -lSystem }
     209    make_dylib libptf77blas { -lgfortran -latlas -lSystem }
    203210
    204   system "cd ${workpath}/${name}-${version}/build/lib && \
    205           ${ld} ${prefix}/lib/libptf77blas.dylib \
    206           libptf77blas.a -o libptf77blas.dylib \
    207            -lgfortran -latlas -lSystem"
     211    # we make soft links to the parallel built libs
     212    system "cd ${destroot}${prefix}/lib && \
     213            ln -s ./libptcblas.dylib libcblas.dylib && \
     214            ln -s ./libptf77blas.dylib libf77blas.dylib"
    208215
    209   system "cd ${workpath}/${name}-${version}/build/lib && \
    210           ${ld} ${prefix}/lib/liblapack.dylib liblapack.a -o liblapack.dylib \
    211            -lptf77blas -lgfortran -lptcblas -latlas -lgcc_s.1 -lSystem"
     216    file delete ${destroot}/${prefix}/lib/libcblas.a
     217    file delete ${destroot}/${prefix}/lib/libf77blas.a
     218  }
    212219
     220  make_dylib liblapack { -lf77blas -lcblas -latlas -lgfortran -lgcc_s.1 -lSystem }
    213221}
    214222
    215 post-destroot {
    216   # we make soft links to the parallel built libs
    217   system "cd ${destroot}${prefix}/lib && \
    218           ln -sf ./libptcblas.dylib libcblas.dylib && \
    219           ln -sf ./libptf77blas.dylib libf77blas.dylib"
    220 }
    221 
    222223livecheck.name      math-atlas
    223224livecheck.distname  Stable