Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r 3.4.0 (import from homebrew/science)
Closes #14416. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
- Loading branch information
1 parent
15e5e43
commit 47fb4b5
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
class R < Formula | ||
desc "Software environment for statistical computing" | ||
homepage "https://www.r-project.org/" | ||
url "https://cran.rstudio.com/src/base/R-3/R-3.4.1.tar.gz" | ||
sha256 "02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78" | ||
|
||
bottle do | ||
sha256 "d0254993416c177d7fa49b9cde95eb8bd262e3a801408b21951cc0f7755e0a0e" => :sierra | ||
sha256 "2098376a2d552573a1b0e2ff29c076b05a0161ec276260b5b76a80e87d5cd6c1" => :el_capitan | ||
sha256 "be31e78c3df77a46e91500b4809cb7f89bceacabc0c38d1bc3e56beab31bff6e" => :yosemite | ||
end | ||
|
||
depends_on "pkg-config" => :build | ||
depends_on "gettext" | ||
depends_on "jpeg" | ||
depends_on "libpng" | ||
depends_on "pcre" | ||
depends_on "readline" | ||
depends_on "xz" | ||
depends_on :fortran | ||
depends_on "homebrew/science/openblas" => :optional | ||
|
||
def install | ||
# Fix dyld: lazy symbol binding failed: Symbol not found: _clock_gettime | ||
if MacOS.version == "10.11" && MacOS::Xcode.installed? && | ||
MacOS::Xcode.version >= "8.0" | ||
ENV["ac_cv_have_decl_clock_gettime"] = "no" | ||
end | ||
|
||
args = [ | ||
"--prefix=#{prefix}", | ||
"--enable-memory-profiling", | ||
"--without-cairo", | ||
"--without-x", | ||
"--with-aqua", | ||
"--with-lapack", | ||
"SED=/usr/bin/sed", # don't remember Homebrew's sed shim | ||
] | ||
|
||
if build.with? "openblas" | ||
args << "--with-blas=-L#{Formula["openblas"].opt_lib} -lopenblas" | ||
ENV.append "LDFLAGS", "-L#{Formula["openblas"].opt_lib}" | ||
else | ||
args << "--with-blas=-framework Accelerate" | ||
ENV.append_to_cflags "-D__ACCELERATE__" if ENV.compiler != :clang | ||
end | ||
|
||
# Help CRAN packages find gettext and readline | ||
["gettext", "readline"].each do |f| | ||
ENV.append "CPPFLAGS", "-I#{Formula[f].opt_include}" | ||
ENV.append "LDFLAGS", "-L#{Formula[f].opt_lib}" | ||
end | ||
|
||
system "./configure", *args | ||
system "make" | ||
ENV.deparallelize do | ||
system "make", "install" | ||
end | ||
|
||
cd "src/nmath/standalone" do | ||
system "make" | ||
ENV.deparallelize do | ||
system "make", "install" | ||
end | ||
end | ||
|
||
# make Homebrew packages discoverable for R CMD INSTALL | ||
inreplace lib/"R/etc/Makeconf" do |s| | ||
s.gsub!(/^CPPFLAGS =.*/, "\\0 -I#{HOMEBREW_PREFIX}/include") | ||
s.gsub!(/^LDFLAGS =.*/, "\\0 -L#{HOMEBREW_PREFIX}/lib") | ||
s.gsub!(/.LDFLAGS =.*/, "\\0 $(LDFLAGS)") | ||
end | ||
end | ||
|
||
def post_install | ||
short_version = | ||
`#{bin}/Rscript -e 'cat(as.character(getRversion()[1,1:2]))'`.strip | ||
site_library = HOMEBREW_PREFIX/"lib/R/#{short_version}/site-library" | ||
site_library.mkpath | ||
ln_s site_library, lib/"R/site-library" | ||
end | ||
|
||
test do | ||
assert_equal "[1] 2", shell_output("#{bin}/Rscript -e 'print(1+1)'").chomp | ||
end | ||
end |
47fb4b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be working for me. I get:
It seems in the past (I was using the formula from homebrew-science) I had a
/usr/local/opt/r/R.framework
and now I no longer do.47fb4b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not saying what command you are running to produce that output. Please create a new issue, follow the template and do so.
47fb4b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MikeMcQuaid I've moved my comment to the original PR