source: trunk/dports/math/R/Portfile @ 135232

Last change on this file since 135232 was 135232, checked in by ryandesign@…, 5 years ago

icu: update to 55.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.4 KB
Line 
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
2# $Id: Portfile 135232 2015-04-20 00:15:39Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup active_variants 1.1
6
7name                        R
8
9set major 3
10set minor 1
11set point 2
12
13#Remember to remove revision line when bumping version
14version                     ${major}.${minor}.${point}
15revision                    1
16
17categories                  math science
18maintainers                 me.com:kjell.konis
19license                     {GPL-2 GPL-3}
20platforms                   macosx
21
22description \
23    R is GNU S - an interpreted language for statistical computing
24
25long_description \
26    R is a language and environment for statistical computing and graphics. \
27    R provides a wide variety of statistical (linear and nonlinear modeling, \
28    classical statistical tests, time-series analysis, classification, \
29    clustering, ...) and graphical techniques, and is highly extensible.
30
31homepage                    http://www.r-project.org/
32
33master_sites                http://cran.rstudio.com/src/base/R-3/ \
34                            http://cran.r-project.org/src/base/R-3/
35
36checksums                   rmd160  b2aaa42daac1ae5d114995de514d211d78a4e0a6 \
37                            sha256  bcd150afcae0e02f6efb5f35a6ab72432be82e849ec52ce0bb89d8c342a8fa7a
38
39depends_build               port:pkgconfig
40
41depends_lib                 port:readline \
42                            port:icu \
43                            port:libiconv
44
45universal_variant           no
46
47set resources ${frameworks_dir}/R.framework/Versions/${major}.${minor}/Resources
48
49post-patch {
50    reinplace "s|R_HOME|\"${resources}\"|" "${worksrcpath}/src/unix/Rscript.c"
51}
52
53configure.pre_args          --prefix=${frameworks_dir}
54
55configure.args              --enable-R-framework \
56                            --enable-R-shlib \
57                            --enable-BLAS-shlib \
58                            --disable-openmp \
59                            --with-readline \
60                            --with-aqua \
61                            --without-tcltk \
62                            --without-cairo \
63                            --with-libpng \
64                            --without-jpeglib \
65                            --without-recommended-packages \
66                            --with-ICU \
67                            --without-x \
68                            --with-included-gettext \
69                            --without-internal-tzcode
70
71platform darwin 13 {
72    configure.cflags-append -flax-vector-conversions
73}
74
75variant accelerate conflicts builtin_lapack description {build using the BLAS and Lapack in Apple's Accelerate framework} {
76    configure.args-append   --with-blas="-framework Accelerate" \
77                            --with-lapack="-framework Accelerate"
78}
79
80variant atlas conflicts accelerate builtin_lapack description {build using the BLAS in the atlas port} {
81    depends_lib-append      port:atlas
82    configure.args-append   --with-blas="-L${prefix}/lib -lptf77blas -latlas"
83    #See A.3.2 in R Installation and Administration for why atlas LAPACK not used
84}
85
86variant builtin_lapack conflicts accelerate description {build using reference BLAS and Lapack} {
87    configure.args-append   --without-blas --without-lapack
88}
89
90variant cairo description {use cairo and pango} {
91    depends_lib-append      path:lib/pkgconfig/cairo.pc:cairo \
92                            path:lib/pkgconfig/pango.pc:pango \
93                            path:lib/pkgconfig/glib-2.0.pc:glib2 \
94                            port:freetype \
95                            port:fontconfig \
96                            port:gettext
97    configure.args-delete   --without-cairo
98    configure.args-append   --with-cairo
99}
100
101variant debug description {build with debug symbols} {
102    configure.optflags-append -g
103}
104
105set gcc_versions {4.5 4.6 4.7 4.8 4.9}
106set default_fortran_variant +gfortran48
107
108foreach ver ${gcc_versions} {
109    set ver_no_dot [join [split ${ver} "."] ""]
110
111    set variant_line {variant gfortran${ver_no_dot} description "build with gfortran from gcc${ver_no_dot}"}
112
113    foreach over ${gcc_versions} {
114        if {${ver} == ${over}} {
115            continue
116        }
117
118        set over_no_dot [join [split ${over} "."] ""]
119        append variant_line " conflicts gfortran${over_no_dot}"
120    }
121    append variant_line { {}}
122
123    eval $variant_line
124
125    if {[variant_isset gfortran${ver_no_dot}]} {
126        if {${default_fortran_variant} != "+gfortran${ver_no_dot}"} {
127            set default_fortran_variant ""
128        }
129    }
130}
131
132if {${default_fortran_variant} != ""} {
133    default_variants-append "${default_fortran_variant}"
134}
135
136foreach ver ${gcc_versions} {
137    set ver_no_dot [join [split ${ver} "."] ""]
138
139    if {[variant_isset gfortran${ver_no_dot}]} {
140        depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
141        depends_build-append port:gcc${ver_no_dot}
142
143        configure.fc  ${prefix}/bin/gfortran-mp-${ver}
144        configure.f77 ${prefix}/bin/gfortran-mp-${ver}
145        configure.f90 ${prefix}/bin/gfortran-mp-${ver}
146    }
147}
148
149variant recommended description {install recommended R packages} {
150    configure.args-delete   --without-recommended-packages
151    configure.args-append   --with-recommended-packages
152}
153
154variant tcltk requires x11 description {enable use of tcltk} {
155    depends_lib-append      port:tcl \
156                            port:tk \
157                            port:xorg-libXScrnSaver \
158                            port:xorg-libXext
159    require_active_variants path:lib/pkgconfig/tk.pc:tk x11
160    configure.args-delete   --without-tcltk
161    configure.args-append   --with-tcltk \
162                            --with-tcl-config=${prefix}/lib/tclConfig.sh \
163                            --with-tk-config=${prefix}/lib/tkConfig.sh
164}
165
166variant tests description {include tests of R installation} {
167    destroot.target-append install-tests
168}
169
170variant x11 description {enable use of x11} {
171    depends_lib-append      port:xorg-libsm \
172                            port:xorg-libice \
173                            port:xorg-libX11 \
174                            port:xorg-libXt \
175                            port:tiff \
176                            port:jpeg \
177                            port:libpng \
178                            port:zlib
179    configure.args-delete   --without-x \
180                            --without-jpeglib
181    configure.args-append   --with-x \
182                            --with-jpeglib \
183                            --x-include=${prefix}/include/X11 \
184                            --x-lib=${prefix}/lib
185}
186
187default_variants +cairo +recommended +x11
188
189if {[variant_isset cairo] && [variant_isset x11]} {
190    require_active_variants path:lib/pkgconfig/cairo.pc:cairo x11
191    require_active_variants path:lib/pkgconfig/pango.pc:pango x11
192}
193
194if {![variant_isset accelerate] && ![variant_isset atlas] && ![variant_isset builtin_lapack]} {
195    default_variants-append +accelerate
196}
197
198test.run                    yes
199test.target                 check
200
201destroot.destdir prefix=${destroot}${frameworks_dir}
202
203post-destroot {
204    move ${destroot}${frameworks_dir}/lib/pkgconfig/libR.pc ${destroot}${prefix}/lib/pkgconfig/libR.pc
205
206    foreach v { "rhome" "rincludedir" } {
207        reinplace "s|${v}=${destroot}|${v}=|" "${destroot}${prefix}/lib/pkgconfig/libR.pc"
208    }
209
210    foreach dir { "R_HOME_DIR" "R_SHARE_DIR" "R_INCLUDE_DIR" "R_DOC_DIR" } {
211        reinplace "s|${dir}=${destroot}|${dir}=|" "${destroot}${resources}/bin/R"
212    }
213
214    reinplace "s|-F${destroot}|-F|" "${destroot}${resources}/etc/Makeconf"
215
216    foreach dylib [ exec find ${destroot}${frameworks_dir}/R.framework -name "\*.dylib" ] {
217        regsub ":$" ${dylib} "" destroot_dylib_path
218        regsub ${destroot} ${destroot_dylib_path} "" dylib_path
219        system "install_name_tool -id ${dylib_path} ${destroot_dylib_path}"
220        system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
221            ${destroot_dylib_path}"
222        system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
223            ${destroot_dylib_path}"
224        system "install_name_tool -change ${destroot}${resources}/lib/libRlapack.dylib ${resources}/lib/libRlapack.dylib \
225            ${destroot_dylib_path}"
226    }
227
228    foreach so [ exec find ${destroot}${frameworks_dir}/R.framework -name "\*.so" ] {
229        regsub ":$" ${so} "" destroot_so_path
230        regsub ${destroot} ${destroot_so_path} "" so_path
231        system "install_name_tool -id ${so_path} ${destroot_so_path}"
232        system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
233            ${destroot_so_path}"
234        system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
235            ${destroot_so_path}"
236        system "install_name_tool -change ${destroot}${resources}/lib/libRlapack.dylib ${resources}/lib/libRlapack.dylib \
237            ${destroot_so_path}"
238    }
239
240    system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
241        ${destroot}${resources}/bin/exec/R"
242    system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
243        ${destroot}${resources}/bin/exec/R"
244
245    ln -s ${resources}/bin/R ${destroot}${prefix}/bin/R
246    ln -s ${resources}/bin/Rscript ${destroot}${prefix}/bin/Rscript
247}
248
249livecheck.type      regex
250livecheck.url       [lindex ${master_sites} 0]
251livecheck.regex     >${name}-(\[0-9.\]+)${extract.suffix}<
Note: See TracBrowser for help on using the repository browser.