]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/ci/scripts/r_docker_configure.sh
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / ci / scripts / r_docker_configure.sh
1 #!/usr/bin/env bash
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18
19 set -ex
20
21 : ${R_BIN:=R}
22
23 # The Dockerfile should have put this file here
24 if [ -f "/arrow/ci/etc/rprofile" ]; then
25 # Ensure parallel R package installation, set CRAN repo mirror,
26 # and use pre-built binaries where possible
27 cat /arrow/ci/etc/rprofile >> $(${R_BIN} RHOME)/etc/Rprofile.site
28 fi
29
30 # Ensure parallel compilation of C/C++ code
31 echo "MAKEFLAGS=-j$(${R_BIN} -s -e 'cat(parallel::detectCores())')" >> $(R RHOME)/etc/Renviron.site
32
33 # Special hacking to try to reproduce quirks on fedora-clang-devel on CRAN
34 # which uses a bespoke clang compiled to use libc++
35 # https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-clang
36 if [ "$RHUB_PLATFORM" = "linux-x86_64-fedora-clang" ]; then
37 dnf install -y libcxx-devel
38 sed -i.bak -E -e 's/(CXX1?1? =.*)/\1 -stdlib=libc++/g' $(${R_BIN} RHOME)/etc/Makeconf
39 rm -rf $(${R_BIN} RHOME)/etc/Makeconf.bak
40
41 sed -i.bak -E -e 's/(CXXFLAGS = )(.*)/\1 -g -O3 -Wall -pedantic -frtti -fPIC/' $(${R_BIN} RHOME)/etc/Makeconf
42 rm -rf $(${R_BIN} RHOME)/etc/Makeconf.bak
43 fi
44
45 # Special hacking to try to reproduce quirks on centos using non-default build
46 # tooling.
47 if [[ "$DEVTOOLSET_VERSION" -gt 0 ]]; then
48 if [ "`which dnf`" ]; then
49 dnf install -y centos-release-scl
50 dnf install -y "devtoolset-$DEVTOOLSET_VERSION"
51 else
52 yum install -y centos-release-scl
53 yum install -y "devtoolset-$DEVTOOLSET_VERSION"
54 fi
55 fi
56
57 # Install openssl for S3 support
58 if [ "$ARROW_S3" == "ON" ] || [ "$ARROW_R_DEV" == "TRUE" ]; then
59 if [ "`which dnf`" ]; then
60 dnf install -y libcurl-devel openssl-devel
61 elif [ "`which yum`" ]; then
62 yum install -y libcurl-devel openssl-devel
63 elif [ "`which zypper`" ]; then
64 zypper install -y libcurl-devel libopenssl-devel
65 else
66 apt-get update
67 apt-get install -y libcurl4-openssl-dev libssl-dev
68 fi
69
70 # The Dockerfile should have put this file here
71 if [ -f "/arrow/ci/scripts/install_minio.sh" ] && [ "`which wget`" ]; then
72 /arrow/ci/scripts/install_minio.sh amd64 linux latest /usr/local
73 fi
74
75 if [ -f "/arrow/ci/scripts/install_gcs_testbench.sh" ] && [ "`which pip`" ]; then
76 /arrow/ci/scripts/install_gcs_testbench.sh amd64 default
77 fi
78 fi
79
80 # Workaround for html help install failure; see https://github.com/r-lib/devtools/issues/2084#issuecomment-530912786
81 Rscript -e 'x <- file.path(R.home("doc"), "html"); if (!file.exists(x)) {dir.create(x, recursive=TRUE); file.copy(system.file("html/R.css", package="stats"), x)}'