R.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/bin/bash
  2. # SlackBuild script for R
  3. # Copyright 2019-2022 Andrew Payne <phalange@komputermatrix.com>
  4. # Copyright 2014-2017 melikamp, Andrew Rowland
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version, with the following exception:
  9. # the text of the GPL license may be omitted.
  10. # This program is distributed in the hope that it will be useful, but
  11. # without any warranty; without even the implied warranty of
  12. # merchantability or fitness for a particular purpose. Compiling,
  13. # interpreting, executing or merely reading the text of the program
  14. # may result in lapses of consciousness and/or very being, up to and
  15. # including the end of all existence and the Universe as we know it.
  16. # See the GNU General Public License for more details.
  17. # You may have received a copy of the GNU General Public License along
  18. # with this program (most likely, a file named COPYING). If not, see
  19. # <http://www.gnu.org/licenses/>.
  20. cd $(dirname $0) ; CWD=$(pwd)
  21. PRGNAM=R
  22. VERSION=${VERSION:-4.1.3}
  23. BUILD=${BUILD:-1}
  24. TAG=${TAG:-_SBo}
  25. PKGTYPE=${PKGTYPE:-tgz}
  26. if [ "${R_SHLIB:-yes}" = "yes" ]; then
  27. r_shlib="--enable-R-shlib"
  28. else
  29. r_shlib="--disable-R-shlib"
  30. fi
  31. if [ "${BLAS_SHLIB:-yes}" = "yes" ]; then
  32. blas_shlib="--enable-BLAS-shlib"
  33. else
  34. blas_shlib="--disable-BLAS-shlib"
  35. fi
  36. if [ -z "$ARCH" ]; then
  37. case "$( uname -m )" in
  38. i?86) ARCH=i586 ;;
  39. arm*) ARCH=arm ;;
  40. *) ARCH=$( uname -m ) ;;
  41. esac
  42. fi
  43. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  44. # the name of the created package would be, and then exit. This information
  45. # could be useful to other scripts.
  46. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  47. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  48. exit 0
  49. fi
  50. TMP=${TMP:-/tmp/SBo}
  51. PKG=$TMP/package-$PRGNAM
  52. OUTPUT=${OUTPUT:-/tmp}
  53. if [ "$ARCH" = "i586" ]; then
  54. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "i686" ]; then
  57. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  58. LIBDIRSUFFIX=""
  59. elif [ "$ARCH" = "x86_64" ]; then
  60. SLKCFLAGS="-O2 -fPIC"
  61. LIBDIRSUFFIX="64"
  62. else
  63. SLKCFLAGS="-O2"
  64. LIBDIRSUFFIX=""
  65. fi
  66. set -e
  67. rm -rf $PKG
  68. mkdir -p $TMP $PKG $OUTPUT
  69. cd $TMP
  70. rm -rf $PRGNAM-$VERSION
  71. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  72. cd $PRGNAM-$VERSION
  73. chown -R root:root .
  74. find -L . \
  75. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  76. -o -perm 511 \) -exec chmod 755 {} \; -o \
  77. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  78. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  79. CFLAGS="$SLKCFLAGS" \
  80. CXXFLAGS="$SLKCFLAGS" \
  81. ./configure \
  82. --prefix=/usr \
  83. --libdir=/usr/lib${LIBDIRSUFFIX} \
  84. --sysconfdir=/etc \
  85. --localstatedir=/var \
  86. --mandir=/usr/man \
  87. rdocdir=/usr/doc/$PRGNAM-$VERSION \
  88. $r_shlib \
  89. $blas_shlib \
  90. --build=$ARCH-slackware-linux
  91. make
  92. make install DESTDIR=$PKG
  93. make install-tests DESTDIR=$PKG
  94. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  95. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  96. find $PKG/usr/man -type f -exec gzip -9 {} \;
  97. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  98. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  99. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  100. mkdir -p $PKG/install
  101. cat $CWD/slack-desc > $PKG/install/slack-desc
  102. cd $PKG
  103. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE