From c0f78b5f758ce22c64268106872930dabe0ae1a7 Mon Sep 17 00:00:00 2001 From: Colin Rundel Date: Wed, 2 Aug 2023 14:11:14 -0400 Subject: [PATCH] Fix flexiblas --- builder/Dockerfile.fedora-37 | 2 +- builder/Dockerfile.fedora-38 | 2 +- builder/package.fedora-37 | 62 ++++++------------------------------ builder/package.fedora-38 | 62 ++++++------------------------------ 4 files changed, 22 insertions(+), 106 deletions(-) diff --git a/builder/Dockerfile.fedora-37 b/builder/Dockerfile.fedora-37 index 1d62365..4417665 100644 --- a/builder/Dockerfile.fedora-37 +++ b/builder/Dockerfile.fedora-37 @@ -58,7 +58,7 @@ RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_ RUN chmod 0777 /opt -# Configure flags for RHEL 9 that don't use the defaults in build.sh +# Configure flags for that don't use the defaults in build.sh ENV CONFIGURE_OPTIONS="\ --enable-R-shlib \ --with-tcltk \ diff --git a/builder/Dockerfile.fedora-38 b/builder/Dockerfile.fedora-38 index 103adbe..ec0b876 100644 --- a/builder/Dockerfile.fedora-38 +++ b/builder/Dockerfile.fedora-38 @@ -58,7 +58,7 @@ RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_ RUN chmod 0777 /opt -# Configure flags for RHEL 9 that don't use the defaults in build.sh +# Configure flags that don't use the defaults in build.sh ENV CONFIGURE_OPTIONS="\ --enable-R-shlib \ --with-tcltk \ diff --git a/builder/package.fedora-37 b/builder/package.fedora-37 index 1c3d03b..9a7151f 100644 --- a/builder/package.fedora-37 +++ b/builder/package.fedora-37 @@ -11,60 +11,18 @@ if [[ "${R_VERSION}" =~ ^3 ]]; then - pcre-devel' fi -# 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, EPEL 9's R now links externally against FlexiBLAS, which provides a -# native BLAS switching mechanism for Fedora/RHEL. Starting with R 4.3.0, we also -# link to external FlexiBLAS for compatibility. -# https://fedoraproject.org/wiki/Changes/FlexiBLAS_as_BLAS/LAPACK_manager -# -# 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 -if [[ "$("${R_INSTALL_PATH}/bin/R" CMD config BLAS_LIBS)" == "-lflexiblas" ]]; then - blas_lib='flexiblas-devel' +blas_lib='flexiblas-devel' - # Create postremove script to remove empty directories, as nFPM doesn't include them in the RPM files. - cat <> /after-remove.sh - if [ -d ${R_INSTALL_PATH} ]; then - rm -r ${R_INSTALL_PATH} - fi -EOF - - scripts="scripts: - postremove: /after-remove.sh -" -else - blas_lib='openblas-devel' - - # Create post-install script required for OpenBLAS. - cat <> /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 ${R_INSTALL_PATH}/lib/R/lib/libRblas.so -EOF - - # Create after-remove script to remove internal BLAS, which won't be cleaned up automatically. - cat <> /after-remove.sh - if [ -d ${R_INSTALL_PATH} ]; then - rm -r ${R_INSTALL_PATH} - fi -EOF - - scripts="scripts: - postinstall: /post-install.sh - postremove: /after-remove.sh -" +# Create postremove script to remove empty directories, as nFPM doesn't include them in the RPM files. +cat <> /after-remove.sh +if [ -d ${R_INSTALL_PATH} ]; then + rm -r ${R_INSTALL_PATH} fi +EOF + +scripts="scripts: + postremove: /after-remove.sh +" if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch diff --git a/builder/package.fedora-38 b/builder/package.fedora-38 index 1c3d03b..9a7151f 100644 --- a/builder/package.fedora-38 +++ b/builder/package.fedora-38 @@ -11,60 +11,18 @@ if [[ "${R_VERSION}" =~ ^3 ]]; then - pcre-devel' fi -# 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, EPEL 9's R now links externally against FlexiBLAS, which provides a -# native BLAS switching mechanism for Fedora/RHEL. Starting with R 4.3.0, we also -# link to external FlexiBLAS for compatibility. -# https://fedoraproject.org/wiki/Changes/FlexiBLAS_as_BLAS/LAPACK_manager -# -# 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 -if [[ "$("${R_INSTALL_PATH}/bin/R" CMD config BLAS_LIBS)" == "-lflexiblas" ]]; then - blas_lib='flexiblas-devel' +blas_lib='flexiblas-devel' - # Create postremove script to remove empty directories, as nFPM doesn't include them in the RPM files. - cat <> /after-remove.sh - if [ -d ${R_INSTALL_PATH} ]; then - rm -r ${R_INSTALL_PATH} - fi -EOF - - scripts="scripts: - postremove: /after-remove.sh -" -else - blas_lib='openblas-devel' - - # Create post-install script required for OpenBLAS. - cat <> /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 ${R_INSTALL_PATH}/lib/R/lib/libRblas.so -EOF - - # Create after-remove script to remove internal BLAS, which won't be cleaned up automatically. - cat <> /after-remove.sh - if [ -d ${R_INSTALL_PATH} ]; then - rm -r ${R_INSTALL_PATH} - fi -EOF - - scripts="scripts: - postinstall: /post-install.sh - postremove: /after-remove.sh -" +# Create postremove script to remove empty directories, as nFPM doesn't include them in the RPM files. +cat <> /after-remove.sh +if [ -d ${R_INSTALL_PATH} ]; then + rm -r ${R_INSTALL_PATH} fi +EOF + +scripts="scripts: + postremove: /after-remove.sh +" if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch