-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage.centos-8
88 lines (80 loc) · 2.3 KB
/
package.centos-8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/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.
#
# 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 Posit Package Manager's binary packages.
#
# However, as of R 4.2.3, EPEL 8's R no longer uses shared BLAS and now links to an
# external OpenBLAS (OpenMP). This means EPEL R no longer has a swappable BLAS and
# is no longer compatible with these R builds.
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/libopenblasp.so.0 ${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:
- bzip2-devel
- gcc
- gcc-c++
- gcc-gfortran
- libcurl-devel
- libicu-devel
- libSM
- libtiff
- libXmu
- libXt
- make
- openblas-threads
- pango
- ${pcre_lib}
- tcl
- tk
- unzip
- which
- 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)