Install openssl from source to the global library, with the appropriate configuration variables
#!/usr/bin/env zsh | |
# where to begin? | |
DIR="${HOME}/code" | |
cd "${DIR}" | |
echo | |
echo "Working from within ${PWD}" | |
echo | |
# clone cran-dl repo | |
if [ ! -d "cran-dl" ] ; then | |
printf "Would you like to clone cran-dl? [y/N]: " | |
if read -q; then | |
echo; git clone https://github.com/curtisalexander/cran-dl; echo | |
fi | |
fi | |
echo "Note that cran-dl requires the following R packages be installed:" | |
echo " - docopt" | |
echo " - httr" | |
echo " - purrr" | |
echo " - rvest" | |
echo " - xml2" | |
echo | |
echo "To install within R, execute the following:" | |
echo " - install.packages(c(\"docopt\", \"httr\", \"purrr\", \"rvest\", \"xml2\"))" | |
# create the directory if it does not exist | |
if [ ! -d "r-pkgs" ] ; then | |
echo | |
echo "Making the directory r-pkgs" | |
mkdir -p "${DIR}/r-pkgs" | |
fi | |
# from the command line, download the tar.gz file | |
echo | |
echo "Download the package using cran-dl" | |
${DIR}/cran-dl/cran-dl --pkg=openssl --path="${DIR}/r-pkgs" | |
echo | |
# get the current openssl version | |
echo | |
echo "Get the current version of openssl" | |
OPENSSL_VER="$(openssl version | cut -d' ' -f 2)" | |
echo " - ${OPENSSL_VER}" | |
# install using appropriate configuration | |
OPENSSL_R_VER="$(ls -1 ${DIR}/r-pkgs | grep ^openssl | sort -R | head -1)" | |
echo | |
echo "Installing...${OPENSSL_R_VER}" | |
echo | |
sudo R CMD INSTALL -l /Library/Frameworks/R.framework/Resources/library --configure-vars='INCLUDE_DIR=/usr/local/opt/openssl/include LIB_DIR=/usr/local/opt/openssl/lib' "${DIR}/r-pkgs/${OPENSSL_R_VER}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment