#!/bin/sh # postflight script for R # create convenience links to R and Rscript cd /usr/bin rm -f R Rscript ln -s /Library/Frameworks/R.framework/Resources/bin/R . ln -s /Library/Frameworks/R.framework/Resources/bin/Rscript . # update font cache (if this R includes fontconfig) if [ -e /Library/Frameworks/R.framework/Resources/bin/fc-cache ]; then /Library/Frameworks/R.framework/Resources/bin/fc-cache fi # make sure the framework is admin-writable chown -R root:admin /Library/Frameworks/R.framework chmod -R g+w /Library/Frameworks/R.framework # remove left-overs from previous versions (beta/RC/...) if [ -e /Library/Frameworks/R.framework/Resources/etc/Makeconf ]; then rm -f /Library/Frameworks/R.framework/Resources/etc/Makeconf fi # some jobs needed specifically on Mac OS X 10.6 (Snow Leopard) and 10.7 (Lion) if uname -r | grep ^1[01] >/dev/null; then # since 10.6 we have to remove ppc* since Apple doesn't ship the libraries anymore # this makes sure that package compilation won't try to use ppc rm -rf `find /Library/Frameworks/R.framework/Resources/ -name ppc` # change default architecture to 64-bit Intel if supported by the CPU and add R64/R32 if /usr/sbin/sysctl hw.cpu64bit_capable 2>/dev/null | grep '1$' >/dev/null; then sed 's,^: ${R_ARCH=.*,: ${R_ARCH=/i386},' /Library/Frameworks/R.framework/Resources/bin/R > /Library/Frameworks/R.framework/Resources/bin/R32 sed 's,^: ${R_ARCH=.*,: ${R_ARCH=/x86_64},' /Library/Frameworks/R.framework/Resources/bin/R > /Library/Frameworks/R.framework/Resources/bin/R64 && \ ln -sfn R64 /Library/Frameworks/R.framework/Resources/bin/R && ln -sfn /Library/Frameworks/R.framework/Resources/bin/R64 /usr/bin/R64 chmod 0775 /Library/Frameworks/R.framework/Resources/bin/R64 /Library/Frameworks/R.framework/Resources/bin/R32 ln -sfn /Library/Frameworks/R.framework/Resources/bin/R32 /usr/bin/R32 fi # we ship with R-BLAS due to bugs in vecLib, but so far it seems Lion has fixed those so we can go back to vecLib if uname -r | grep ^11 >/dev/null; then ln -sfn libRblas.vecLib.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib fi # check gfortran - if it's our previously installed Xcode 3.1.x build, remove it since it breaks on SL if /usr/bin/gfortran -v 2>/dev/null | grep '/Volumes/Data/Builds/apple/gcc_42-55'; then rm -f /usr/bin/gfortran fi if /usr/bin/gfortran-4.2 -v 2>/dev/null | grep '/Volumes/Data/Builds/apple/gcc_42-55'; then rm -f /usr/bin/gfortran-4.2 for dir in /usr/lib/gcc/i686-apple-darwin9 /usr/lib/gcc/powerpc-apple-darwin9 /usr/libexec/gcc/i686-apple-darwin9 /usr/libexec/gcc/powerpc-apple-darwin9; do rm -rf $dir/4.2.1 rmdir $dir 2>/dev/null done fi else # on Leopard we keep the old defaults but create R64 based on the current machine if /usr/sbin/sysctl hw.cpu64bit_capable 2>/dev/null | grep '1$' >/dev/null; then if [ `arch` = ppc ]; then sed 's,^: ${R_ARCH=.*,: ${R_ARCH=/ppc64},' /Library/Frameworks/R.framework/Resources/bin/R > /Library/Frameworks/R.framework/Resources/bin/R64 && \ ln -sfn /Library/Frameworks/R.framework/Resources/bin/R64 /usr/bin/R64 else sed 's,^: ${R_ARCH=.*,: ${R_ARCH=/x86_64},' /Library/Frameworks/R.framework/Resources/bin/R > /Library/Frameworks/R.framework/Resources/bin/R64 && \ ln -sfn /Library/Frameworks/R.framework/Resources/bin/R64 /usr/bin/R64 fi chmod 0775 /Library/Frameworks/R.framework/Resources/bin/R64 fi fi