Ticket #38735: R.Portfile.diff

File R.Portfile.diff, 14.9 KB (added by kjellpk (Kjell Konis), 8 years ago)
  • Portfile

    old new  
    1 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
    21# $Id: Portfile 104220 2013-03-21 03:37:44Z larryv@macports.org $
    32
    43PortSystem 1.0
    54
    6 name             R
    7 conflicts        R-framework
    8 version          2.15.3
    9 categories       math science
    10 maintainers      me.com:kjell.konis
    11 license          {GPL-2 GPL-3}
    12 platforms        darwin
     5set major 3
     6set minor 0
     7set point 0
     8
     9name                        R
     10version                     ${major}.${minor}.${point}
     11categories                  math science
     12maintainers                 me.com:kjell.konis
     13license                     {GPL-2 GPL-3}
     14platforms                   macosx
    1315
    14 description      R is GNU S - an interpreted language for statistical computing
     16description \
     17    R is GNU S - an interpreted language for statistical computing
    1518
    1619long_description \
    1720    R is a language and environment for statistical computing and graphics. \
     
    1922    classical statistical tests, time-series analysis, classification, \
    2023    clustering, ...) and graphical techniques, and is highly extensible.
    2124
    22 homepage         http://www.r-project.org/
     25homepage                    http://www.r-project.org/
    2326
    24 master_sites     http://cran.us.r-project.org/src/base/R-2/ \
    25                  http://cran.ms.unimelb.edu.au/src/base/R-2/ \
    26                  http://cran.at.r-project.org/src/base/R-2/ \
    27                  http://cran.hu.r-project.org/src/base/R-2/ \
    28                  http://cran.r-project.org/src/base/R-2/
    29 
    30 checksums        rmd160  d588100f075e3a370a2cd6400e3c61dcc5b7a09e \
    31                  sha256  c583a38f8dad3bc012c08116f4ba1eb2182cadfad4b0f8d7bd3cdba24bc255d6
    32 
    33 depends_build    port:pkgconfig
    34 
    35 depends_lib      port:gettext \
    36                  port:icu \
    37                  path:lib/pkgconfig/glib-2.0.pc:glib2 \
    38                  port:jpeg \
    39                  port:libiconv \
    40                  path:lib/pkgconfig/cairo.pc:cairo \
    41                  path:lib/pkgconfig/pango.pc:pango \
    42                  port:readline \
    43                  port:tcl \
    44                  port:tk \
    45                  port:tiff \
    46                  port:xorg-libXmu \
    47                  port:xorg-libXScrnSaver
     27master_sites                http://cran.us.r-project.org/src/base/R-3/ \
     28                            http://cran.ms.unimelb.edu.au/src/base/R-3/ \
     29                            http://cran.at.r-project.org/src/base/R-3/ \
     30                            http://cran.hu.r-project.org/src/base/R-3/ \
     31                            http://cran.r-project.org/src/base/R-3/
    4832
    49 universal_variant no
     33checksums                   rmd160  a2ad8818298cf29db4fe69df64d895769170694d \
     34                            sha256  dd65c24f1497610f3ff16008da99b4f52286d6424fbd61f08037c4f10f57ff16
    5035
    51 variant recommended description {Install recommended R packages} {
    52     configure.args-delete --without-recommended-packages
    53     configure.args-append --with-recommended-packages
    54 }
     36depends_build               port:pkgconfig
    5537
    56 variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 description {Build with gcc43} {
    57     configure.compiler macports-gcc-4.3
    58     depends_lib-append port:gcc43
    59 }
     38depends_lib                 port:readline \
     39                            port:icu \
     40                            port:libiconv
     41
     42universal_variant           no
    6043
    61 variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 description {Build with gcc44} {
    62     configure.compiler macports-gcc-4.4
    63     depends_lib-append port:gcc44
     44set resources ${frameworks_dir}/R.framework/Versions/${major}.${minor}/Resources
     45
     46post-patch {
     47    reinplace "s|R_HOME|\"${resources}\"|" "${worksrcpath}/src/unix/Rscript.c"
    6448}
    6549
    66 variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 description {Build with gcc45} {
    67     configure.compiler macports-gcc-4.5
    68     depends_lib-append port:gcc45
     50configure.pre_args          --prefix=${frameworks_dir}
     51
     52configure.cflags-append     -DOS_OBJECT_USE_OBJC=0
     53
     54configure.args              --enable-R-framework \
     55                            --enable-R-shlib \
     56                            --enable-BLAS-shlib \
     57                            --enable-openmp \
     58                            --with-readline \
     59                            --with-aqua \
     60                            --without-tcltk \
     61                            --without-cairo \
     62                            --with-libpng \
     63                            --without-jpeglib \
     64                            --without-recommended-packages \
     65                            --with-ICU \
     66                            --without-x \
     67                            --with-included-gettext
     68
     69variant cairo requires x11 description {Use cairo and pango} {
     70    depends_lib-append      path:lib/pkgconfig/cairo.pc:cairo \
     71                            path:lib/pkgconfig/pango.pc:pango \
     72                            path:lib/pkgconfig/glib-2.0.pc:glib2 \
     73                            port:freetype \
     74                            port:fontconfig \
     75                            port:gettext
     76    configure.args-delete   --without-cairo
     77    configure.args-append   --with-cairo
    6978}
    7079
    71 variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 description {Build with gcc46} {
    72     configure.compiler macports-gcc-4.6
    73     depends_lib-append port:gcc46
     80variant accelerate conflicts builtin_lapack description {build using the BLAS and Lapack in Apple's Accelerate framework} {
     81    configure.args-append   --with-blas="-framework vecLib" \
     82                            --with-lapack="-framework vecLib"
    7483}
    7584
    76 variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 description {Build with gcc46} {
    77     configure.compiler macports-gcc-4.7
    78     depends_lib-append port:gcc47
     85variant builtin_lapack conflicts accelerate description {build using reference BLAS and Lapack} {
     86    configure.args-append   --without-blas --without-lapack
    7987}
    8088
    81 variant debug description {Build with debug symbols} {
     89variant debug description {build with debug symbols} {
    8290    configure.optflags-append -g
    8391}
    8492
    85 variant aqua description {Enable quartz graphics device} {
    86     if {${os.platform} == "darwin" && ${os.major} == 10} {
    87         # This variant uses a hack in "CFString.h" that does not define the problematic CF_FORMAT_FUNCTION
    88         # and CF_FORMAT_ARGUMENT macros if __INTEL_COMPILER is defined. Currently, that is the ONLY place
    89         # in the 10.6 SDK where the __INTEL_COMPILER macro is checked, but that may change in the future.
    90         # We also need to use Apple's ObjC compiler for the single "qdCocoa.m" file.
    91         configure.args-delete   --without-aqua
    92         configure.args-append   --with-aqua
    93         patchfiles-append       patch-QuartzDevice_h.diff
    94         configure.objc          /usr/bin/gcc-4.2
    95     } else {
    96         ui_error "The +aqua variant is for Snow Leopard (Mac OS X 10.6) only - for Aqua support on Lion (Mac OS X 10.7) use the R-framework port"
    97         return -code error "incompatible variant"
    98     }
     93variant gcc45 conflicts gcc46 gcc47 description {build with gcc45} {
     94    depends_lib-append      port:gcc45
     95    configure.compiler      macports-gcc-4.5
     96    configure.objc          /usr/bin/gcc
     97    configure.env-append    "OBJCXX=/usr/bin/g++"
     98}
     99
     100variant gcc46 conflicts gcc45 gcc47 description {build with gcc46} {
     101    depends_lib-append      port:gcc46
     102    configure.compiler      macports-gcc-4.6
     103    configure.objc          /usr/bin/gcc
     104    configure.env-append    "OBJCXX=/usr/bin/g++"
     105}
     106
     107variant gcc47 conflicts gcc45 gcc46 description {build with gcc47} {
     108    depends_lib-append      port:gcc47
     109    configure.compiler      macports-gcc-4.7
     110    configure.objc          /usr/bin/gcc
     111    configure.env-append    "OBJCXX=/usr/bin/g++"
    99112}
    100113
    101 default_variants +recommended
     114variant recommended description {Install recommended R packages} {
     115    configure.args-delete   --without-recommended-packages
     116    configure.args-append   --with-recommended-packages
     117}
    102118
    103 if {![variant_isset gcc42] && ![variant_isset gcc43] && ![variant_isset gcc44] &&
    104     ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47]} {
    105     default_variants-append +gcc47
     119variant tcltk requires x11 description {Use tcltk} {
     120    depends_lib-append      port:tcl \
     121                            port:tk \
     122                            port:xorg-libXScrnSaver \
     123                            port:xorg-libXext
     124    configure.args-delete   --without-tcltk
     125    configure.args-append   --with-tcltk \
     126                            --with-tcl-config=${prefix}/lib/tclConfig.sh \
     127                            --with-tk-config=${prefix}/lib/tkConfig.sh
     128}
     129
     130variant x11 description {
     131    depends_lib-append      port:xorg-libsm \
     132                            port:xorg-libice \
     133                            port:xorg-libX11 \
     134                            port:xorg-libXt \
     135                            port:tiff \
     136                            port:jpeg \
     137                            port:libpng \
     138                            port:zlib
     139    configure.args-delete   --without-x \
     140                            --without-jpeglib
     141    configure.args-append   --with-x \
     142                            --with-jpeglib \
     143                            --x-include=${prefix}/include/X11 \
     144                            --x-lib=${prefix}/lib
    106145}
    107146
    108 post-patch {
    109   reinplace "s|R_HOME|\"${prefix}/lib/R\"|" "${worksrcpath}/src/unix/Rscript.c"
     147default_variants +cairo +recommended +x11
     148
     149if {![variant_isset accelerate] && ![variant_isset builtin_lapack]} {
     150    default_variants-append +accelerate
    110151}
    111152
    112 configure.env-append r_arch=${build_arch}
     153if {![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47]} {
     154    default_variants-append +gcc47
     155}
    113156
    114 configure.args   --mandir=\\\${prefix}/share/man \
    115                  --enable-BLAS-shlib \
    116                  --enable-R-shlib \
    117                  --disable-nls \
    118                  --disable-R-framework \
    119                  --without-aqua \
    120                  --with-tcl-config=${prefix}/lib/tclConfig.sh \
    121                  --with-tk-config=${prefix}/lib/tkConfig.sh \
    122                  --x-include=${prefix}/include \
    123                  --x-lib=${prefix}/lib \
    124                  --without-recommended-packages
    125 
    126 test.run         yes
    127 test.target      check
    128 destroot.destdir prefix=${destroot}${prefix}
     157destroot.destdir prefix=${destroot}${frameworks_dir}
    129158
    130159post-destroot {
    131   foreach r { "/bin/R" "/lib/R/bin/R" } {
     160    move ${destroot}${frameworks_dir}/lib/pkgconfig/libR.pc ${destroot}${prefix}/lib/pkgconfig/libR.pc
     161
     162    foreach v { "rhome" "rincludedir" } {
     163        reinplace "s|${v}=${destroot}|${v}=|" "${destroot}${prefix}/lib/pkgconfig/libR.pc"
     164    }
     165
    132166    foreach dir { "R_HOME_DIR" "R_SHARE_DIR" "R_INCLUDE_DIR" "R_DOC_DIR" } {
    133       reinplace "s|${dir}=${destroot}|${dir}=|" "${destroot}${prefix}${r}"
     167        reinplace "s|${dir}=${destroot}|${dir}=|" "${destroot}${resources}/bin/R"
     168    }
     169
     170    reinplace "s|-F${destroot}|-F|" "${destroot}${resources}/etc/Makeconf"
     171
     172    foreach dylib [ exec find ${destroot}${frameworks_dir}/R.framework -name "\*.dylib" ] {
     173        regsub ":$" ${dylib} "" destroot_dylib_path
     174        regsub ${destroot} ${destroot_dylib_path} "" dylib_path
     175        system "install_name_tool -id ${dylib_path} ${destroot_dylib_path}"
     176        system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
     177            ${destroot_dylib_path}"
     178        system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
     179            ${destroot_dylib_path}"
     180        system "install_name_tool -change ${destroot}${resources}/lib/libRlapack.dylib ${resources}/lib/libRlapack.dylib \
     181            ${destroot_dylib_path}"
     182    }
     183
     184    foreach so [ exec find ${destroot}${frameworks_dir}/R.framework -name "\*.so" ] {
     185        regsub ":$" ${so} "" destroot_so_path
     186        regsub ${destroot} ${destroot_so_path} "" so_path
     187        system "install_name_tool -id ${so_path} ${destroot_so_path}"
     188        system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
     189            ${destroot_so_path}"
     190        system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
     191            ${destroot_so_path}"
     192        system "install_name_tool -change ${destroot}${resources}/lib/libRlapack.dylib ${resources}/lib/libRlapack.dylib \
     193            ${destroot_so_path}"
    134194    }
    135   }
    136195
    137   foreach v { "rhome" "rincludedir" } {
    138     reinplace "s|${v}=${destroot}|${v}=|" "${destroot}${prefix}/lib/pkgconfig/libR.pc"
    139   }
    140 
    141   foreach dylib [ exec find ${destroot}${prefix}/lib/R/lib/${build_arch} -name "\*.dylib" ] {
    142     regsub ":$" ${dylib} "" destroot_dylib_path
    143     regsub ${destroot} ${destroot_dylib_path} "" dylib_path
    144     system "install_name_tool -id ${dylib_path} ${destroot_dylib_path}"
    145     system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/${build_arch}/libR.dylib \
    146       ${destroot_dylib_path}"
    147     system "install_name_tool -change libRblas.dylib ${prefix}/lib/R/lib/${build_arch}/libRblas.dylib \
    148       ${destroot_dylib_path}"
    149     system "install_name_tool -change libRlapack.dylib ${prefix}/lib/R/lib/${build_arch}/libRlapack.dylib \
    150       ${destroot_dylib_path}"
    151   }
    152 
    153   foreach so [ exec find ${destroot}${prefix}/lib/R -name "\*.so" ] {
    154     regsub ":$" ${so} "" destroot_so_path
    155     regsub ${destroot} ${destroot_so_path} "" so_path
    156     system "install_name_tool -id ${so_path} ${destroot_so_path}"
    157     system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/${build_arch}/libR.dylib \
    158       ${destroot_so_path}"
    159     system "install_name_tool -change libRblas.dylib ${prefix}/lib/R/lib/${build_arch}/libRblas.dylib \
    160       ${destroot_so_path}"
    161     system "install_name_tool -change libRlapack.dylib ${prefix}/lib/R/lib/${build_arch}/libRlapack.dylib \
    162       ${destroot_so_path}"
    163   }
    164 
    165   system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/${build_arch}/libR.dylib \
    166     ${destroot}${prefix}/lib/R/bin/exec/${build_arch}/R"
    167   system "install_name_tool -change libRblas.dylib ${prefix}/lib/R/lib/${build_arch}/libRblas.dylib \
    168     ${destroot}${prefix}/lib/R/bin/exec/${build_arch}/R"
     196    system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
     197        ${destroot}${resources}/bin/exec/R"
     198    system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
     199        ${destroot}${resources}/bin/exec/R"
    169200
    170   reinplace "s|-dylib_file libRblas\.dylib:\$\(R_HOME\)/lib\$\(R_ARCH\)/libRblas\.dylib| |" \
    171             "${destroot}${prefix}/lib/R/etc/${build_arch}/Makeconf"
     201    ln -s ${resources}/bin/R ${destroot}${prefix}/bin/R
     202    ln -s ${resources}/bin/Rscript ${destroot}${prefix}/bin/Rscript
    172203}
    173204
    174205livecheck.type      regex
    175206livecheck.url       [lindex ${master_sites} 0]
    176207livecheck.regex     >${name}-(\[0-9.\]+)${extract.suffix}<
     208
     209
     210