This installer has been superceded by the {macrtools} R package, which automatically installs and configures the R toolchain for compiled code on macOS.
Please do not use the r-macos-clang
installer package as it is notably out of date.
The repository contains the scripts used to create a macOS installer package (.pkg
)
for the clang4
binaries. For those interested, the installer can be obtained
on either the project's Release page.
The pre-built binaries this installer setups during the installation can be found at: http://r.research.att.com/libs/.
The scripts have the potential to be generalized further so that
.pkg
installers are available to be created for all binaries
listed on http://r.research.att.com/libs/.
Financial support was provided to sign the installer by Professor Timothy Bates of the University of Edinburgh.
Download it from the project's Release page, open the installer by right clicking to bring up menu and selecting "Open". From here, navigate through it like a normal macOS installer.
If you have yet to install Xcode Command Line Interface Tools ("Xcode CLI"), you will then need to open Terminal (Applications/Utilities/Terminal) and type:
xcode-select --install
That's it. Once installed, you can start using compiled code
in R like normal with the added benefit of OpenMP
.
If you want to see behind the curtain, continue reading...
The clang4-r
installer performs two actions that require
the users password to accomplish. These actions are:
- unpack a set of pre-made binary files into
the
/usr/local/clang4
directory - establish the proper paths for
CC
,CXX
,CXX**
, andLDFLAGS
in the~/.R/Makevars
file
In essence, it provides a graphical user interface installation guide,
more secure path manipulation, and a smarter handling of a pre-existing ~/.R/Makevars
when compared to the following pure bash approach:
# Download binary
curl -O http://r.research.att.com/libs/clang-4.0.0-darwin15.6-Release.tar.gz
# Extract binary onto root directory
tar fvxz clang-4.0.0-darwin15.6-Release.tar.gz -C /
# Overwrites ~/.R/Makevars file if present otherwise creates it
cat <<- EOF > ~/.R/Makevars
# The following statements are required to use the clang4 binary
CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++
CXX1X=/usr/local/clang4/bin/clang++
CXX98=/usr/local/clang4/bin/clang++
CXX11=/usr/local/clang4/bin/clang++
CXX14=/usr/local/clang4/bin/clang++
CXX17=/usr/local/clang4/bin/clang++
LDFLAGS=-L/usr/local/clang4/lib
# End clang4 inclusion statements
EOF
# Install Xcode CLI tools
xcode-select --install
Thanks to the financial support provided by Professor Timothy Bates of the University of Edinburgh to join the Apple Developer program. The installer is now signed using developer credentials.
As a result, the installer should have a "lock" icon in the upper right corner:
Clicking the lock icon will reveal the signed developer certificate:
With this being said, the code used to generate the installer has been made publically available under an open source license (GPL >= 2).
Below is an abridged version of the actions of each file provided.
download_files.sh
- Downloads the
clang-4.0.0-darwin15.6-Release.tar.gz
from http://r.research.att.com/libs/ and extracts it into a temporaryROOT/
directory established in the working directory
- Downloads the
scripts/postinstall
- Create or modify the
~/.R/Makevars
file with the necessary implicit variables to compile with clang4. - This is run at the end of the installer routine.
- Create or modify the
make_installer.sh
- Create the installer package R binary installer
.pkg
- Builds the package from the extracted tar using
pkgbuild
- Analyzing the package using
productbuild
to create adistribution.xml
- Inserts customizations into the
distribution.xml
(title, background, ...) - Calls
productbuild
to rebuild the package.
- Builds the package from the extracted tar using
- Create the installer package R binary installer
distribution.xml
- Customization options (e.g. title, background) of installer built by analyzing a temporary .pkg
build_files/Rlogo.png
- R logo
build_files/LICENSE.rtf
- License of the LLVM installer
build_files/WELCOME_DISPLAY.rtf
- Text displayed on welcome screen
GPL (>= 2)