slackbuilds_ponce/academic/R/R.SlackBuild
2010-05-13 00:19:44 +02:00

84 lines
2 KiB
Bash

#!/bin/sh
# Slackware build script for R
# Written by Joel J. Adamson
# Modified by SlackBuilds.org
PRGNAM=R
VERSION=2.9.0
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
rm -rf $TMP/$PRGNAM-$VERSION
cd $TMP
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Adjust the path variable; you need pdflatex to build the LaTeX documentation
PATH="$PATH:/usr/share/texmf/bin"
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--with-perl=/usr/bin/perl \
--enable-R-shlib \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null || true
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null
)
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
)
mkdir -p $PKG/usr/doc
mv $PKG/usr/lib${LIBDIRSUFFIX}/R/doc $PKG/usr/doc/$PRGNAM-$VERSION
cp -a INSTALL README $CWD/$PRGNAM.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
chown -R root:root $PKG/usr/doc
( cd $PKG/usr/lib${LIBDIRSUFFIX}/R ; ln -s /usr/doc/$PRGNAM-$VERSION doc )
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}