Add R builds for openSUSE 15.4/SLES 15 SP4

This commit is contained in:
Greg Lin 2022-08-10 13:56:35 -05:00
commit f8392bdea8

View file

@ -0,0 +1,87 @@
#!/bin/bash
if [[ ! -d /tmp/output/opensuse-154 ]]; then
mkdir -p /tmp/output/opensuse-154
fi
# R 3.x requires PCRE1
pcre_lib='pcre2-devel'
if [[ "${R_VERSION}" =~ ^3 ]]; then
pcre_lib='pcre-devel'
fi
# Create post-install script required for OpenBLAS.
#
# On RHEL and SUSE, we link R against the internal shared BLAS to make the
# R binaries more portable and allow users to switch BLAS implementations without
# having to recompile R. We default to OpenBLAS, but users may prefer other implementations.
#
# Binary packages built against the shared BLAS are also more portable and may be used
# with the default R distributed by RHEL/SUSE, or other R installations using
# shared BLAS and configured with a different BLAS (such as Microsoft R Open with MKL).
# This is especially important for RSPM's binary packages.
#
# On Ubuntu/Debian, we link R against the external BLAS instead (--with-blas/--with-lapack),
# as those distributions use the alternatives system to swap BLAS libraries at runtime.
# The default R distributions on Ubuntu/Debian use the external BLAS, so we do as well
# for portability.
#
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Shared-BLAS
cat <<EOF >> /post-install.sh
mv /opt/R/${R_VERSION}/lib/R/lib/libRblas.so /opt/R/${R_VERSION}/lib/R/lib/libRblas.so.keep
ln -s /usr/lib64/libopenblas.so /opt/R/${R_VERSION}/lib/R/lib/libRblas.so
EOF
# Create after-remove script to remove internal BLAS, which won't be cleaned up automatically.
cat <<EOF >> /after-remove.sh
if [ -d /opt/R/${R_VERSION} ]; then
rm -r /opt/R/${R_VERSION}
fi
EOF
fpm \
-s dir \
-t rpm \
-v 1 \
-n "R-${R_VERSION}" \
--vendor "RStudio, PBC" \
--url "http://www.r-project.org/" \
--description "GNU R statistical computation and graphics system" \
--maintainer "RStudio, PBC <https://github.com/rstudio/r-builds>" \
--license "GPLv2" \
--after-install /post-install.sh \
--after-remove /after-remove.sh \
-p /tmp/output/opensuse-154/ \
-d fontconfig \
-d gcc \
-d gcc-c++ \
-d gcc-fortran \
-d glibc-locale \
-d gzip \
-d icu.691-devel \
-d libbz2-devel \
-d libcairo2 \
-d libcurl-devel \
-d libfreetype6 \
-d libgomp1 \
-d libjpeg62 \
-d libopenblas_pthreads-devel \
-d libpango-1_0-0 \
-d libreadline7 \
-d libtiff5 \
-d make \
-d ${pcre_lib} \
-d tar \
-d tcl \
-d tk \
-d unzip \
-d which \
-d xorg-x11 \
-d xorg-x11-fonts-100dpi \
-d xorg-x11-fonts-75dpi \
-d xz-devel \
-d zip \
-d zlib-devel \
"/opt/R/${R_VERSION}"
export PKG_FILE=$(ls /tmp/output/opensuse-154/R-${R_VERSION}*.rpm | head -1)