forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr.rb
214 lines (180 loc) · 7.58 KB
/
r.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
class RDownloadStrategy < SubversionDownloadStrategy
def stage
cp_r File.join(cached_location, "."), Dir.pwd
end
end
class R < Formula
desc "Software environment for statistical computing"
homepage "http://www.r-project.org/"
url "http://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz"
mirror "http://cran.r-project.org/src/base/R-3/R-3.2.2.tar.gz"
sha256 "9c9152e74134b68b0f3a1c7083764adc1cb56fd8336bec003fd0ca550cd2461d"
revision 1
bottle do
sha256 "668d4389db9ccdd8574157fc9a6af6b2f1a48761f8bfb376855e8eae1106f842" => :yosemite
sha256 "d3b86b6d25480f8fb07b06681ee980754c6215cf657b85c797779944657e86b6" => :mavericks
sha256 "5827361dc017b0611e7db2b886f73226bde4f0946c7a3940381e0b4bb6cc942c" => :mountain_lion
end
head do
url "https://svn.r-project.org/R/trunk", :using => RDownloadStrategy
depends_on :tex
end
option "without-accelerate", "Build without the Accelerate framework (use Rblas)"
option "without-check", "Skip build-time tests (not recommended)"
option "without-tcltk", "Build without Tcl/Tk"
option "with-librmath-only", "Only build standalone libRmath library"
depends_on "pkg-config" => :build
depends_on "texinfo" => :build
depends_on :fortran
depends_on "readline"
depends_on "gettext"
depends_on "libtiff"
depends_on "pcre"
depends_on "jpeg"
depends_on "libpng"
depends_on "xz"
depends_on "openblas" => :optional
depends_on "pango" => :optional
depends_on "valgrind" => :optional
depends_on :x11 => (OS.mac? ? :optional : :recommended)
cairo_opts = build.with?("x11") ? ["with-x11"] : []
cairo_opts << :optional if OS.linux?
depends_on "cairo" => cairo_opts
# This is the same script that Debian packages use.
resource "completion" do
url "https://rcompletion.googlecode.com/svn-history/r31/trunk/bash_completion/R", :using => :curl
sha256 "2b5cac905ab5dd4889e8a356bbdf2dddff60f718a4104b169e48ca856716e705"
version "r31"
end
patch :DATA
def install
# Fix cairo detection with Quartz-only cairo
inreplace ["configure", "m4/cairo.m4"], "cairo-xlib.h", "cairo.h"
args = [
"--prefix=#{prefix}",
"--with-libintl-prefix=#{Formula["gettext"].opt_prefix}",
"--enable-memory-profiling",
]
if OS.linux?
args << "--libdir=#{lib}" # avoid using lib64 on CentOS
args << "--enable-R-shlib"
# If LDFLAGS contains any -L options, configure sets LD_LIBRARY_PATH to
# search those directories. Remove -LHOMEBREW_PREFIX/lib from LDFLAGS.
ENV.remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
else
args << "--enable-R-framework"
args << "--with-cairo"
# Disable building against the Aqua framework with CLT >= 6.0.
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63651
# This should be revisited when new versions of GCC come along.
if ENV.compiler != :clang && MacOS::CLT.version >= "6.0"
args << "--without-aqua"
else
args << "--with-aqua"
end
end
if build.with? "valgrind"
args << "--with-valgrind-instrumentation=2"
ENV.Og
end
if build.with? "openblas"
args << "--with-blas=-L#{Formula["openblas"].opt_lib} -lopenblas" << "--with-lapack"
ENV.append "LDFLAGS", "-L#{Formula["openblas"].opt_lib}"
elsif build.with? "accelerate"
args << "--with-blas=-framework Accelerate" << "--with-lapack"
ENV.append_to_cflags "-D__ACCELERATE__" if ENV.compiler != :clang
# Fall back to Rblas without-accelerate or -openblas
end
args << "--without-tcltk" if build.without? "tcltk"
args << "--without-x" if build.without? "x11"
# Help CRAN packages find gettext, readline, and openssl
%w[gettext readline openssl].each do |f|
ENV.append "CPPFLAGS", "-I#{Formula[f].opt_include}"
ENV.append "LDFLAGS", "-L#{Formula[f].opt_lib}"
end
# Pull down recommended packages if building from HEAD.
system "./tools/rsync-recommended" if build.head?
system "./configure", *args
if build.without? "librmath-only"
system "make"
ENV.deparallelize # Serialized installs, please
system "make check 2>&1 | tee make-check.log" if build.with? "check"
system "make", "install"
# Link binaries, headers, libraries, & manpages from the Framework
# into the normal locations
if OS.mac?
bin.install_symlink prefix/"R.framework/Resources/bin/R"
bin.install_symlink prefix/"R.framework/Resources/bin/Rscript"
frameworks.install_symlink prefix/"R.framework"
include.install_symlink Dir[prefix/"R.framework/Resources/include/*"]
lib.install_symlink prefix/"R.framework/Resources/lib/libR.dylib"
man1.install_symlink prefix/"R.framework/Resources/man1/R.1"
man1.install_symlink prefix/"R.framework/Resources/man1/Rscript.1"
end
# if this was built with a Homebrew gfortran, immunize to minor gcc version changes
if (r_home/"etc/Makeconf").read.include? Formula["gcc"].prefix
inreplace r_home/"etc/Makeconf", Formula["gcc"].prefix, Formula["gcc"].opt_prefix
end
bash_completion.install resource("completion")
prefix.install "make-check.log" if build.with? "check"
end
cd "src/nmath/standalone" do
system "make"
ENV.deparallelize # Serialized installs, please
system "make", "install"
if OS.mac?
lib.install_symlink Dir[prefix/"R.framework/Versions/[0-9]*/Resources/lib/libRmath.dylib"]
include.install_symlink Dir[prefix/"R.framework/Versions/[0-9]*/Resources/include/Rmath.h"]
end
end
end
def post_install
cellar_site_library = r_home/"site-library"
site_library.mkpath
cellar_site_library.unlink if cellar_site_library.exist? || cellar_site_library.symlink?
ln_s site_library, cellar_site_library
end
test do
if build.without? "librmath-only"
system bin/"Rscript", "-e", "print(1+1)"
system bin/"Rscript", "-e", "quit('no', capabilities('cairo')[['cairo']] != TRUE)" if OS.mac?
end
end
def caveats
if build.without? "librmath-only" then <<-EOS.undent
To enable rJava support, run the following command:
R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
If you've installed a version of Java other than the default, you might need to instead use:
R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Java/JavaVirtualMachines/jdk<version>.jdk/"
(where <version> can be found by running `java -version`, `/usr/libexec/java_home`, or `locate jni.h`), or:
R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I$(/usr/libexec/java_home | grep -o '.*jdk')"
EOS
end
end
def installed_short_version
`#{bin}/Rscript -e 'cat(as.character(getRversion()[1,1:2]))'`.strip
end
def r_home
OS.mac? ? (prefix/"R.framework/Resources") : (prefix/"lib/R")
end
def site_library
HOMEBREW_PREFIX/"lib/R/#{installed_short_version}/site-library"
end
end
__END__
diff --git a/src/modules/lapack/vecLibg95c.c b/src/modules/lapack/vecLibg95c.c
index ffc18e4..6728244 100644
--- a/src/modules/lapack/vecLibg95c.c
+++ b/src/modules/lapack/vecLibg95c.c
@@ -2,6 +2,12 @@
#include <config.h>
#endif
+#ifndef __has_extension
+#define __has_extension(x) 0
+#endif
+#define vImage_Utilities_h
+#define vImage_CVUtilities_h
+
#include <AvailabilityMacros.h> /* for MAC_OS_X_VERSION_10_* -- present on 10.2+ (according to Apple) */
/* Since OS X 10.8 vecLib requires Accelerate to be included first (which in turn includes vecLib) */
#if defined MAC_OS_X_VERSION_10_8 && MAC_OS_X_VERSION_MIN_REQUIRED >= 1040