Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Jul 18, 2023
2 parents f204cc5 + b541a8f commit f426ec6
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 295 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PLATFORMS := ubuntu-1804 ubuntu-2004 ubuntu-2204 debian-10 debian-11 centos-7 centos-8 rhel-9 opensuse-153 opensuse-154
PLATFORMS := ubuntu-2004 ubuntu-2204 debian-10 debian-11 debian-12 centos-7 centos-8 rhel-9 opensuse-154
SLS_BINARY ?= ./node_modules/serverless/bin/serverless.js

deps:
Expand Down Expand Up @@ -37,7 +37,7 @@ rebuild-all: deps fetch-serverless-custom-file
$(SLS_BINARY) invoke stepf -n rBuilds -d '{"force": true}'

serverless-deploy.%: deps fetch-serverless-custom-file
$(SLS_BINARY) deploy --stage $*
$(SLS_BINARY) deploy --stage $* --verbose

define GEN_TARGETS
docker-build-$(platform):
Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ bug, or ask questions on [Posit Community](https://community.rstudio.com).

R binaries are built for the following Linux operating systems:

- Ubuntu 18.04, 20.04, 22.04
- Debian 10, 11
- Ubuntu 20.04, 22.04
- Debian 10, 11, 12
- CentOS 7
- Red Hat Enterprise Linux 7, 8, 9
- openSUSE 15.3, 15.4
- SUSE Linux Enterprise 15 SP3, 15 SP4
- openSUSE 15.4
- SUSE Linux Enterprise 15 SP4

Operating systems are supported until their vendor end-of-support dates, which
can be found on the [Posit Platform Support](https://posit.co/about/platform-support/)
Expand Down Expand Up @@ -56,9 +56,6 @@ R_VERSION=4.1.3

Download the deb package:
```bash
# Ubuntu 18.04
curl -O https://cdn.posit.co/r/ubuntu-1804/pkgs/r-${R_VERSION}_1_amd64.deb

# Ubuntu 20.04
curl -O https://cdn.posit.co/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb

Expand All @@ -70,6 +67,9 @@ curl -O https://cdn.posit.co/r/debian-10/pkgs/r-${R_VERSION}_1_amd64.deb

# Debian 11
curl -O https://cdn.posit.co/r/debian-11/pkgs/r-${R_VERSION}_1_amd64.deb

# Debian 12
curl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_amd64.deb
```

Then install the package:
Expand Down Expand Up @@ -137,9 +137,6 @@ sudo yum install R-${R_VERSION}-1-1.x86_64.rpm

Download the rpm package:
```bash
# openSUSE 15.3 / SLES 15 SP3
curl -O https://cdn.posit.co/r/opensuse-153/pkgs/R-${R_VERSION}-1-1.x86_64.rpm

# openSUSE 15.4 / SLES 15 SP4
curl -O https://cdn.posit.co/r/opensuse-154/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
```
Expand Down Expand Up @@ -288,7 +285,7 @@ environment:
# snip
JOB_DEFINITION_ARN_debian_11:
Ref: rBuildsBatchJobDefinitionDebian11
SUPPORTED_PLATFORMS: ubuntu-1804,debian-10,centos-7,centos-8
SUPPORTED_PLATFORMS: debian-10,centos-7,centos-8
```

### Makefile
Expand Down
33 changes: 33 additions & 0 deletions builder/Dockerfile.debian-12
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM debian:bookworm

ENV OS_IDENTIFIER debian-12

RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo 'deb-src http://deb.debian.org/debian bookworm main' >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y curl gcc libcurl4-openssl-dev libicu-dev \
libopenblas0 libpcre2-dev make unzip wget \
&& apt-get build-dep -y r-base

# 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 chmod 0777 /opt

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"

# Override the default pager used by R
ENV PAGER /usr/bin/pager

# R 3.x requires PCRE2 for Pango support on Debian 12
ENV INCLUDE_PCRE2_IN_R_3 yes

COPY package.debian-12 /package.sh
COPY build.sh .
ENTRYPOINT ./build.sh
92 changes: 0 additions & 92 deletions builder/Dockerfile.opensuse-153

This file was deleted.

25 changes: 0 additions & 25 deletions builder/Dockerfile.ubuntu-1804

This file was deleted.

28 changes: 24 additions & 4 deletions builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,24 @@ fetch_r_source() {
rm /tmp/R-${1}.tar.gz
}

# Apply a patch for this R version if present. Typically for R-devel.
patch_r() {
cd /tmp/R-${1}

if [ -f "/patches/R-${1}.patch" ]; then
patch -p1 < "/patches/R-${1}.patch"
fi
}

# compile_r() - $1 as r version
compile_r() {
cd /tmp/R-${1}
r_version=${1}
cd "/tmp/R-${r_version}"

# tools/config.guess in R versions older than 3.2.2 guess 'unknown' instead of 'pc'
# test the version and properly set the flag.
build_flag="--build=$(uname -m)-pc-linux-gnu"
if _version_is_greater_than ${R_VERSION} 3.2.2; then
if _version_is_greater_than "${r_version}" 3.2.2; then
build_flag=''
fi

Expand All @@ -84,7 +94,7 @@ compile_r() {
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Using-Fortran
# https://gcc.gnu.org/gcc-10/porting_to.html
gcc_major_version=$(gcc -dumpversion | cut -d '.' -f 1)
if _version_is_less_than "${R_VERSION}" 3.6.2 && _version_is_greater_than "${gcc_major_version}" 9; then
if _version_is_less_than "${r_version}" 3.6.2 && _version_is_greater_than "${gcc_major_version}" 9; then
# Default CFLAGS/FFLAGS for all R 3.x versions is '-g -O2' when using GCC
export CFLAGS='-g -O2 -fcommon'
export FFLAGS='-g -O2 -fallow-argument-mismatch'
Expand All @@ -102,7 +112,7 @@ compile_r() {
# in R 3.x builds, for distributions where PCRE2 is always required.
# In Debian 11/Ubuntu 22/RHEL 9, Pango now depends on PCRE2, so R 3.x will not be compiled with
# Pango support if the PCRE2 pkg-config file is missing.
if [[ "${1}" =~ ^3 ]] && pkg-config --exists libpcre2-8 && [ -z "$INCLUDE_PCRE2_IN_R_3" ]; then
if [[ "${r_version}" =~ ^3 ]] && pkg-config --exists libpcre2-8 && [ -z "$INCLUDE_PCRE2_IN_R_3" ]; then
mkdir -p /tmp/pcre2
pc_dir=$(pkg-config --variable pcfiledir libpcre2-8)
mv ${pc_dir}/libpcre2-8.pc /tmp/pcre2
Expand All @@ -111,6 +121,15 @@ compile_r() {
trap "{ mv /tmp/pcre2/libpcre2-8.pc ${pc_dir}; mv /tmp/pcre2/pcre2-config ${config_bin}; }" EXIT
fi

# Allow libcurl 8.x to be used in R 4.2 and below. Despite a change in major
# version number, libcurl 8 changes neither API nor ABI. This applies the same
# change to configure made in R 4.3.0, replacing exit(1) with exit(0) when
# LIBCURL_VERSION_MAJOR > 7.
# https://github.com/wch/r-source/commit/da6638896413bcbb5970b2335b92582853f94e3c
if _version_is_less_than "${r_version}" 4.3.0; then
sed -i -z 's/#if LIBCURL_VERSION_MAJOR > 7\n exit(1)/#if LIBCURL_VERSION_MAJOR > 7\n exit(0)/' configure
fi

# Default configure options. Some Dockerfiles override this with an ENV directive.
default_configure_options="\
--enable-R-shlib \
Expand Down Expand Up @@ -194,6 +213,7 @@ _version_is_less_than() {
###### RUN R COMPILE PROCEDURE ######
set_up_environment
fetch_r_source $R_VERSION
patch_r $R_VERSION
compile_r $R_VERSION
package_r $R_VERSION
archive_r
Expand Down
36 changes: 12 additions & 24 deletions builder/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
services:
ubuntu-1804:
command: ./build.sh
environment:
- R_VERSION=${R_VERSION}
- R_INSTALL_PATH=${R_INSTALL_PATH}
- LOCAL_STORE=/tmp/output
build:
context: .
dockerfile: Dockerfile.ubuntu-1804
image: r-builds:ubuntu-1804
volumes:
- ./integration/tmp:/tmp/output
ubuntu-2004:
command: ./build.sh
environment:
Expand Down Expand Up @@ -59,52 +47,52 @@ services:
image: r-builds:debian-11
volumes:
- ./integration/tmp:/tmp/output
centos-7:
debian-12:
command: ./build.sh
environment:
- R_VERSION=${R_VERSION}
- R_INSTALL_PATH=${R_INSTALL_PATH}
- LOCAL_STORE=/tmp/output
build:
context: .
dockerfile: Dockerfile.centos-7
image: r-builds:centos-7
dockerfile: Dockerfile.debian-12
image: r-builds:debian-12
volumes:
- ./integration/tmp:/tmp/output
centos-8:
centos-7:
command: ./build.sh
environment:
- R_VERSION=${R_VERSION}
- R_INSTALL_PATH=${R_INSTALL_PATH}
- LOCAL_STORE=/tmp/output
build:
context: .
dockerfile: Dockerfile.centos-8
image: r-builds:centos-8
dockerfile: Dockerfile.centos-7
image: r-builds:centos-7
volumes:
- ./integration/tmp:/tmp/output
rhel-9:
centos-8:
command: ./build.sh
environment:
- R_VERSION=${R_VERSION}
- R_INSTALL_PATH=${R_INSTALL_PATH}
- LOCAL_STORE=/tmp/output
build:
context: .
dockerfile: Dockerfile.rhel-9
image: r-builds:rhel-9
dockerfile: Dockerfile.centos-8
image: r-builds:centos-8
volumes:
- ./integration/tmp:/tmp/output
opensuse-153:
rhel-9:
command: ./build.sh
environment:
- R_VERSION=${R_VERSION}
- R_INSTALL_PATH=${R_INSTALL_PATH}
- LOCAL_STORE=/tmp/output
build:
context: .
dockerfile: Dockerfile.opensuse-153
image: r-builds:opensuse-153
dockerfile: Dockerfile.rhel-9
image: r-builds:rhel-9
volumes:
- ./integration/tmp:/tmp/output
opensuse-154:
Expand Down
Loading

0 comments on commit f426ec6

Please sign in to comment.