84 lines
1.7 KiB
Shell
84 lines
1.7 KiB
Shell
#!/bin/bash
|
|
|
|
if [[ ! -d /tmp/output/${OS_IDENTIFIER} ]]; then
|
|
mkdir -p "/tmp/output/${OS_IDENTIFIER}"
|
|
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
|
|
cat <<EOF >> /post-install.sh
|
|
mv ${R_INSTALL_PATH}/lib/R/lib/libRblas.so ${R_INSTALL_PATH}/lib/R/lib/libRblas.so.keep
|
|
ln -s /usr/lib64/libopenblas.so ${R_INSTALL_PATH}/lib/R/lib/libRblas.so
|
|
EOF
|
|
|
|
# create after-remove script to remove internal blas
|
|
cat <<EOF >> /after-remove.sh
|
|
if [ -d ${R_INSTALL_PATH} ]; then
|
|
rm -r ${R_INSTALL_PATH}
|
|
fi
|
|
EOF
|
|
|
|
if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch
|
|
|
|
cat <<EOF > /tmp/nfpm.yml
|
|
name: R-${R_VERSION}
|
|
version: 1
|
|
version_schema: none
|
|
arch: $(cat /tmp/arch)
|
|
release: 1
|
|
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
|
|
description: |
|
|
GNU R statistical computation and graphics system
|
|
vendor: Posit Software, PBC
|
|
homepage: https://www.r-project.org
|
|
license: GPLv2+
|
|
depends:
|
|
- fontconfig
|
|
- ${gcc_package-gcc}
|
|
- ${gxx_package-gcc-c++}
|
|
- ${gfortran_package-gcc-fortran}
|
|
- glibc-locale
|
|
- gzip
|
|
- icu.691-devel
|
|
- libbz2-devel
|
|
- libcairo2
|
|
- libcurl-devel
|
|
- libfreetype6
|
|
- libgomp1
|
|
- libjpeg62
|
|
- libpango-1_0-0
|
|
- libreadline7
|
|
- libtiff5
|
|
- make
|
|
- openblas-devel
|
|
- ${pcre_lib}
|
|
- tar
|
|
- tcl
|
|
- tk
|
|
- unzip
|
|
- which
|
|
- xorg-x11
|
|
- xorg-x11-fonts-100dpi
|
|
- xorg-x11-fonts-75dpi
|
|
- xz-devel
|
|
- zip
|
|
- zlib-devel
|
|
contents:
|
|
- src: ${R_INSTALL_PATH}
|
|
dst: ${R_INSTALL_PATH}
|
|
scripts:
|
|
postinstall: /post-install.sh
|
|
postremove: /after-remove.sh
|
|
EOF
|
|
|
|
nfpm package \
|
|
-f /tmp/nfpm.yml \
|
|
-p rpm \
|
|
-t "/tmp/output/${OS_IDENTIFIER}"
|
|
|
|
export PKG_FILE=$(ls /tmp/output/${OS_IDENTIFIER}/R-${R_VERSION}*.rpm | head -1)
|