source: trunk/dports/math/R/Portfile

Last change on this file was 148653, checked in by khindenburg@…, 19 months ago

R: update to 3.3.0 maintainer #51343

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.2 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 148653 2016-05-13 15:50:12Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup compilers 1.0
6PortGroup active_variants 1.1
7
8name                        R
9
10set major 3
11set minor 3
12set point 0
13
14#Remember to remove revision line when bumping version
15version                     ${major}.${minor}.${point}
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  006ae5ae4899fa8adb4079f5f60163572d1e5e98 \
37                    sha256  9256b154b1a5993d844bee7b1955cd49c99ad72cef03cce3cd1bdca1310311e4
38
39compilers.choose            fc f77
40compilers.setup             require_fortran
41
42depends_build               port:pkgconfig
43
44depends_lib                 port:readline \
45                            port:icu \
46                            port:libiconv \
47                            port:zlib \
48                            port:xz
49
50universal_variant           no
51
52set resources ${frameworks_dir}/R.framework/Versions/${major}.${minor}/Resources
53
54post-patch {
55    reinplace "s|R_HOME|\"${resources}\"|" "${worksrcpath}/src/unix/Rscript.c"
56
57    ## Check to see if this is fixed post 3.3.0
58    reinplace "s|<libintl.h>|\"libintl.h\"|" "${worksrcpath}/src/include/Defn.h"
59}
60
61# Note: gcc cannot be used for the C compiler. It will give:
62#:info:build In file included from /usr/include/dispatch/dispatch.h:51:0,
63#:info:build                  from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
64#:info:build                  from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
65#:info:build                  from langprefs.c:30:
66#:info:build /usr/include/dispatch/object.h:143:15: error: expected identifier or '(' before '^' token
67#:info:build  typedef void (^dispatch_block_t)(void);
68#:info:build                ^
69#:info:build /usr/include/dispatch/object.h:362:3: error: unknown type name 'dispatch_block_t'
70#:info:build    dispatch_block_t notification_block);
71#:info:build    ^
72# However, use of compiler.blacklist *gcc* would remove the GCC Fortran compilers too.
73
74configure.pre_args          --prefix=${frameworks_dir}
75
76configure.args              --enable-R-framework \
77                            --enable-memory-profiling \
78                            --enable-R-shlib \
79                            --enable-BLAS-shlib \
80                            --without-tcltk \
81                            --without-cairo \
82                            --with-system-zlib \
83                            --without-internal-tzcode \
84                            --without-recommended-packages \
85                            --without-x \
86                            --with-included-gettext
87
88if {${os.major} < 13} {
89    configure.args-append --disable-openmp
90}
91
92platform darwin 13 {
93    configure.cflags-append -flax-vector-conversions
94}
95
96variant accelerate conflicts atlas builtin_lapack description {build using the BLAS and Lapack in Apple's Accelerate framework} {
97    configure.args-append   --with-blas="-framework Accelerate" --with-lapack
98}
99
100variant atlas conflicts accelerate builtin_lapack description {build using the BLAS in the atlas port} {
101    depends_lib-append      port:atlas
102    configure.args-append   --with-blas="-L${prefix}/lib -lptf77blas -latlas"
103    #See A.3.2 in R Installation and Administration for why atlas LAPACK not used
104}
105
106variant builtin_lapack conflicts accelerate atlas description {build using reference BLAS and Lapack} {
107    configure.args-append   --without-blas --without-lapack
108}
109
110variant cairo description {use cairo and pango} {
111    depends_lib-append      path:lib/pkgconfig/cairo.pc:cairo \
112                            path:lib/pkgconfig/pango.pc:pango \
113                            path:lib/pkgconfig/glib-2.0.pc:glib2 \
114                            port:freetype \
115                            port:fontconfig \
116                            port:gettext \
117                            port:libpng \
118                            port:tiff \
119                            port:jpeg
120    configure.args-delete   --without-cairo
121    configure.args-append   --with-cairo
122}
123
124variant debug description {build with debug symbols} {
125    configure.optflags-append -g
126}
127
128variant recommended description {install recommended R packages} {
129    configure.args-delete   --without-recommended-packages
130    configure.args-append   --with-recommended-packages
131}
132
133variant tcltk requires x11 description {enable use of tcltk} {
134    depends_lib-append      port:tcl \
135                            port:tk \
136                            port:xorg-libXScrnSaver \
137                            port:xorg-libXext
138    require_active_variants tk x11
139    configure.args-delete   --without-tcltk
140    configure.args-append   --with-tcltk \
141                            --with-tcl-config=${prefix}/lib/tclConfig.sh \
142                            --with-tk-config=${prefix}/lib/tkConfig.sh
143}
144
145variant tests description {include tests of R installation} {
146    destroot.target-append install-tests
147}
148
149variant x11 description {enable use of x11} {
150    depends_lib-append      port:xorg-libsm \
151                            port:xorg-libice \
152                            port:xorg-libX11 \
153                            port:xorg-libXt \
154                            port:tiff \
155                            port:jpeg \
156                            port:libpng
157    configure.args-delete   --without-x \
158                            --without-jpeglib
159    configure.args-append   --with-x \
160                            --with-jpeglib \
161                            --x-include=${prefix}/include/X11 \
162                            --x-lib=${prefix}/lib
163}
164
165default_variants +cairo +recommended +x11
166
167if {[variant_isset cairo] && [variant_isset x11]} {
168    require_active_variants path:lib/pkgconfig/cairo.pc:cairo x11
169    require_active_variants path:lib/pkgconfig/pango.pc:pango x11
170}
171
172if {![variant_isset accelerate] && ![variant_isset atlas] && ![variant_isset builtin_lapack]} {
173    default_variants-append +builtin_lapack
174}
175
176test.run                    yes
177test.target                 check
178
179destroot.destdir prefix=${destroot}${frameworks_dir}
180
181post-destroot {
182    move ${destroot}${frameworks_dir}/lib/pkgconfig/libR.pc ${destroot}${prefix}/lib/pkgconfig/libR.pc
183
184    foreach v { "rhome" "rincludedir" } {
185        reinplace "s|${v}=${destroot}|${v}=|" "${destroot}${prefix}/lib/pkgconfig/libR.pc"
186    }
187
188    foreach dir { "R_HOME_DIR" "R_SHARE_DIR" "R_INCLUDE_DIR" "R_DOC_DIR" } {
189        reinplace "s|${dir}=${destroot}|${dir}=|" "${destroot}${resources}/bin/R"
190    }
191
192    reinplace "s|-F${destroot}|-F|" "${destroot}${resources}/etc/Makeconf"
193
194    foreach dylib [ exec find ${destroot}${frameworks_dir}/R.framework -name "\*.dylib" ] {
195        regsub ":$" ${dylib} "" destroot_dylib_path
196        regsub ${destroot} ${destroot_dylib_path} "" dylib_path
197        system "install_name_tool -id ${dylib_path} ${destroot_dylib_path}"
198        system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
199            ${destroot_dylib_path}"
200        system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
201            ${destroot_dylib_path}"
202        system "install_name_tool -change ${destroot}${resources}/lib/libRlapack.dylib ${resources}/lib/libRlapack.dylib \
203            ${destroot_dylib_path}"
204    }
205
206    foreach so [ exec find ${destroot}${frameworks_dir}/R.framework -name "\*.so" ] {
207        regsub ":$" ${so} "" destroot_so_path
208        regsub ${destroot} ${destroot_so_path} "" so_path
209        system "install_name_tool -id ${so_path} ${destroot_so_path}"
210        system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
211            ${destroot_so_path}"
212        system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
213            ${destroot_so_path}"
214        system "install_name_tool -change ${destroot}${resources}/lib/libRlapack.dylib ${resources}/lib/libRlapack.dylib \
215            ${destroot_so_path}"
216    }
217
218    system "install_name_tool -change ${destroot}${resources}/lib/libR.dylib ${resources}/lib/libR.dylib \
219        ${destroot}${resources}/bin/exec/R"
220    system "install_name_tool -change ${destroot}${resources}/lib/libRblas.dylib ${resources}/lib/libRblas.dylib \
221        ${destroot}${resources}/bin/exec/R"
222
223    ln -s ${resources}/bin/R ${destroot}${prefix}/bin/R
224    ln -s ${resources}/bin/Rscript ${destroot}${prefix}/bin/Rscript
225}
226
227livecheck.type      regex
228livecheck.url       [lindex ${master_sites} 0]
229livecheck.regex     >${name}-(\[0-9.\]+)${extract.suffix}<
230
231
232
Note: See TracBrowser for help on using the repository browser.