r: revision for gcc

replace gcc's versioned prefix with its opt prefix in lib/R/etc/Makeconf
verify installing a package works in the test block

Fixes #16952.

Closes #16953.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
ilovezfs 2017-08-18 06:44:42 -07:00
parent 94648578e9
commit c273e82c72

View file

@ -3,7 +3,7 @@ class R < Formula
homepage "https://www.r-project.org/"
url "https://cran.rstudio.com/src/base/R-3/R-3.4.1.tar.gz"
sha256 "02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78"
revision 1
revision 2
bottle do
sha256 "9b96002d2a130dba0ead8984d4a76c1b057d8ef7427d6f5895f7e0c2698d86ef" => :sierra
@ -25,6 +25,12 @@ class R < Formula
# needed to preserve executable permissions on files without shebangs
skip_clean "lib/R/bin"
resource "gss" do
url "https://cloud.r-project.org/src/contrib/gss_2.1-7.tar.gz", :using => :nounzip
mirror "https://mirror.las.iastate.edu/CRAN/src/contrib/gss_2.1-7.tar.gz"
sha256 "0405bb5e4c4d60b466335e5da07be4f9570045a24aed09e7bc0640e1a00f3adb"
end
def install
# Fix dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
if MacOS.version == "10.11" && MacOS::Xcode.installed? &&
@ -87,6 +93,10 @@ class R < Formula
include.install_symlink Dir[r_home/"include/*"]
lib.install_symlink Dir[r_home/"lib/*"]
# avoid triggering mandatory rebuilds of r when gcc is upgraded
inreplace lib/"R/etc/Makeconf", Formula["gcc"].prefix.realpath,
Formula["gcc"].opt_prefix
end
def post_install
@ -100,5 +110,10 @@ class R < Formula
test do
assert_equal "[1] 2", shell_output("#{bin}/Rscript -e 'print(1+1)'").chomp
assert_equal ".dylib", shell_output("#{bin}/R CMD config DYLIB_EXT").chomp
testpath.install resource("gss")
system bin/"R", "CMD", "INSTALL", "--library=.", Dir["gss*"].first
assert_predicate testpath/"gss/libs/gss.so", :exist?,
"Failed to install gss package"
end
end