diff --git a/.crow/build.yaml b/.crow/build.yaml index 3424da9..7f9444b 100644 --- a/.crow/build.yaml +++ b/.crow/build.yaml @@ -13,6 +13,16 @@ matrix: ARCH: amd64 ARCH_ID: x86_64 INSTANCE_TYPE: AX42 + - PLATFORM: rhel-10 + PLATFORM_ID: el10 + ARCH: arm64 + ARCH_ID: aarch64 + INSTANCE_TYPE: cax31 + - PLATFORM: rhel-10 + PLATFORM_ID: el10 + ARCH: amd64 + ARCH_ID: x86_64 + INSTANCE_TYPE: AX42 - PLATFORM: centos-8 PLATFORM_ID: el8 ARCH: arm64 diff --git a/Justfile b/Justfile index 780aaf3..51636df 100644 --- a/Justfile +++ b/Justfile @@ -18,6 +18,11 @@ build-r-rhel-9 R_VERSION: export R_VERSION={{R_VERSION}}; \ make build-r-$PLATFORM +build-r-rhel-10 R_VERSION: + export PLATFORM=rhel-10; \ + export R_VERSION={{R_VERSION}}; \ + make build-r-$PLATFORM + build-r-opensuse-155 R_VERSION: export PLATFORM=opensuse-155; \ export R_VERSION={{R_VERSION}}; \ diff --git a/Makefile b/Makefile index aeaa94a..6c6cdb4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PLATFORMS := ubuntu-2004 ubuntu-2204 ubuntu-2404 debian-10 debian-11 debian-12 centos-7 centos-8 rhel-9 opensuse-155 fedora-38 fedora-39 fedora-40 alpine-321 alpine-322 +PLATFORMS := ubuntu-2004 ubuntu-2204 ubuntu-2404 debian-10 debian-11 debian-12 centos-7 centos-8 rhel-9 opensuse-155 fedora-38 fedora-39 fedora-40 alpine-321 alpine-322 rhel-10 SLS_BINARY ?= ./node_modules/serverless/bin/serverless.js deps: diff --git a/builder/Dockerfile.rhel-10 b/builder/Dockerfile.rhel-10 new file mode 100644 index 0000000..53da514 --- /dev/null +++ b/builder/Dockerfile.rhel-10 @@ -0,0 +1,93 @@ +FROM almalinux:10 + +ENV OS_IDENTIFIER rhel-10 + +RUN dnf -y upgrade \ + && dnf -y install dnf-plugins-core \ + && dnf config-manager --set-enabled crb \ + && dnf install -y epel-release \ + && dnf -y install \ + autoconf \ + automake \ + bzip2-devel \ + cairo-devel \ + flexiblas-devel \ + gcc-c++ \ + gcc-gfortran \ + java-21-openjdk-devel \ + libICE-devel \ + libSM-devel \ + libX11-devel \ + libXmu-devel \ + libXt-devel \ + libcurl-devel \ + libicu-devel \ + libjpeg-devel \ + libpng-devel \ + libtiff-devel \ + libtool \ + make \ + ncurses-devel \ + pango-devel \ + pcre2-devel \ + readline-devel \ + rpm-build \ + tcl-devel \ + tex \ + texinfo-tex \ + texlive-collection-latexrecommended \ + tk-devel \ + unzip \ + valgrind-devel \ + which \ + wget \ + xz-devel \ + zlib-devel \ + && dnf clean all + +# Install AWS CLI +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \ + unzip awscliv2.zip && \ + ./aws/install && \ + rm -rf aws awscliv2.zip + +RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch + +RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \ + dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \ + rm "nfpm_$(cat /tmp/arch).rpm" + +RUN chmod 0777 /opt + +# Configure flags for RHEL 9 that don't use the defaults in build.sh +ENV CONFIGURE_OPTIONS="\ + --enable-R-shlib \ + --with-tcltk \ + --enable-memory-profiling \ + --with-x \ + --with-system-valgrind-headers \ + --with-tcl-config=/usr/lib64/tclConfig.sh \ + --with-tk-config=/usr/lib64/tkConfig.sh \ + --enable-prebuilt-html" + +# RHEL 9 doesn't have the inconsolata font, so override the defaults. +# This may be removed if RHEL ever adds the texlive-inconsolata package from Fedora. +# Or check `dnf provides '*/inconsolata.sty'` for a package that provides it. +# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Making-the-manuals +ENV R_RD4PDF="times,hyper" + +# Make sure that patching Java does not break R. +# R's default JAVA_HOME path includes the exact Java version on CentOS/RHEL, which +# requires users to run `R CMD javareconf` even on minor/patch upgrades. Use the +# major version symlink to avoid this. +# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Java-support +# https://solutions.posit.co/envs-pkgs/using-rjava/ +ENV JAVA_HOME=/usr/lib/jvm/jre-11-openjdk + +# R 3.x requires PCRE2 for Pango support on RHEL 9 +ENV INCLUDE_PCRE2_IN_R_3 yes + +COPY package.rhel-9 /package.sh +COPY build.sh . +COPY patches /patches +ENTRYPOINT ./build.sh diff --git a/builder/docker-compose.yml b/builder/docker-compose.yml index c63f01a..5e29a71 100644 --- a/builder/docker-compose.yml +++ b/builder/docker-compose.yml @@ -143,6 +143,18 @@ services: image: r-builds:rhel-9 volumes: - /tmp/rhel-9:/tmp/output/rhel-9 + rhel-10: + command: ./build.sh + environment: + - R_VERSION=${R_VERSION} + - R_INSTALL_PATH=${R_INSTALL_PATH} + - LOCAL_STORE=/tmp/output + build: + context: . + dockerfile: Dockerfile.rhel-10 + image: r-builds:rhel-10 + volumes: + - /tmp/rhel-10:/tmp/output/rhel-10 opensuse-155: command: ./build.sh environment: diff --git a/builder/package.rhel-10 b/builder/package.rhel-10 new file mode 100644 index 0000000..1c3d03b --- /dev/null +++ b/builder/package.rhel-10 @@ -0,0 +1,116 @@ +#!/bin/bash + +if [[ ! -d /tmp/output/${OS_IDENTIFIER} ]]; then + mkdir -p "/tmp/output/${OS_IDENTIFIER}" +fi + +# R 3.x requires PCRE1. On RHEL 9, R 3.x also requires PCRE2 for Pango support. +pcre_libs='- pcre2-devel' +if [[ "${R_VERSION}" =~ ^3 ]]; then + pcre_libs='- pcre2-devel +- 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' + + # 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 +" +fi + +if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch + +cat < /tmp/nfpm.yml +name: R-${R_VERSION} +version: 1 +version_schema: none +arch: $(cat /tmp/arch) +release: 1 +maintainer: Posit Software, PBC +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 +- ${blas_lib} +- pango +${pcre_libs} +- tcl +- tk +- unzip +- which +- xz-devel +- zip +- zlib-devel +contents: +- src: ${R_INSTALL_PATH} + dst: ${R_INSTALL_PATH} +${scripts} +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)