From 3d3918230c531c42ce7826faf9cb5580a85fa11d Mon Sep 17 00:00:00 2001 From: Greg Lin Date: Fri, 22 Oct 2021 18:28:04 -0500 Subject: [PATCH] Include PCRE2 in R 3.x on Debian 11 for Pango support In Debian 11, Pango now depends on PCRE2, so R 3.x will not be compiled with Pango support if we hide PCRE2 to prevent R 3.5 and 3.6 from taking an unnecessary dependency on PCRE2. To check if R 3.x was compiled without Pango support, look for this line in the configure output: checking whether pkg-config knows about cairo and pango... no Or in R, check if the "bitmapType" option defaults to "Xlib" instead of "Cairo": > getOption("bitmapType") "Xlib" --- builder/Dockerfile.debian-11 | 3 +++ builder/build.sh | 7 ++++++- builder/package.debian-11 | 8 ++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/builder/Dockerfile.debian-11 b/builder/Dockerfile.debian-11 index 02e5c23..ba4d1bd 100644 --- a/builder/Dockerfile.debian-11 +++ b/builder/Dockerfile.debian-11 @@ -19,6 +19,9 @@ RUN gem install fpm # Override the default pager used by R ENV PAGER /usr/bin/pager +# R 3.x requires PCRE2 for Pango support on Debian 11 +ENV INCLUDE_PCRE2_IN_R_3 yes + COPY package.debian-11 /package.sh COPY build.sh . ENTRYPOINT ./build.sh diff --git a/builder/build.sh b/builder/build.sh index 8f77a36..32e3d21 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -70,7 +70,12 @@ compile_r() { # Since there's no way to disable this in the configure script, and we need # PCRE2 for R 4.x, we hide PCRE2 from the configure script by temporarily # removing the pkg-config file and pcre2-config script. - if [[ "${1}" =~ ^3 ]] && pkg-config --exists libpcre2-8; then + # + # The INCLUDE_PCRE2_IN_R_3 environment variable can be set to include PCRE2 + # in R 3.x builds, for distributions where PCRE2 is always required. + # In Debian 11, 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 mkdir -p /tmp/pcre2 pc_dir=$(pkg-config --variable pcfiledir libpcre2-8) mv ${pc_dir}/libpcre2-8.pc /tmp/pcre2 diff --git a/builder/package.debian-11 b/builder/package.debian-11 index 93ce643..27f1d0f 100644 --- a/builder/package.debian-11 +++ b/builder/package.debian-11 @@ -4,10 +4,10 @@ if [[ ! -d /tmp/output/debian-11 ]]; then mkdir -p /tmp/output/debian-11 fi -# R 3.x requires PCRE1 -pcre_lib='libpcre2-dev' +# R 3.x requires PCRE1. On Debian 11, R 3.x also requires PCRE2 for Pango support. +pcre_lib_flags='-d libpcre2-dev' if [[ "${R_VERSION}" =~ ^3 ]]; then - pcre_lib='libpcre3-dev' + pcre_lib_flags='-d libpcre2-dev -d libpcre3-dev' fi fpm \ @@ -39,7 +39,7 @@ fpm \ -d libpango-1.0-0 \ -d libpangocairo-1.0-0 \ -d libpaper-utils \ - -d ${pcre_lib} \ + ${pcre_lib_flags} \ -d libpng16-16 \ -d libreadline8 \ -d libtcl8.6 \