Skip to content

Instantly share code, notes, and snippets.

@jimhester
Created July 16, 2020 17:53
Show Gist options
  • Save jimhester/6475b6cc108b7d55e69dfe1b300e89cd to your computer and use it in GitHub Desktop.
Save jimhester/6475b6cc108b7d55e69dfe1b300e89cd to your computer and use it in GitHub Desktop.
script to compile R on macOS
#!/bin/bash
# R recommends setting this to avoid issues with programs like sed:
export LANG=C
# Get version in major.minor format:
VERSION=`sed 's/\([0-9]*.[0-9]*\).[0-9]*.*/\1/' VERSION`
# Use version-dev as default folder target:
TARGET=${1:-$VERSION-dev}
# Download recommended packages
tools/rsync-recommended
./configure \
--with-x=no \
--enable-R-framework FW_VERSION=${TARGET} \
CC=clang \
CXX=clang++ \
F77=gfortran-4.8 \
FC=$F77 \
OBJC=clang \
CFLAGS='-Wall -mtune=core2 -g -O2' \
CXXFLAGS='-Wall -mtune=core2 -g -O2' \
OBJCFLAGS='-Wall -mtune=core2 -g -O2' \
F77FLAGS='-Wall -g -O2' \
FCFLAGS=$F77FLAGS
make R docs
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment