├── .github ├── CODEOWNERS ├── CONTRIBUTING.md └── workflows │ ├── devel-daily.yml │ ├── check-r-versions.yml │ └── build.yml ├── .gitignore ├── test ├── testpkg │ ├── .gitignore │ ├── .Rbuildignore │ ├── src │ │ ├── Makevars │ │ ├── square.f │ │ ├── add.c │ │ ├── subtract.cpp │ │ └── init.c │ ├── README.md │ ├── tests │ │ └── test.R │ ├── NAMESPACE │ ├── DESCRIPTION │ ├── man │ │ ├── square_it.Rd │ │ ├── add_it.Rd │ │ ├── testpkg-package.Rd │ │ └── subtract_it.Rd │ ├── testpkg.Rproj │ └── R │ │ └── testpkg.R ├── test-r.sh ├── test-apt.sh ├── test-zypper.sh ├── test-yum.sh ├── docker-compose.yml └── test.R ├── requirements.txt ├── Makefile ├── get_matrix.py ├── manage_r_versions.py ├── README.md ├── install.sh └── LICENSE /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | *ubuntu* @stevenolen 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | R-* 2 | builder/integration/** 3 | -------------------------------------------------------------------------------- /test/testpkg/.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | -------------------------------------------------------------------------------- /test/testpkg/.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | -------------------------------------------------------------------------------- /test/testpkg/src/Makevars: -------------------------------------------------------------------------------- 1 | CXX_STD=CXX11 2 | PKG_LIBS=$(MAIN_LDFLAGS) $(LDFLAGS) $(LIBR) $(LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(SHLIB_OPENMP_CFLAGS) 3 | -------------------------------------------------------------------------------- /test/testpkg/README.md: -------------------------------------------------------------------------------- 1 | # testpkg 2 | 3 | Test package with C/C++ and Fortran code, which links against libR, BLAS, LAPACK (see [Makevars](src/Makevars)). 4 | -------------------------------------------------------------------------------- /test/testpkg/tests/test.R: -------------------------------------------------------------------------------- 1 | library(testpkg) 2 | 3 | stopifnot(add_it(1, 2) == 3) 4 | stopifnot(subtract_it(1, 2) == -1) 5 | stopifnot(square_it(3) == 9) 6 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | See the [Developer Documentation](../#developer-documentation) for information on contributing to R builds. 4 | -------------------------------------------------------------------------------- /test/testpkg/NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(add_it) 4 | export(square_it) 5 | export(subtract_it) 6 | useDynLib(testpkg, .registration = TRUE) 7 | -------------------------------------------------------------------------------- /test/testpkg/src/square.f: -------------------------------------------------------------------------------- 1 | subroutine square(x,answer) 2 | integer, intent(in) :: x 3 | integer, intent(out) :: answer 4 | answer = x * x 5 | end 6 | -------------------------------------------------------------------------------- /test/testpkg/src/add.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | SEXP add(SEXP a, SEXP b) 5 | { 6 | SEXP result = PROTECT(Rf_allocVector(REALSXP, 1)); 7 | REAL(result)[0] = Rf_asReal(a) + Rf_asReal(b); 8 | UNPROTECT(1); 9 | return result; 10 | } 11 | -------------------------------------------------------------------------------- /test/testpkg/src/subtract.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern "C" SEXP subtract(SEXP a, SEXP b) 5 | { 6 | SEXP result = PROTECT(Rf_allocVector(REALSXP, 1)); 7 | REAL(result)[0] = Rf_asReal(a) - Rf_asReal(b); 8 | UNPROTECT(1); 9 | return result; 10 | } 11 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.13.4 2 | boto3==1.38.23 3 | botocore==1.38.23 4 | certifi==2025.4.26 5 | charset-normalizer==3.4.2 6 | idna==3.10 7 | jmespath==1.0.1 8 | python-dateutil==2.9.0.post0 9 | requests==2.32.3 10 | s3transfer==0.13.0 11 | six==1.17.0 12 | soupsieve==2.7 13 | typing_extensions==4.13.2 14 | urllib3==2.4.0 15 | -------------------------------------------------------------------------------- /test/testpkg/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: testpkg 2 | Type: Package 3 | Title: A Test Package 4 | Version: 0.1.0 5 | Authors@R: person("Test", "Pkg", email = "test@test", role = c("aut", "cre")) 6 | Description: A test package. 7 | License: MIT 8 | Depends: 9 | R (>= 3.0) 10 | SystemRequirements: C++11 11 | RoxygenNote: 6.1.1 12 | Encoding: UTF-8 13 | -------------------------------------------------------------------------------- /test/testpkg/man/square_it.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/testpkg.R 3 | \name{square_it} 4 | \alias{square_it} 5 | \title{Square it up} 6 | \usage{ 7 | square_it(n) 8 | } 9 | \arguments{ 10 | \item{n}{Integer} 11 | } 12 | \value{ 13 | Square 14 | } 15 | \description{ 16 | Square it up 17 | } 18 | -------------------------------------------------------------------------------- /test/testpkg/man/add_it.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/testpkg.R 3 | \name{add_it} 4 | \alias{add_it} 5 | \title{Add it together} 6 | \usage{ 7 | add_it(a, b) 8 | } 9 | \arguments{ 10 | \item{a}{Number} 11 | 12 | \item{b}{Number} 13 | } 14 | \value{ 15 | Sum of numbers 16 | } 17 | \description{ 18 | Add it together 19 | } 20 | -------------------------------------------------------------------------------- /test/testpkg/man/testpkg-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/testpkg.R 3 | \docType{package} 4 | \name{testpkg-package} 5 | \alias{testpkg} 6 | \alias{testpkg-package} 7 | \title{testpkg: A Test Package} 8 | \description{ 9 | A test package. 10 | } 11 | \author{ 12 | \strong{Maintainer}: Test Pkg \email{test@test} 13 | 14 | } 15 | -------------------------------------------------------------------------------- /test/testpkg/man/subtract_it.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/testpkg.R 3 | \name{subtract_it} 4 | \alias{subtract_it} 5 | \title{Subtract it} 6 | \usage{ 7 | subtract_it(a, b) 8 | } 9 | \arguments{ 10 | \item{a}{Number} 11 | 12 | \item{b}{Number} 13 | } 14 | \value{ 15 | Difference of numbers 16 | } 17 | \description{ 18 | Subtract it 19 | } 20 | -------------------------------------------------------------------------------- /.github/workflows/devel-daily.yml: -------------------------------------------------------------------------------- 1 | name: Daily R-devel and R-next builds 2 | 3 | on: 4 | schedule: 5 | - cron: '0 4 * * *' 6 | workflow_dispatch: 7 | 8 | permissions: 9 | id-token: write 10 | contents: read 11 | 12 | jobs: 13 | r-builds: 14 | uses: ./.github/workflows/build.yml 15 | with: 16 | r_versions: 'devel,next' 17 | publish: production 18 | secrets: inherit 19 | -------------------------------------------------------------------------------- /test/testpkg/testpkg.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: No 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageRoxygenize: rd,collate,namespace 20 | -------------------------------------------------------------------------------- /test/test-r.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" 5 | 6 | R_HOME=/opt/R/${R_VERSION}/lib/R 7 | "${R_HOME}/bin/R" --version 8 | "${R_HOME}/bin/Rscript" -e 'sessionInfo()' 9 | 10 | # List R devel dependencies 11 | $("${R_HOME}/bin/R" CMD config CC) --version 12 | $("${R_HOME}/bin/R" CMD config CXX) --version 13 | $("${R_HOME}/bin/R" CMD config FC) --version 14 | 15 | # List shared library dependencies (e.g. BLAS/LAPACK) 16 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${R_HOME}/lib ldd "${R_HOME}/lib/libR.so" 17 | 18 | DIR=$SCRIPT_DIR "${R_HOME}/bin/Rscript" "${SCRIPT_DIR}/test.R" 19 | -------------------------------------------------------------------------------- /test/testpkg/R/testpkg.R: -------------------------------------------------------------------------------- 1 | #' @useDynLib testpkg, .registration = TRUE 2 | "_PACKAGE" 3 | 4 | #' Add it together 5 | #' 6 | #' @param a Number 7 | #' @param b Number 8 | #' @return Sum of numbers 9 | #' @export 10 | add_it <- function(a, b) { 11 | .Call("add", a, b) 12 | } 13 | 14 | #' Subtract it 15 | #' 16 | #' @param a Number 17 | #' @param b Number 18 | #' @return Difference of numbers 19 | #' @export 20 | subtract_it <- function(a, b) { 21 | .Call("subtract", a, b) 22 | } 23 | 24 | #' Square it up 25 | #' 26 | #' @param n Integer 27 | #' @return Square 28 | #' @export 29 | square_it <- function(n) { 30 | result <- .Fortran("square", n = as.integer(n), answer = as.integer(1)) 31 | result$answer 32 | } 33 | -------------------------------------------------------------------------------- /test/test-apt.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" 5 | 6 | # Install quick install script prerequisites 7 | if ! command -v curl > /dev/null 2>&1; then 8 | apt update -qq 9 | apt install -y curl 10 | fi 11 | 12 | # Run the quick install script. Use a locally built file if present, otherwise from the CDN. 13 | tmpdir=$(mktemp -d) 14 | cp -r "${SCRIPT_DIR}/../builder/integration/tmp/${OS_IDENTIFIER}/." "$tmpdir" > /dev/null 2>&1 || true 15 | (cd "$tmpdir" && SCRIPT_ACTION=install R_VERSION="${R_VERSION}" RUN_UNATTENDED=1 "${SCRIPT_DIR}/../install.sh") 16 | 17 | # Show DEB info 18 | apt show "r-${R_VERSION}" 19 | 20 | "${SCRIPT_DIR}/test-r.sh" 21 | 22 | apt remove -y "r-${R_VERSION}" 23 | 24 | if [ -d "/opt/R/${R_VERSION}" ]; then 25 | echo "Failed to uninstall completely" 26 | exit 1 27 | fi 28 | -------------------------------------------------------------------------------- /test/test-zypper.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" 5 | 6 | # Install quick install script prerequisites 7 | if ! command -v curl > /dev/null 2>&1; then 8 | zypper --non-interactive install curl 9 | fi 10 | 11 | # Run the quick install script. Use a locally built file if present, otherwise from the CDN. 12 | tmpdir=$(mktemp -d) 13 | cp -r "${SCRIPT_DIR}/../builder/integration/tmp/${OS_IDENTIFIER}/." "$tmpdir" > /dev/null 2>&1 || true 14 | (cd "$tmpdir" && SCRIPT_ACTION=install R_VERSION="${R_VERSION}" RUN_UNATTENDED=1 "${SCRIPT_DIR}/../install.sh") 15 | 16 | # Show RPM info 17 | rpm -qi "R-${R_VERSION}" 18 | 19 | "${SCRIPT_DIR}/test-r.sh" 20 | 21 | zypper --non-interactive remove "R-${R_VERSION}" 22 | 23 | if [ -d "/opt/R/${R_VERSION}" ]; then 24 | echo "Failed to uninstall completely" 25 | exit 1 26 | fi 27 | -------------------------------------------------------------------------------- /test/testpkg/src/init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define CALLDEF(name, n) {#name, (DL_FUNC) &name, n} 6 | #define FDEF(name) {#name, (DL_FUNC) &F77_SUB(name), sizeof(name ## _t)/sizeof(name ## _t[0]), name ##_t} 7 | 8 | extern SEXP add(SEXP, SEXP); 9 | extern SEXP subtract(SEXP, SEXP); 10 | 11 | void F77_SUB(square)(int *n, int *answer); 12 | 13 | static R_NativePrimitiveArgType square_t[] = { 14 | INTSXP, 15 | INTSXP 16 | }; 17 | 18 | static const R_CallMethodDef CallEntries[] = { 19 | CALLDEF(add, 2), 20 | CALLDEF(subtract, 2), 21 | {NULL, NULL, 0} 22 | }; 23 | 24 | static const R_FortranMethodDef fMethods[] = { 25 | FDEF(square), 26 | {NULL, NULL, 0} 27 | }; 28 | 29 | void R_init_testpkg(DllInfo *dll) 30 | { 31 | R_registerRoutines(dll, NULL, CallEntries, fMethods, NULL); 32 | R_useDynamicSymbols(dll, FALSE); 33 | } 34 | -------------------------------------------------------------------------------- /test/test-yum.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" 5 | 6 | if command -v dnf > /dev/null 2>&1; then 7 | YUM=dnf 8 | else 9 | YUM=yum 10 | fi 11 | 12 | # Install quick install script prerequisites 13 | if ! command -v curl > /dev/null 2>&1; then 14 | $YUM install -y curl 15 | fi 16 | 17 | # Run the quick install script. Use a locally built file if present, otherwise from the CDN. 18 | tmpdir=$(mktemp -d) 19 | cp -r "${SCRIPT_DIR}/../builder/integration/tmp/${OS_IDENTIFIER}/." "$tmpdir" > /dev/null 2>&1 || true 20 | (cd "$tmpdir" && SCRIPT_ACTION=install R_VERSION="${R_VERSION}" RUN_UNATTENDED=1 "${SCRIPT_DIR}/../install.sh") 21 | 22 | # Show rpm info 23 | rpm -qi "R-${R_VERSION}" 24 | 25 | "${SCRIPT_DIR}/test-r.sh" 26 | 27 | $YUM -y remove "R-${R_VERSION}" 28 | 29 | if [ -d "/opt/R/${R_VERSION}" ]; then 30 | echo "Failed to uninstall completely" 31 | exit 1 32 | fi 33 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PLATFORMS := ubuntu-2004 ubuntu-2204 ubuntu-2404 debian-12 debian-13 centos-7 centos-8 rhel-9 rhel-10 opensuse-156 opensuse-160 fedora-41 fedora-42 fedora-43 2 | 3 | docker-build: 4 | @cd builder && docker compose build --parallel 5 | 6 | docker-down: 7 | @cd builder && docker compose down 8 | 9 | docker-build-r: docker-build 10 | @cd builder && docker compose up 11 | 12 | docker-shell-r-env: 13 | @cd builder && docker compose run --entrypoint /bin/bash ubuntu-2004 14 | 15 | define GEN_TARGETS 16 | # Use PLATFORM_ARCH to override the architecture, e.g. PLATFORM_ARCH=linux/arm64 or PLATFORM_ARCH=linux/amd64 17 | # If unset, PLATFORM_ARCH will default to the architecture of the host machine. 18 | docker-build-$(platform): 19 | @cd builder && PLATFORM_ARCH=$(PLATFORM_ARCH) docker compose build $(platform) 20 | 21 | build-r-$(platform): 22 | cd builder && R_VERSION=$(R_VERSION) PLATFORM_ARCH=$(PLATFORM_ARCH) docker compose run --rm $(platform) 23 | 24 | test-r-$(platform): 25 | @cd test && R_VERSION=$(R_VERSION) PLATFORM_ARCH=$(PLATFORM_ARCH) docker compose run --rm $(platform) 26 | 27 | publish-r-$(platform): 28 | aws s3 cp builder/integration/tmp/r/$(platform)/ s3://$(S3_BUCKET)/r/$(platform) --recursive 29 | aws s3 cp builder/integration/tmp/$(platform)/ s3://$(S3_BUCKET)/r/$(platform)/pkgs --recursive 30 | 31 | bash-$(platform): 32 | docker run -it --rm --entrypoint /bin/bash -v $(CURDIR):/r-builds r-builds:$(platform) 33 | 34 | .PHONY: docker-build-$(platform) build-r-$(platform) test-r-$(platform) publish-r-$(platform) bash-$(platform) 35 | endef 36 | 37 | $(foreach platform,$(PLATFORMS), \ 38 | $(eval $(GEN_TARGETS)) \ 39 | ) 40 | 41 | print-platforms: 42 | @echo $(PLATFORMS) 43 | 44 | # Helper for launching a bash session on a docker image of your choice. Defaults 45 | # to "ubuntu:noble". 46 | TARGET_IMAGE?=ubuntu:noble 47 | bash: 48 | docker run --privileged=true -it --rm \ 49 | -v $(CURDIR):/r-builds \ 50 | -w /r-builds \ 51 | ${TARGET_IMAGE} /bin/bash 52 | 53 | .PHONY: docker-build docker-down print-platforms 54 | -------------------------------------------------------------------------------- /.github/workflows/check-r-versions.yml: -------------------------------------------------------------------------------- 1 | name: Check for new R versions 2 | 3 | on: 4 | schedule: 5 | - cron: "0 * * * *" 6 | workflow_dispatch: 7 | inputs: 8 | publish: 9 | description: | 10 | Publish the builds to S3 staging or production? Defaults to staging. 11 | required: false 12 | default: 'staging' 13 | type: choice 14 | options: 15 | - staging 16 | - production 17 | 18 | permissions: 19 | id-token: write 20 | contents: read 21 | 22 | jobs: 23 | check-r-versions: 24 | runs-on: ubuntu-latest 25 | outputs: 26 | new_r_versions: ${{ steps.check_r_versions.outputs.new_r_versions }} 27 | steps: 28 | - name: Checkout repository 29 | uses: actions/checkout@v4 30 | 31 | - name: Install Python 32 | uses: actions/setup-python@v5 33 | with: 34 | python-version: '3.x' 35 | cache: 'pip' 36 | 37 | - name: Install dependencies 38 | run: | 39 | pip install -r requirements.txt 40 | 41 | - name: Configure AWS Credentials 42 | uses: aws-actions/configure-aws-credentials@v4 43 | with: 44 | role-to-assume: ${{ secrets.AWS_PUBLISH_ROLE }} 45 | aws-region: ${{ secrets.AWS_REGION }} 46 | 47 | - name: Check for new R versions to build 48 | id: check_r_versions 49 | run: | 50 | publish=${{ inputs.publish || 'production' }} 51 | if [ $publish == 'staging' ]; then 52 | s3_bucket=${{ secrets.S3_BUCKET_STAGING }} 53 | else 54 | s3_bucket=${{ secrets.S3_BUCKET_PRODUCTION }} 55 | fi 56 | new_r_versions=$(python manage_r_versions.py check --s3-bucket="${s3_bucket}") 57 | if [ -z "$new_r_versions" ]; then 58 | echo "No new R versions found" 59 | else 60 | echo "New R versions: $new_r_versions" 61 | fi 62 | echo "new_r_versions=$new_r_versions" >> $GITHUB_OUTPUT 63 | 64 | build-new-r-versions: 65 | needs: check-r-versions 66 | if: ${{ needs.check-r-versions.outputs.new_r_versions != '' }} 67 | uses: ./.github/workflows/build.yml 68 | with: 69 | r_versions: ${{ needs.check-r-versions.outputs.new_r_versions }} 70 | publish: ${{ inputs.publish || 'production' }} 71 | secrets: inherit 72 | 73 | # Notify Hosted about new R versions 74 | notify-slack-success: 75 | needs: [build-new-r-versions, check-r-versions] 76 | if: ${{ needs.check-r-versions.outputs.new_r_versions != '' }} 77 | runs-on: ubuntu-latest 78 | steps: 79 | - name: Notify Slack on successful new R version build 80 | uses: slackapi/slack-github-action@v2.1.0 81 | with: 82 | webhook: ${{ secrets.SLACK_WEBHOOK_URL }} 83 | webhook-type: incoming-webhook 84 | payload: | 85 | text: "R-builds - new R versions built and published: ${{ needs.check-r-versions.outputs.new_r_versions }}" 86 | -------------------------------------------------------------------------------- /get_matrix.py: -------------------------------------------------------------------------------- 1 | """ 2 | Generates the build matrix for GitHub Actions across platforms, R versions, and architectures. 3 | 4 | Some platforms may not support certain R versions or architectures, and this script filters out those combinations 5 | and generates the complex build matrix. 6 | """ 7 | import argparse 8 | import json 9 | import subprocess 10 | 11 | 12 | def main(): 13 | parser = argparse.ArgumentParser(description="Print R-builds platforms as JSON.") 14 | parser.add_argument( 15 | '--platforms', 16 | type=str, 17 | default='all', 18 | help='Comma-separated list of platforms. Specify "all" to use all platforms (the default).' 19 | ) 20 | parser.add_argument( 21 | '--versions', 22 | type=str, 23 | required=True, 24 | help='Comma-separated list of R versions.' 25 | ) 26 | parser.add_argument( 27 | '--arch', 28 | type=str, 29 | default='amd64,arm64', 30 | help='Comma-separated list of architectures.' 31 | ) 32 | args = parser.parse_args() 33 | # Re-set to default values if empty string/whitespace explicitly specified (""), which can happen in CI jobs 34 | platforms = args.platforms if args.platforms else parser.get_default('platforms') 35 | arch = args.arch if args.arch else parser.get_default('arch') 36 | 37 | platforms = [p.strip() for p in platforms.split(',')] 38 | versions = [v.strip() for v in args.versions.split(',')] if args.versions else [] 39 | arch = [a.strip() for a in arch.split(',')] 40 | matrix = _get_matrix(platforms=platforms, versions=versions, arch=arch) 41 | print(json.dumps(matrix)) 42 | 43 | 44 | def _get_matrix(platforms=['all'], versions=[], arch=['amd64', 'arm64']): 45 | if platforms == ['all']: 46 | supported_platforms = subprocess.check_output(['make', 'print-platforms'], text=True) 47 | supported_platforms = supported_platforms.split() 48 | platforms = supported_platforms 49 | 50 | # Put all combinations in the "include" list, which allows complex matrix configurations 51 | include = [] 52 | # Record the platforms, R versions, and architectures that will be built after filtering invalid combinations 53 | build_platforms = set() 54 | build_r_versions = set() 55 | build_arch = set() 56 | 57 | for platform in platforms: 58 | for version in versions: 59 | # Rules to skip certain combinations go here, e.g., old R versions that no longer build on newer platforms 60 | if platform == 'rhel-10' and version <= '3.6.3': 61 | # RHEL 10 does not support R 3.x because it does not have PCRE1 62 | continue 63 | if platform == 'debian-13' and version <= '3.6.3': 64 | # Debian 13 does not support R 3.x because it does not have PCRE1 65 | continue 66 | for a in arch: 67 | include.append({ 68 | "platform": platform, 69 | "r_version": version, 70 | "arch": a 71 | }) 72 | build_platforms.add(platform) 73 | build_r_versions.add(version) 74 | build_arch.add(a) 75 | 76 | matrix = {"include": include} 77 | return { 78 | # matrix will be used for building R 79 | "matrix": matrix, 80 | # platforms, r_versions, and arch are used for building the Docker images and updating versions.json 81 | "platforms": list(build_platforms), 82 | "r_versions": list(build_r_versions), 83 | "arch": list(build_arch) 84 | } 85 | 86 | 87 | if __name__ == '__main__': 88 | main() 89 | -------------------------------------------------------------------------------- /test/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | ubuntu-2004: 3 | image: ubuntu:focal 4 | command: /r-builds/test/test-apt.sh 5 | environment: 6 | - OS_IDENTIFIER=ubuntu-2004 7 | - R_VERSION=${R_VERSION} 8 | volumes: 9 | - ../:/r-builds 10 | platform: ${PLATFORM_ARCH} 11 | ubuntu-2204: 12 | image: ubuntu:jammy 13 | command: /r-builds/test/test-apt.sh 14 | environment: 15 | - OS_IDENTIFIER=ubuntu-2204 16 | - R_VERSION=${R_VERSION} 17 | volumes: 18 | - ../:/r-builds 19 | platform: ${PLATFORM_ARCH} 20 | ubuntu-2404: 21 | image: ubuntu:noble 22 | command: /r-builds/test/test-apt.sh 23 | environment: 24 | - OS_IDENTIFIER=ubuntu-2404 25 | - R_VERSION=${R_VERSION} 26 | volumes: 27 | - ../:/r-builds 28 | platform: ${PLATFORM_ARCH} 29 | debian-12: 30 | image: debian:bookworm 31 | command: /r-builds/test/test-apt.sh 32 | environment: 33 | - OS_IDENTIFIER=debian-12 34 | - R_VERSION=${R_VERSION} 35 | volumes: 36 | - ../:/r-builds 37 | platform: ${PLATFORM_ARCH} 38 | debian-13: 39 | image: debian:trixie 40 | command: /r-builds/test/test-apt.sh 41 | environment: 42 | - OS_IDENTIFIER=debian-13 43 | - R_VERSION=${R_VERSION} 44 | volumes: 45 | - ../:/r-builds 46 | platform: ${PLATFORM_ARCH} 47 | centos-7: 48 | image: centos:centos7 49 | command: | 50 | /bin/bash -c 'sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/* && 51 | /r-builds/test/test-yum.sh' 52 | environment: 53 | - OS_IDENTIFIER=centos-7 54 | - R_VERSION=${R_VERSION} 55 | volumes: 56 | - ../:/r-builds 57 | platform: ${PLATFORM_ARCH} 58 | centos-8: 59 | image: rockylinux:8 60 | command: /r-builds/test/test-yum.sh 61 | environment: 62 | - OS_IDENTIFIER=centos-8 63 | - R_VERSION=${R_VERSION} 64 | volumes: 65 | - ../:/r-builds 66 | platform: ${PLATFORM_ARCH} 67 | rhel-9: 68 | image: rockylinux:9 69 | command: /r-builds/test/test-yum.sh 70 | environment: 71 | - OS_IDENTIFIER=rhel-9 72 | - R_VERSION=${R_VERSION} 73 | volumes: 74 | - ../:/r-builds 75 | platform: ${PLATFORM_ARCH} 76 | rhel-10: 77 | image: rockylinux/rockylinux:10 78 | command: /r-builds/test/test-yum.sh 79 | environment: 80 | - OS_IDENTIFIER=rhel-10 81 | - R_VERSION=${R_VERSION} 82 | volumes: 83 | - ../:/r-builds 84 | platform: ${PLATFORM_ARCH} 85 | opensuse-156: 86 | image: opensuse/leap:15.6 87 | command: /r-builds/test/test-zypper.sh 88 | environment: 89 | - OS_IDENTIFIER=opensuse-156 90 | - R_VERSION=${R_VERSION} 91 | volumes: 92 | - ../:/r-builds 93 | platform: ${PLATFORM_ARCH} 94 | opensuse-160: 95 | image: opensuse/leap:16.0 96 | command: /r-builds/test/test-zypper.sh 97 | environment: 98 | - OS_IDENTIFIER=opensuse-160 99 | - R_VERSION=${R_VERSION} 100 | volumes: 101 | - ../:/r-builds 102 | platform: ${PLATFORM_ARCH} 103 | fedora-41: 104 | image: fedora:41 105 | command: /r-builds/test/test-yum.sh 106 | environment: 107 | - OS_IDENTIFIER=fedora-41 108 | - R_VERSION=${R_VERSION} 109 | volumes: 110 | - ../:/r-builds 111 | platform: ${PLATFORM_ARCH} 112 | fedora-42: 113 | image: fedora:42 114 | command: /r-builds/test/test-yum.sh 115 | environment: 116 | - OS_IDENTIFIER=fedora-42 117 | - R_VERSION=${R_VERSION} 118 | volumes: 119 | - ../:/r-builds 120 | platform: ${PLATFORM_ARCH} 121 | fedora-43: 122 | image: fedora:43 123 | command: /r-builds/test/test-yum.sh 124 | environment: 125 | - OS_IDENTIFIER=fedora-43 126 | - R_VERSION=${R_VERSION} 127 | volumes: 128 | - ../:/r-builds 129 | platform: ${PLATFORM_ARCH} 130 | -------------------------------------------------------------------------------- /test/test.R: -------------------------------------------------------------------------------- 1 | # HTTP mirror to support R 3.1 2 | options(repos = c("https://cloud.r-project.org", "http://cloud.r-project.org")) 3 | 4 | # Create a temp lib to avoid installing into the system library 5 | temp_lib <- tempdir() 6 | .libPaths(temp_lib) 7 | 8 | # Install a package from CRAN 9 | install.packages("pkgconfig") 10 | library(pkgconfig) 11 | 12 | # Install a package with C/C++ and Fortran code, which links against libR, BLAS, LAPACK 13 | curr_dir <- Sys.getenv("DIR", ".") 14 | install.packages(file.path(curr_dir, "testpkg"), repos = NULL, clean = TRUE) 15 | source(file.path(curr_dir, "testpkg/tests/test.R")) 16 | 17 | # Check iconv support 18 | if (!capabilities("iconv") || !all(c("ASCII", "LATIN1", "UTF-8") %in% iconvlist())) { 19 | stop("missing iconv support") 20 | } 21 | 22 | # Check that built-in packages can be loaded 23 | for (pkg in rownames(installed.packages(priority = c("base", "recommended")))) { 24 | if (!require(pkg, character.only = TRUE)) { 25 | stop(sprintf("failed to load built-in package %s", pkg)) 26 | } 27 | } 28 | 29 | # Show capabilities. Warnings are returned on missing libraries. 30 | tryCatch(capabilities(), warning = function(w) { 31 | print(capabilities()) 32 | stop(sprintf("missing libraries: %s", w$message)) 33 | }) 34 | 35 | # Check graphics devices 36 | # https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/Devices.html 37 | devices <- c("png", "jpeg", "tiff", "svg", "bmp", "pdf", "postscript", 38 | if (getRversion() < "4.4.0") c("xfig", "pictex"), 39 | "cairo_pdf", "cairo_ps") 40 | for (dev_name in devices) { 41 | # Skip unsupported graphics devices (e.g. tiff in R >= 3.3 on CentOS 6) 42 | if (dev_name %in% names(capabilities()) && capabilities(dev_name) == FALSE) { 43 | next 44 | } 45 | dev <- getFromNamespace(dev_name, "grDevices") 46 | tryCatch({ 47 | file <- tempfile() 48 | on.exit(unlink(file)) 49 | if (dev_name == "xfig") { 50 | # Suppress warning from xfig when onefile = FALSE (the default) 51 | dev(file, onefile = TRUE) 52 | } else { 53 | dev(file) 54 | } 55 | plot(1) 56 | dev.off() 57 | }, warning = function(w) { 58 | # Catch errors which manifest as warnings (e.g. "failed to load cairo DLL") 59 | stop(sprintf("graphics device %s failed: %s", dev_name, w$message)) 60 | }) 61 | } 62 | 63 | # Check for unexpected output from graphics/text rendering. 64 | # Run externally to capture output from external processes. 65 | # For example, "Pango-WARNING **: failed to choose a font, expect ugly output" 66 | # messages when rendering text without any system fonts installed. 67 | output <- system2(R.home("bin/Rscript"), "-e 'png(tempfile()); plot(1)'", stdout = TRUE, stderr = TRUE) 68 | if (length(output) > 0) { 69 | stop(sprintf("unexpected output returned from plotting:\n%s", paste(output, collapse = "\n"))) 70 | } 71 | 72 | # Check download methods: libcurl (supported in R >= 3.2) and internal (based on libxml) 73 | if ("libcurl" %in% names(capabilities())) { 74 | download.file("https://cloud.r-project.org", tempfile(), "libcurl") 75 | } 76 | tmpfile <- tempfile() 77 | write.csv("test", tmpfile) 78 | download.file(sprintf("file://%s", tmpfile), tempfile(), "internal") 79 | 80 | # Check that a pager is configured and help pages work 81 | # https://stat.ethz.ch/R-manual/R-devel/library/base/html/file.show.html 82 | output <- system2(R.home("bin/Rscript"), "-e 'help(stats)'", stdout = TRUE) 83 | if (length(output) == 0) { 84 | stop("failed to display help pages; check that a pager is configured properly") 85 | } 86 | 87 | # Smoke test BLAS/LAPACK functionality. R may start just fine with an incompatible 88 | # BLAS/LAPACK library, and only fail when calling a BLAS or LAPACK routine. 89 | stopifnot(identical(crossprod(matrix(1)), matrix(1))) 90 | stopifnot(identical(chol(matrix(1)), matrix(1))) 91 | 92 | # Check that R 3.x depends on PCRE1, and R 4.x depends on PCRE2. 93 | # R 3.5 and 3.6 will link against PCRE2 if present, and take on an unnecessary dependency. 94 | # Some distros do always require PCRE2, however, such as Debian 11. 95 | ld_flags <- system2(R.home("bin/R"), c("CMD", "config", "--ldflags"), stdout = TRUE) 96 | has_pcre1 <- grepl("-lpcre\\b", ld_flags) 97 | has_pcre2 <- grepl("-lpcre2-8\\b", ld_flags) 98 | if (getRversion() >= "3.5.0" && getRversion() < "4.0.0") { 99 | stopifnot(has_pcre1) 100 | if (has_pcre2) { 101 | message(sprintf("Info: %s is linked against PCRE2, which may be unnecessary", R.version.string)) 102 | } 103 | } else if (getRversion() >= "4.0.0") { 104 | stopifnot(has_pcre2 && !has_pcre1) 105 | } 106 | 107 | # Check that the custom HTTP user agent was configured 108 | if (!grepl(sprintf("^R/%s", getRversion()), getOption("HTTPUserAgent"))) { 109 | stop("unexpected HTTPUserAgent") 110 | } 111 | -------------------------------------------------------------------------------- /manage_r_versions.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import json 3 | import re 4 | import requests 5 | from bs4 import BeautifulSoup 6 | import boto3 7 | import botocore 8 | 9 | # Minimum R version for "all" specifier 10 | MIN_ALL_VERSION = '3.1.0' 11 | 12 | CRAN_SRC_R3_URL = "https://cran.r-project.org/src/base/R-3/" 13 | CRAN_SRC_R4_URL = "https://cran.r-project.org/src/base/R-4/" 14 | 15 | def _cran_r_versions(url): 16 | """Perform a lookup of CRAN-known R version.""" 17 | r = requests.get(url) 18 | soup = BeautifulSoup(r.text, 'html.parser') 19 | r_versions = [] 20 | for link in soup.find_all('a'): 21 | href = link.get('href') 22 | if href.startswith('R-') and href.endswith('.tar.gz'): 23 | v = href.replace('.tar.gz', '').replace('R-', '') 24 | if '-revised' not in v: # reject 3.2.4-revised 25 | r_versions.append(v) 26 | return r_versions 27 | 28 | def _cran_all_r_versions(): 29 | """Perform a lookup of CRAN-known R versions.""" 30 | r_versions = [] 31 | r_versions.extend(_cran_r_versions(CRAN_SRC_R3_URL)) 32 | r_versions.extend(_cran_r_versions(CRAN_SRC_R4_URL)) 33 | r_versions.append('next') 34 | r_versions.append('devel') 35 | return r_versions 36 | 37 | def _known_r_versions(s3_bucket): 38 | """Fetch the current list of known R versions from the CDN.""" 39 | try: 40 | s3 = boto3.resource('s3') 41 | obj = s3.Object(s3_bucket, 'r/versions.json') 42 | r_versions = json.loads(obj.get()['Body'].read().decode('utf-8')) 43 | return r_versions 44 | except botocore.exceptions.ClientError: 45 | print(f'Error retrieving r/versions.json from S3 bucket {s3_bucket}') 46 | return {"r_versions": []} 47 | 48 | def _expand_version(which, supported_versions): 49 | if which == 'all-patch': 50 | return supported_versions 51 | 52 | last_n_versions = None 53 | if which.startswith('last-'): 54 | last_n_versions = int(which.replace('last-', '')) 55 | elif which != 'all': 56 | return [which] if which in supported_versions else [] 57 | 58 | versions = {} 59 | for ver in supported_versions: 60 | # Skip unreleased versions (e.g., devel, next) 61 | if not re.match(r'[\d.]', ver): 62 | continue 63 | if ver < MIN_ALL_VERSION: 64 | continue 65 | minor_ver = tuple(ver.split('.')[0:2]) 66 | if minor_ver not in versions: 67 | versions[minor_ver] = ver 68 | versions = sorted(list(versions.values()), reverse=True) 69 | 70 | if last_n_versions: 71 | return versions[0:last_n_versions] 72 | 73 | return versions 74 | 75 | def get_versions(which='all'): 76 | """Get R versions, filtering out any invalid versions. 77 | 78 | Args: 79 | which (str): Comma-separated list of R versions to retrieve. 80 | Use "all" to get all known versions, or "last-N" to get the last N minor versions. 81 | Returns: List of valid R versions. 82 | """ 83 | all_versions = sorted(_cran_all_r_versions(), reverse=True) 84 | 85 | versions = [] 86 | for version in which.split(','): 87 | version = version.strip() 88 | versions.extend(_expand_version(version, all_versions)) 89 | return versions 90 | 91 | def check_new_r_versions(s3_bucket): 92 | """Check for new R versions that have not been built.""" 93 | known_versions = _known_r_versions(s3_bucket)["r_versions"] 94 | all_versions = _cran_all_r_versions() 95 | new_versions = [v for v in all_versions if v not in known_versions] 96 | return new_versions 97 | 98 | def publish_new_r_versions(new_versions, s3_bucket, dryrun=True): 99 | """Update versions.json with newly built R versions.""" 100 | s3 = boto3.resource('s3') 101 | versions = _known_r_versions(s3_bucket) 102 | r_versions = versions['r_versions'] 103 | r_versions.extend(new_versions) 104 | # Deduplicate and filter out empty/invalid versions that may end up here by mistake 105 | r_versions = sorted(set(r_versions), reverse=True) 106 | r_versions = list(filter(None, r_versions)) 107 | versions['r_versions'] = r_versions 108 | 109 | print('New versions:', versions) 110 | 111 | if dryrun: 112 | print('Dry run: not updating versions.json') 113 | else: 114 | print('Publishing new versions to S3') 115 | versions_json = json.dumps(versions) 116 | obj = s3.Object(s3_bucket, 'r/versions.json') 117 | obj.put(Body=versions_json, ContentType='application/json') 118 | 119 | def main(): 120 | parser = argparse.ArgumentParser(description="Manage R versions.") 121 | subparsers = parser.add_subparsers(dest="command", required=True) 122 | 123 | # Command to get R versions 124 | get_parser = subparsers.add_parser("get", help="Get R versions as a comma-separated list, filtering out any invalid versions.") 125 | get_parser.add_argument( 126 | 'versions', 127 | type=str, 128 | nargs='?', 129 | # R 3.6 is a special case, as we need longer term (but unstated) support for it. 130 | default='last-5,3.6.3,devel', 131 | help="""Comma-separated list of R versions. Specify "last-N" to use the 132 | last N minor R versions, or "all" to use all minor R versions since R 3.1. 133 | Use "all-patch" to get all known patch R versions. 134 | Defaults to "last-5,3.6.3,devel". 135 | """ 136 | ) 137 | 138 | # Command to check for new R versions 139 | check_parser = subparsers.add_parser("check", help="Check for new R versions.") 140 | check_parser.add_argument("--s3-bucket", required=True, help="S3 bucket name.") 141 | 142 | # Command to publish new R versions to versions.json 143 | publish_parser = subparsers.add_parser("publish", help="Publish new R versions.") 144 | publish_parser.add_argument("--s3-bucket", required=True, help="S3 bucket name.") 145 | publish_parser.add_argument("--dryrun", action="store_true", help="Perform a dry run without updating S3.") 146 | publish_parser.add_argument("--versions", required=True, help="Comma-separated list of R versions to publish.") 147 | 148 | args = parser.parse_args() 149 | 150 | if args.command == "get": 151 | # Re-set to default value if empty string/whitespace explicitly specified (""), which can happen in CI jobs 152 | which_versions = args.versions.strip() 153 | which_versions = which_versions if which_versions else get_parser.get_default('versions') 154 | versions = get_versions(which=which_versions) 155 | print(','.join(versions)) 156 | if args.command == "check": 157 | new_versions = check_new_r_versions(args.s3_bucket) 158 | print(','.join(new_versions)) 159 | elif args.command == "publish": 160 | new_versions = args.versions.split(',') 161 | publish_new_r_versions(new_versions, args.s3_bucket, dryrun=args.dryrun) 162 | 163 | if __name__ == "__main__": 164 | main() 165 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: R builds 2 | 3 | on: 4 | push: 5 | 6 | workflow_dispatch: 7 | inputs: 8 | platforms: 9 | description: | 10 | Comma-separated list of platforms. Specify "all" to use all platforms (the default). 11 | required: false 12 | default: 'all' 13 | type: string 14 | r_versions: 15 | description: | 16 | Comma-separated list of R versions. Specify "last-N" to use the 17 | last N minor R versions, or "all" to use all minor R versions since R 3.1. 18 | Use "all-patch" to use all patch versions since R 3.1. 19 | Defaults to "last-5,3.6.3,devel". 20 | required: false 21 | default: 'last-5,3.6.3,devel' 22 | type: string 23 | arch: 24 | description: | 25 | Comma-separated list of architectures. Specify "amd64", "arm64", or both. 26 | Defaults to "amd64,arm64". 27 | required: false 28 | default: 'amd64,arm64' 29 | type: choice 30 | options: 31 | - 'amd64,arm64' 32 | - 'amd64' 33 | - 'arm64' 34 | publish: 35 | description: | 36 | Publish the builds to S3 staging or production? Defaults to not publishing. 37 | required: false 38 | default: '' 39 | type: choice 40 | options: 41 | - '' 42 | - staging 43 | - production 44 | workflow_call: 45 | inputs: 46 | platforms: 47 | description: | 48 | Comma-separated list of platforms. Specify "all" to use all platforms (the default). 49 | required: false 50 | default: 'all' 51 | type: string 52 | r_versions: 53 | description: | 54 | Comma-separated list of R versions. Specify "last-N" to use the 55 | last N minor R versions, or "all" to use all minor R versions since R 3.1. 56 | Defaults to "last-5,3.6.3,devel". 57 | required: false 58 | default: 'last-5,3.6.3,devel' 59 | type: string 60 | arch: 61 | description: | 62 | Comma-separated list of architectures. Specify "amd64", "arm64", or both. 63 | Defaults to "amd64,arm64". 64 | required: false 65 | default: 'amd64,arm64' 66 | type: string 67 | publish: 68 | description: | 69 | Publish the builds to S3 staging or production? Allowed values are "staging", "production", or empty (default). 70 | required: false 71 | default: '' 72 | type: string 73 | secrets: 74 | AWS_PUBLISH_ROLE: 75 | required: true 76 | AWS_REGION: 77 | required: true 78 | S3_BUCKET_STAGING: 79 | required: true 80 | S3_BUCKET_PRODUCTION: 81 | required: true 82 | 83 | permissions: 84 | id-token: write 85 | contents: read 86 | 87 | jobs: 88 | setup-matrix: 89 | runs-on: ubuntu-latest 90 | outputs: 91 | matrix: ${{ steps.setup-matrix.outputs.matrix }} 92 | platforms: ${{ steps.setup-matrix.outputs.platforms }} 93 | r_versions: ${{ steps.setup-matrix.outputs.r_versions }} 94 | arch: ${{ steps.setup-matrix.outputs.arch }} 95 | steps: 96 | - uses: actions/checkout@v4 97 | 98 | - name: Install Python 99 | uses: actions/setup-python@v5 100 | with: 101 | python-version: '3.x' 102 | cache: 'pip' 103 | 104 | - name: Install dependencies 105 | run: | 106 | pip install -r requirements.txt 107 | 108 | - name: Set up matrix of platforms and R versions 109 | id: setup-matrix 110 | run: | 111 | # Validate the R versions 112 | r_versions=$(python manage_r_versions.py get "${{ inputs.r_versions }}") 113 | 114 | # Filter out unsupported build combinations 115 | build_matrix=$(python get_matrix.py --platforms="${{ inputs.platforms }}" --versions="$r_versions" --arch="${{ inputs.arch }}") 116 | 117 | matrix=$(echo "$build_matrix" | jq -c '.matrix') 118 | platforms=$(echo "$build_matrix" | jq -c '.platforms') 119 | r_versions=$(echo "$build_matrix" | jq -c '.r_versions') 120 | arch=$(echo "$build_matrix" | jq -c '.arch') 121 | 122 | echo "matrix=$matrix" >> $GITHUB_OUTPUT 123 | echo "Using matrix: $matrix" 124 | 125 | echo "platforms=$platforms" >> $GITHUB_OUTPUT 126 | echo "Using platforms: $platforms" 127 | 128 | echo "r_versions=$r_versions" >> $GITHUB_OUTPUT 129 | echo "Using R versions: $r_versions" 130 | 131 | echo "arch=$arch" >> $GITHUB_OUTPUT 132 | echo "Using architectures: $arch" 133 | 134 | docker-images: 135 | needs: setup-matrix 136 | strategy: 137 | matrix: 138 | platform: ${{ fromJson(needs.setup-matrix.outputs.platforms) }} 139 | arch: ${{ fromJson(needs.setup-matrix.outputs.arch) }} 140 | runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm' }} 141 | name: Docker image (${{ matrix.platform }}-${{ matrix.arch }}) 142 | steps: 143 | - uses: actions/checkout@v4 144 | 145 | - name: Set up Docker Buildx 146 | uses: docker/setup-buildx-action@v2 147 | with: 148 | install: true 149 | 150 | # Enable Docker layer caching without having to push to a registry. 151 | # https://docs.docker.com/build/ci/github-actions/examples/#local-cache 152 | # This may eventually be migrated to the GitHub Actions cache backend, 153 | # which is still considered experimental. 154 | # https://github.com/moby/buildkit#github-actions-cache-experimental 155 | - name: Cache Docker layers 156 | uses: actions/cache@v3 157 | with: 158 | path: /tmp/.buildx-cache 159 | key: ${{ matrix.platform }}-${{ matrix.arch }}-buildx-${{ github.sha }} 160 | restore-keys: ${{ matrix.platform }}-${{ matrix.arch }}-buildx- 161 | 162 | # Use docker buildx instead of docker-compose here because cache exporting 163 | # does not seem to work as of docker-compose v2.6.0 and buildx v0.8.2, even 164 | # though it works with buildx individually. 165 | - name: Build image 166 | run: | 167 | docker buildx build -t r-builds:${{ matrix.platform }} \ 168 | --file builder/Dockerfile.${{ matrix.platform }} \ 169 | --cache-from "type=local,src=/tmp/.buildx-cache" \ 170 | --cache-to "type=local,dest=/tmp/.buildx-cache-new,mode=max" \ 171 | builder 172 | 173 | # Temporary workaround for unbounded GHA cache growth with the local cache mode. 174 | # https://github.com/docker/build-push-action/issues/252 175 | # https://github.com/moby/buildkit/issues/1896 176 | - name: Move cache 177 | run: | 178 | rm -rf /tmp/.buildx-cache 179 | mv /tmp/.buildx-cache-new /tmp/.buildx-cache 180 | 181 | build: 182 | needs: [setup-matrix, docker-images] 183 | strategy: 184 | fail-fast: false 185 | matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} 186 | runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm' }} 187 | name: ${{ matrix.platform }}-${{ matrix.arch }} (R ${{ matrix.r_version }}) 188 | steps: 189 | - uses: actions/checkout@v4 190 | 191 | - name: Set up Docker Buildx 192 | uses: docker/setup-buildx-action@v2 193 | with: 194 | install: true 195 | 196 | - name: Restore cached Docker layers 197 | uses: actions/cache@v3 198 | with: 199 | path: /tmp/.buildx-cache 200 | key: ${{ matrix.platform }}-${{ matrix.arch }}-buildx-${{ github.sha }} 201 | restore-keys: ${{ matrix.platform }}-${{ matrix.arch }}-buildx- 202 | 203 | - name: Load cached Docker image 204 | run: | 205 | docker buildx build -t r-builds:${{ matrix.platform }} \ 206 | --file builder/Dockerfile.${{ matrix.platform }} \ 207 | --cache-from "type=local,src=/tmp/.buildx-cache" \ 208 | --load \ 209 | builder 210 | 211 | - name: Build R 212 | run: | 213 | R_VERSION=${{ matrix.r_version }} make build-r-${{ matrix.platform }} 214 | 215 | - name: Test R 216 | run: | 217 | R_VERSION=${{ matrix.r_version }} make test-r-${{ matrix.platform }} 218 | 219 | - name: Configure AWS Credentials 220 | if: ${{ inputs.publish != '' }} 221 | uses: aws-actions/configure-aws-credentials@v4 222 | with: 223 | role-to-assume: ${{ secrets.AWS_PUBLISH_ROLE }} 224 | aws-region: ${{ secrets.AWS_REGION }} 225 | 226 | - name: Publish R 227 | if: ${{ inputs.publish != '' }} 228 | run: | 229 | echo "Publishing R for ${{ inputs.publish }}" 230 | s3_bucket=${{ inputs.publish == 'staging' && secrets.S3_BUCKET_STAGING || secrets.S3_BUCKET_PRODUCTION }} 231 | S3_BUCKET=$s3_bucket make publish-r-${{ matrix.platform }} 232 | 233 | update-versions-json: 234 | if: ${{ inputs.publish != '' }} 235 | needs: [build, setup-matrix] 236 | runs-on: ubuntu-latest 237 | steps: 238 | - uses: actions/checkout@v4 239 | 240 | - name: Install Python 241 | uses: actions/setup-python@v5 242 | with: 243 | python-version: '3.x' 244 | cache: 'pip' 245 | 246 | - name: Install dependencies 247 | run: | 248 | pip install -r requirements.txt 249 | 250 | - name: Configure AWS Credentials 251 | uses: aws-actions/configure-aws-credentials@v4 252 | with: 253 | role-to-assume: ${{ secrets.AWS_PUBLISH_ROLE }} 254 | aws-region: ${{ secrets.AWS_REGION }} 255 | 256 | - name: Update versions.json 257 | run: | 258 | echo "Publishing versions.json for ${{ inputs.publish }}" 259 | s3_bucket=${{ inputs.publish == 'staging' && secrets.S3_BUCKET_STAGING || secrets.S3_BUCKET_PRODUCTION }} 260 | versions=$(echo '${{ needs.setup-matrix.outputs.r_versions }}' | jq -r 'join(",")') 261 | python manage_r_versions.py publish --s3-bucket="$s3_bucket" --versions="$versions" 262 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # r-builds 2 | 3 | This repository orchestrates tools to produce R binaries. The binaries are available as a 4 | community resource, **they are not professionally supported by Posit**. 5 | The R language is open source, please see the official documentation at https://www.r-project.org/. 6 | 7 | These binaries are not a replacement to existing binary distributions for R. 8 | The binaries were built with the following considerations: 9 | - They use a minimal set of [build and runtime dependencies](builder). 10 | - They are designed to be used side-by-side, e.g., on [Posit Workbench](https://docs.posit.co/ide/server-pro/r/using_multiple_versions_of_r.html). 11 | - They give users a consistent option for accessing R across different Linux distributions. 12 | 13 | These binaries have been extensively tested, and are used in production everyday 14 | on [Posit Cloud](https://posit.cloud) and 15 | [shinyapps.io](https://shinyapps.io). Please open an issue to report a specific 16 | bug, or ask questions on [Posit Community](https://forum.posit.co/). 17 | 18 | ## Supported Platforms 19 | 20 | R binaries are built for the following Linux operating systems: 21 | 22 | - Ubuntu 20.04, 22.04, 24.04 23 | - Debian 12, 13 24 | - CentOS 7 25 | - Red Hat Enterprise Linux 7, 8, 9, 10 26 | - openSUSE 15.6, 16.0 27 | - SUSE Linux Enterprise 15 SP6 28 | - Fedora 41, 42, 43 29 | 30 | Operating systems are supported until their vendor end-of-support dates, which 31 | can be found on the [Posit Platform Support](https://posit.co/about/platform-support/) 32 | page. When an operating system has reached its end of support, builds for it 33 | will be discontinued, but existing binaries will continue to be available. 34 | 35 | ## Supported R Versions 36 | 37 | R binaries are primarily supported for the current R version and previous four minor versions of R. 38 | Older R versions down to R 3.0.0 are also built when possible, but support for older R versions is best effort and not guaranteed. 39 | 40 | R versions 4.0.0 through 4.3.3 have been patched for [CVE-2024-27322](https://nvd.nist.gov/vuln/detail/cve-2024-27322). See [#218](https://github.com/rstudio/r-builds/issues/218) for more details. 41 | 42 | ## Supported Architectures 43 | 44 | R binaries are built for x86_64/amd64 and aarch64/arm64. 45 | 46 | ## Quick Installation 47 | 48 | To use our quick install script to install R, simply run the following 49 | command. To use the quick installer, you must have root or sudo privileges, 50 | and `curl` must be installed. 51 | 52 | ```sh 53 | bash -c "$(curl -L https://rstd.io/r-install)" 54 | ``` 55 | 56 | ## Manual Installation 57 | 58 | ### Specify R version 59 | 60 | Define the version of R that you want to install. Available versions 61 | of R can be found here: https://cdn.posit.co/r/versions.json 62 | ```bash 63 | R_VERSION=4.4.3 64 | ``` 65 | 66 | ### Download and install R 67 | #### Ubuntu/Debian Linux 68 | 69 | Download the deb package: 70 | ```bash 71 | # Ubuntu 20.04 72 | curl -O https://cdn.posit.co/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb 73 | 74 | # Ubuntu 22.04 75 | curl -O https://cdn.posit.co/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb 76 | 77 | # Ubuntu 24.04 78 | curl -O https://cdn.posit.co/r/ubuntu-2404/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb 79 | 80 | # Debian 12 81 | curl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb 82 | 83 | # Debian 13 84 | curl -O https://cdn.posit.co/r/debian-13/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb 85 | ``` 86 | 87 | Then install the package: 88 | ```bash 89 | sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).deb 90 | ``` 91 | 92 | #### RHEL/CentOS Linux 93 | 94 | Enable the [Extra Packages for Enterprise Linux](https://fedoraproject.org/wiki/EPEL) 95 | repository (RHEL/CentOS 7 and RHEL 9 only): 96 | 97 | ```bash 98 | # CentOS / RHEL 7 99 | sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 100 | 101 | # Rocky Linux 9 / AlmaLinux 9 102 | sudo dnf install dnf-plugins-core 103 | sudo dnf config-manager --set-enabled crb 104 | sudo dnf install epel-release 105 | 106 | # RHEL 9 107 | sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm 108 | ``` 109 | 110 | > On RHEL 7, you may also need to enable the Optional repository: 111 | > ```bash 112 | > sudo subscription-manager repos --enable "rhel-*-optional-rpms" 113 | > 114 | > # If running RHEL 7 in a public cloud, such as Amazon EC2, enable the 115 | > # Optional repository from Red Hat Update Infrastructure (RHUI) instead 116 | > sudo yum install yum-utils 117 | > sudo yum-config-manager --enable "rhel-*-optional-rpms" 118 | > ``` 119 | 120 | > On RHEL 9, you may also need to enable the CodeReady Linux Builder repository: 121 | > ```bash 122 | > sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms 123 | > 124 | > # If running RHEL 9 in a public cloud, such as Amazon EC2, enable the CodeReady 125 | > # Linux Builder repository from Red Hat Update Infrastructure (RHUI) instead 126 | > sudo dnf install dnf-plugins-core 127 | > sudo dnf config-manager --enable codeready-builder-for-rhel-9-*-rpms 128 | > ``` 129 | 130 | Download the rpm package: 131 | ```bash 132 | # CentOS / RHEL 7 133 | curl -O https://cdn.posit.co/r/centos-7/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 134 | 135 | # RHEL 8 / Rocky Linux 8 / AlmaLinux 8 136 | curl -O https://cdn.posit.co/r/centos-8/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 137 | 138 | # RHEL 9 / Rocky Linux 9 / AlmaLinux 9 139 | curl -O https://cdn.posit.co/r/rhel-9/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 140 | 141 | # RHEL 10 / Rocky Linux 10 / AlmaLinux 10 142 | curl -O https://cdn.posit.co/r/rhel-10/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 143 | ``` 144 | 145 | Then install the package: 146 | ```bash 147 | sudo yum install R-${R_VERSION}-1-1.$(arch).rpm 148 | ``` 149 | 150 | #### SUSE Linux 151 | 152 | Download the rpm package: 153 | ```bash 154 | # openSUSE 15.6 / SLES 15 SP6 155 | curl -O https://cdn.posit.co/r/opensuse-156/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 156 | 157 | # openSUSE 16.0 158 | curl -O https://cdn.posit.co/r/opensuse-160/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 159 | ``` 160 | 161 | Then install the package: 162 | ```bash 163 | sudo zypper --no-gpg-checks install R-${R_VERSION}-1-1.$(arch).rpm 164 | ``` 165 | 166 | #### Fedora Linux 167 | 168 | Download the rpm package: 169 | ```bash 170 | # Fedora 41 171 | curl -O https://cdn.posit.co/r/fedora-41/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 172 | 173 | # Fedora 42 174 | curl -O https://cdn.posit.co/r/fedora-42/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 175 | 176 | # Fedora 43 177 | curl -O https://cdn.posit.co/r/fedora-43/pkgs/R-${R_VERSION}-1-1.$(arch).rpm 178 | ``` 179 | 180 | Then install the package: 181 | ```bash 182 | sudo dnf install R-${R_VERSION}-1-1.$(arch).rpm 183 | ``` 184 | 185 | 186 | 187 | ### Verify R installation 188 | 189 | Test that R was successfully installed by running: 190 | ```bash 191 | /opt/R/${R_VERSION}/bin/R --version 192 | ``` 193 | 194 | ### Add R to the system path 195 | 196 | To ensure that R is available on the system path, create symbolic links to 197 | the version of R that you installed: 198 | 199 | ```bash 200 | sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R 201 | sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript 202 | ``` 203 | 204 | ### Optional post-installation steps 205 | 206 | You may want to install additional system dependencies for R packages. 207 | We recommend installing a TeX distribution (such as [TinyTeX](https://yihui.name/tinytex/) 208 | or TeX Live) and Pandoc. For more information on system dependencies, see 209 | [system requirements for R packages](https://github.com/rstudio/r-system-requirements). 210 | 211 | If you want to install multiple versions of R on the same system, you can 212 | repeat these steps to install a different version of R alongside existing versions. 213 | 214 | --- 215 | 216 | # Developer Documentation 217 | 218 | This repository orchestrates builds using a variety of tools. The 219 | instructions below outline the components in the stack and describe how to add a 220 | new platform or inspect an existing platform. 221 | 222 | ## Building from source 223 | 224 | To build the R binaries from source, you will need to have [Git](https://git-scm.com/), 225 | [Docker](https://docs.docker.com/get-docker/), and `make` installed. 226 | 227 | First, clone the Git repository locally and navigate to it. 228 | 229 | ```bash 230 | git clone https://github.com/rstudio/R-builds 231 | cd R-builds 232 | ``` 233 | 234 | Then, run the `build-r-$PLATFORM` Make target with the `R_VERSION` environment variable 235 | set to your desired R version, where `$PLATFORM` is one of the supported platform 236 | identifiers, such as `ubuntu-2204` or `rhel-9`. 237 | 238 | ```bash 239 | export PLATFORM=ubuntu-2204 240 | export R_VERSION=4.5.0 241 | 242 | make build-r-$PLATFORM 243 | ``` 244 | 245 | The built DEB or RPM package will be available in the `builder/integration/tmp/$PLATFORM` 246 | directory. 247 | 248 | ```bash 249 | $ ls builder/integration/tmp/$PLATFORM 250 | r-4.5.0_1_amd64.deb 251 | ``` 252 | 253 | ### Custom installation path 254 | 255 | R is installed to `/opt/R/${R_VERSION}` by default. If you want to customize the 256 | installation path, set the optional `R_INSTALL_PATH` environment variable to a 257 | custom location such as `/opt/custom/R-4.5.0`. 258 | 259 | ```bash 260 | export PLATFORM=rhel-9 261 | export R_VERSION=4.5.0 262 | export R_INSTALL_PATH=/opt/custom/R-4.5.0 263 | 264 | make build-r-$PLATFORM 265 | ``` 266 | 267 | ## Submitting pull requests 268 | 269 | For significant changes to the R builds, such as adding a new platform or updating existing builds, 270 | include any relevant testing notes and changes that may affect existing users, such as system dependency changes. 271 | 272 | On successful merge, a project maintainer can then trigger the builds in staging to test the changes, and then in production 273 | when the changes have been verified. 274 | 275 | ## Adding a new platform. 276 | 277 | ### R configuration 278 | 279 | - Builds should use OpenBLAS and align their BLAS/LAPACK configuration with the default distribution of R when possible, 280 | for maximum compatibility of binary R packages across R distributions. For example, Ubuntu/Debian should be configured 281 | to use external BLAS, RHEL 9+ should use FlexiBLAS (to match EPEL), and SUSE should use shared BLAS. The BLAS/LAPACK 282 | library should be swappable at runtime when possible. 283 | - DEB/RPM packages should include the minimum set of dependencies when possible. Different R versions may have different 284 | dependencies, so packaging scripts may conditionally add dependencies based on the R version. 285 | 286 | ### README 287 | 288 | 1. Add the new platform to the `Supported Platforms` list. 289 | 2. Add DEB or RPM package download instructions for the new platform. 290 | 291 | ### Dockerfile 292 | 293 | Create a `builder/Dockerfile.platform-version` (where `platform-version` is `ubuntu-2204` or `centos-7`, etc.) This file must contain four major tasks: 294 | 295 | 1. an `OS_IDENTIFIER` env with the `platform-version`. 296 | 2. a step which ensures the R source build dependencies are installed 297 | 3. `COPY` for the packaging script (`builder/package.platform-version`) to `/package.sh` 298 | 4. `COPY` and `ENTRYPOINT` for the `build.sh` file in `builder/`. 299 | 300 | ### Packaging script 301 | 302 | Create a `builder/package.platform-version` script (where `platform-version` is `ubuntu-2204` or `centos-7`, etc.). 303 | 304 | ### docker-compose.yml 305 | 306 | A new service in the docker-compose file named according to the `platform-version` and containing the proper entries: 307 | 308 | ```yaml 309 | ubuntu-2404: 310 | command: ./build.sh 311 | environment: 312 | - R_VERSION=${R_VERSION} # for testing out R builds locally 313 | - R_INSTALL_PATH=${R_INSTALL_PATH} # custom installation path 314 | - LOCAL_STORE=/tmp/output # ensures that output tarballs are persisted locally 315 | build: 316 | context: . 317 | dockerfile: Dockerfile.ubuntu-2404 318 | image: r-builds:ubuntu-2404 319 | volumes: 320 | - ./integration/tmp:/tmp/output # path to output tarballs 321 | platform: ${PLATFORM_ARCH} # for testing other architectures via emulation 322 | ``` 323 | 324 | ### Makefile 325 | 326 | Add the new platform to the `PLATFORMS` variable near the top of the Makefile. 327 | 328 | ### test/docker-compose.yml 329 | 330 | A new service in the `test/docker-compose.yml` file named according to the `platform-version` and containing the proper entries: 331 | 332 | ```yaml 333 | ubuntu-2204: 334 | image: ubuntu:jammy 335 | command: /r-builds/test/test-apt.sh 336 | environment: 337 | - OS_IDENTIFIER=ubuntu-2204 338 | - R_VERSION=${R_VERSION} 339 | volumes: 340 | - ../:/r-builds 341 | platform: ${PLATFORM_ARCH} 342 | ``` 343 | 344 | ### Quick install script 345 | 346 | Update the quick install script at [`install.sh`](install.sh), if necessary, to support the new platform. 347 | 348 | Once you've followed the steps above, submit a pull request. 349 | 350 | ## R builds tarballs 351 | 352 | In addition to the DEB and RPM packages, R builds also publishes tarballs of the binaries at: 353 | 354 | - x86_64: `https://cdn.posit.co/r/${OS_IDENTIFIER}/R-${R_VERSION}-${OS_IDENTIFIER}.tar.gz` 355 | - arm64: `https://cdn.posit.co/r/${OS_IDENTIFIER}/R-${R_VERSION}-${OS_IDENTIFIER}-arm64.tar.gz` 356 | 357 | These may be used with a manual installation of R's system dependencies. System dependencies will differ between R versions, 358 | so inspect the corresponding DEB or RPM package for the list of system dependencies. 359 | 360 | ## "Break Glass" and scheduled builds 361 | 362 | The [Check for new R versions](https://github.com/rstudio/r-builds/actions/workflows/check-r-versions.yml) workflow 363 | checks for new R versions hourly and automatically builds and publishes them. 364 | 365 | The [Daily R-devel and R-next builds](https://github.com/rstudio/r-builds/actions/workflows/devel-daily.yml) workflow 366 | builds and publishes R-devel and R-next each day. 367 | 368 | The [R builds](https://github.com/rstudio/r-builds/actions/workflows/build.yml) workflow 369 | tests building the R binaries and optionally publishes them. Builds are not automatically published upon merging to `main`. 370 | 371 | After making any changes to R-builds, this workflow may be run manually to test the changes in `staging` first. Then, 372 | the workflow can be rerun for `production` to build new binaries or rebuild existing binaries. 373 | 374 | ## Testing 375 | 376 | Tests are automatically run on each push. 377 | These tests validate that R was correctly configured, built, and packaged. By default, the tests run 378 | for the last 5 minor R versions on each platform. 379 | 380 | To run the tests manually, you can navigate to the [GitHub Actions workflow page](https://github.com/rstudio/r-builds/actions/workflows/test.yml) 381 | and use "Run workflow" to run the tests from a custom branch, list of platforms, and list of R versions. 382 | 383 | To skip the tests, add `[skip ci]` to your commit message. See [Skipping workflow runs](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs) 384 | for more information. 385 | 386 | To test the R builds locally, you can use the `build-r-$PLATFORM` and `test-r-$PLATFORM` 387 | targets to build R and run the tests. The tests use the quick install script to install R, 388 | using a locally built R if present, or otherwise a build from the CDN. 389 | 390 | ```bash 391 | # Build R 4.5.0 for Ubuntu 22 392 | R_VERSION=4.5.0 make build-r-ubuntu-2204 393 | 394 | # Test R 4.5.0 for Ubuntu 22 395 | R_VERSION=4.5.0 make test-r-ubuntu-2204 396 | ``` 397 | 398 | Alternatively, you can build an image using the `docker-build-$PLATFORM` 399 | target, launch a bash session within a container using the `bash-$PLATFORM` target, 400 | and interactively run the build script: 401 | 402 | ```bash 403 | # Build the image for Ubuntu 22 404 | make docker-build-ubuntu-2204 405 | 406 | # Launch a bash session for Ubuntu 22 407 | make bash-ubuntu-2204 408 | 409 | # Build R 4.5.0 410 | R_VERSION=4.5.0 ./build.sh 411 | 412 | # Build R devel with parallel execution to speed up the build 413 | MAKEFLAGS=-j4 R_VERSION=devel ./build.sh 414 | 415 | # Build a prerelease version of R (e.g., alpha or beta) 416 | R_VERSION=rc R_TARBALL_URL=https://cran.r-project.org/src/base-prerelease/R-latest.tar.gz ./build.sh 417 | ``` 418 | 419 | Builds default to the current host architecture by default. If you would like to test a different 420 | architecture via emulation in Docker, set `PLATFORM_ARCH` to a valid Docker `--platform` flag: 421 | 422 | ```bash 423 | # Build R 4.5.0 for Ubuntu 22, ARM64 424 | R_VERSION=4.5.0 PLATFORM_ARCH=linux/arm64 make build-r-ubuntu-2204 425 | 426 | # Test R 4.5.0 for Ubuntu 22, ARM64 427 | R_VERSION=4.5.0 PLATFORM_ARCH=linux/arm64 make test-r-ubuntu-2204 428 | ``` 429 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | THIS_VERSION="1.1.0" 3 | 4 | # Call with: 5 | # bash -c "$(curl -L https://rstd.io/r-install)" 6 | 7 | SCRIPT_ACTION=$1 8 | SCRIPT_ACTION=${SCRIPT_ACTION:-install} 9 | 10 | # Set to the full version to install. Must be either available on S3 or in the working directory 11 | R_VERSION=${R_VERSION:-} 12 | # The version may optionally be provided as a second argument 13 | if [[ "$2" != "" ]]; then 14 | R_VERSION=$2 15 | fi 16 | 17 | # Run unattended; show no questions, assume default answers. 18 | # May also be set by the '-y'/'yes' options on the install action. 19 | RUN_UNATTENDED=${RUN_UNATTENDED:-0} 20 | if [[ "$3" == "-y" || "$3" == "yes" ]]; then 21 | RUN_UNATTENDED=1 22 | fi 23 | 24 | SUDO= 25 | if [[ $(id -u) != "0" ]]; then 26 | SUDO=sudo 27 | fi 28 | 29 | # The root of the S3 URL for downloads 30 | CDN_URL='https://cdn.posit.co/r' 31 | 32 | # The URL for listing available R versions 33 | VERSIONS_URL="${CDN_URL}/versions.json" 34 | 35 | R_VERSIONS=$(curl -s ${VERSIONS_URL} | 36 | # Matches the JSON line that contains the r versions 37 | grep r_versions | 38 | # Gets the value of the `r_version` property (e.g., "[ 3.0.0, 3.0.3, ... ]") 39 | cut -f2 -d ":" | 40 | # Removes the opening and closing brackets of the array 41 | cut -f2 -d "[" | cut -f1 -d "]" | 42 | # Removes the quotes and commas from the values 43 | sed -e 's/\"//g' | sed -e 's/\,//g' | 44 | # Convert to newlines and sort in descending order, with devel/next at the bottom 45 | tr ' ' '\n' | sort --numeric-sort --reverse) 46 | 47 | # Returns the OS 48 | detect_os () { 49 | OS='cat /etc/*-release' 50 | distro=$($OS | grep DISTRIB_ID | cut -f2 -d "=") 51 | if test -f /etc/SuSE-release 52 | then 53 | distro="LEAP12" 54 | fi 55 | if [[ -f /etc/centos-release || -f /etc/redhat-release || -f /etc/fedora-release ]] 56 | then 57 | if [[ -f /etc/fedora-release ]] 58 | then 59 | distro="Fedora" 60 | else 61 | distro="RedHat" 62 | fi 63 | fi 64 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:suse:sles:12 ]] 65 | then 66 | distro="SLES12" 67 | fi 68 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:opensuse:leap:42 ]] 69 | then 70 | distro="LEAP12" 71 | fi 72 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:opensuse:leap:1 ]] 73 | then 74 | distro="SLES1X" 75 | fi 76 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:suse:sles:1 ]] 77 | then 78 | distro="LEAP1X" 79 | fi 80 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:2.3:o:amazon:amazon_linux:2 ]] 81 | then 82 | distro="Amazon" 83 | fi 84 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:almalinux:almalinux: ]] 85 | then 86 | distro="Alma" 87 | fi 88 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:rocky:rocky: ]] 89 | then 90 | distro="Rocky" 91 | fi 92 | if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:oracle:linux: ]] 93 | then 94 | distro="Oracle" 95 | fi 96 | if [[ $(cat /etc/os-release | grep -e "^ID\=*" | cut -f 2 -d '=') == "debian" ]]; then 97 | distro="Debian" 98 | fi 99 | 100 | echo "${distro}" 101 | } 102 | 103 | # Returns the OS version 104 | detect_os_version () { 105 | os=$1 106 | if [[ "${os}" =~ ^(RedHat|Alma|Rocky|Fedora|Oracle)$ ]]; then 107 | # Get the major version. /etc/redhat-release is used if /etc/os-release isn't available, 108 | # e.g., on CentOS/RHEL 6. 109 | if [[ -f /etc/os-release ]]; then 110 | cat /etc/os-release | grep VERSION_ID= | sed -E 's/VERSION_ID="?([0-9.]*)"?/\1/' | cut -d '.' -f 1 111 | elif [[ -f /etc/redhat-release ]]; then 112 | cat /etc/redhat-release | sed -E 's/[^0-9]+([0-9.]+)[^0-9]*/\1/' | cut -d '.' -f 1 113 | fi 114 | fi 115 | if [[ "${os}" == "Ubuntu" ]] || [[ "${os}" == "Debian" ]]; then 116 | cat /etc/os-release | grep -e "^VERSION_ID\=*" | cut -f 2 -d '=' | sed -e 's/[".]//g' 117 | fi 118 | if [[ "${os}" == "SLES1X" ]] || [[ "${os}" == "LEAP1X" ]]; then 119 | cat /etc/os-release | grep -e "^VERSION_ID\=*" | cut -f 2 -d '=' | sed -e 's/[".]//g' 120 | fi 121 | # reuse rhel7 binaries for amazon 122 | if [[ "${os}" == "Amazon" ]]; then 123 | echo "7" 124 | fi 125 | } 126 | 127 | # Returns the installer type 128 | detect_installer_type () { 129 | os=$1 130 | case $os in 131 | "RedHat" | "Fedora" | "CentOS" | "LEAP12" | "LEAP1X" | "SLES12" | "SLES1X" | "Amazon" | "Alma" | "Rocky" | "Oracle") 132 | echo "rpm" 133 | ;; 134 | "Ubuntu" | "Debian") 135 | echo "deb" 136 | ;; 137 | esac 138 | } 139 | 140 | # Lists available R versions 141 | show_versions () { 142 | for v in ${R_VERSIONS} 143 | do 144 | echo " ${v}" 145 | done 146 | } 147 | 148 | # Same as above but for automation purposes 149 | do_show_versions () { 150 | for v in ${R_VERSIONS} 151 | do 152 | echo "${v}" 153 | done 154 | } 155 | 156 | # Returns the installer name for a given version, OS, arch 157 | download_name () { 158 | os=$1 159 | version=$2 160 | arch=$3 161 | case $arch in 162 | "x86_64" | "amd64") 163 | rpm_arch="x86_64" 164 | deb_arch="amd64" 165 | ;; 166 | "aarch64") 167 | rpm_arch="aarch64" 168 | deb_arch="arm64" 169 | ;; 170 | esac 171 | case $os in 172 | "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle") 173 | echo "R-${version}-1-1.${rpm_arch}.rpm" 174 | ;; 175 | "Ubuntu" | "Debian") 176 | echo "r-${version}_1_${deb_arch}.deb" 177 | ;; 178 | "LEAP12" | "LEAP1X" | "SLES12" | "SLES1X") 179 | echo "R-${version}-1-1.${rpm_arch}.rpm" 180 | ;; 181 | esac 182 | } 183 | 184 | # Returns a download URL for a given version and OS 185 | download_url () { 186 | os=$1 187 | name=$2 188 | ver=$3 189 | 190 | # If the current directory already contains the download, then 191 | # there's no need to download it 192 | if [ -f ${name} ]; then 193 | echo "" 194 | else 195 | 196 | case $os in 197 | "Fedora") 198 | echo "${CDN_URL}/fedora-${ver}/pkgs/${name}" 199 | ;; 200 | "RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle") 201 | if [ "${ver}" -ge 9 ]; then 202 | echo "${CDN_URL}/rhel-${ver}/pkgs/${name}" 203 | else 204 | echo "${CDN_URL}/centos-${ver}/pkgs/${name}" 205 | fi 206 | ;; 207 | "Ubuntu") 208 | echo "${CDN_URL}/ubuntu-${ver}/pkgs/${name}" 209 | ;; 210 | "Debian") 211 | echo "${CDN_URL}/debian-${ver:-9}/pkgs/${name}" 212 | ;; 213 | "LEAP12" | "SLES12") 214 | echo "${CDN_URL}/opensuse-42/pkgs/${name}" 215 | ;; 216 | "LEAP1X" | "SLES1X") 217 | if [ "${ver}" -ge 160 ]; then 218 | echo "${CDN_URL}/opensuse-160/pkgs/${name}" 219 | elif [ "${ver}" -ge 156 ]; then 220 | echo "${CDN_URL}/opensuse-156/pkgs/${name}" 221 | elif [ "${ver}" -ge 155 ]; then 222 | echo "${CDN_URL}/opensuse-155/pkgs/${name}" 223 | elif [ "${ver}" -eq 154 ]; then 224 | echo "${CDN_URL}/opensuse-154/pkgs/${name}" 225 | elif [ "${ver}" -eq 153 ]; then 226 | echo "${CDN_URL}/opensuse-153/pkgs/${name}" 227 | elif [ "${ver}" -eq 152 ]; then 228 | echo "${CDN_URL}/opensuse-152/pkgs/${name}" 229 | else 230 | echo "${CDN_URL}/opensuse-15/pkgs/${name}" 231 | fi 232 | ;; 233 | esac 234 | fi 235 | } 236 | 237 | # Given a version or "latest", returns a version to download. If no 238 | # valid input version is given, returns blank (""). 239 | get_version () { 240 | versions=(${R_VERSIONS}) 241 | version_input=$1 242 | if [ "${version_input}" = "latest" ]; then 243 | version_input=${versions[0]} 244 | fi 245 | # Convert short version to real version 246 | echo $(valid_version $version_input) 247 | } 248 | 249 | # Checks to see if a version is valid 250 | valid_version () { 251 | ver=$1 252 | result= 253 | for v in ${R_VERSIONS} 254 | do 255 | if [[ "${v}" = "${ver}" ]]; then 256 | result=${v} 257 | fi 258 | done 259 | echo ${result} 260 | } 261 | 262 | # Prompts for the version until a valid version is entered. 263 | SELECTED_VERSION=${R_VERSION} 264 | prompt_version () { 265 | while [ "$SELECTED_VERSION" = "" ]; do 266 | echo "Available Versions" 267 | show_versions 268 | echo "Enter version to install: ( for latest)" 269 | read version_input 270 | if [ "$version_input" = "" ]; then 271 | version_input="latest" 272 | fi 273 | SELECTED_VERSION=$(get_version "${version_input}") 274 | done 275 | } 276 | 277 | # Installs R 278 | install () { 279 | installer_type=$1 280 | installer_name=$2 281 | os=$3 282 | ver=$4 283 | if [ "$installer_type" = "deb" ]; then 284 | install_deb ${installer_name} 285 | else 286 | install_rpm ${installer_name} ${os} ${ver} 287 | fi 288 | } 289 | 290 | # Installs R for Ubuntu/Debian 291 | install_deb () { 292 | installer_name=$1 293 | echo "Install from DEB installer ${installer_name}..." 294 | 295 | if ! has_sudo "apt-get"; then 296 | echo "Must have sudo privileges to run apt-get" 297 | exit 1 298 | fi 299 | yes= 300 | yesapt= 301 | if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then 302 | yes="--n" 303 | yesapt="-y" 304 | export DEBIAN_FRONTEND=noninteractive 305 | fi 306 | echo "Updating package indexes..." 307 | ${SUDO} apt-get update 308 | echo "Installing ${installer_name}..." 309 | ${SUDO} apt-get install ${yesapt} ./"${installer_name}" 310 | } 311 | 312 | # Installs R for RHEL/CentOS and SUSE 313 | install_rpm () { 314 | installer_name=$1 315 | os=$2 316 | ver=$3 317 | echo "User install from RPM installer ${installer_name}..." 318 | install_pre "${os}" "${ver}" 319 | yes= 320 | if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then 321 | yes="-y" 322 | fi 323 | case $os in 324 | "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle") 325 | if ! has_sudo "yum"; then 326 | echo "Must have sudo privileges to run yum" 327 | exit 1 328 | fi 329 | echo "Updating package indexes..." 330 | ${SUDO} yum check-update -y 331 | echo "Installing ${installer_name}..." 332 | ${SUDO} yum install ${yes} "${installer_name}" 333 | ;; 334 | "LEAP12" | "LEAP1X" | "SLES12" | "SLES1X") 335 | if ! has_sudo "zypper"; then 336 | echo "Must have sudo privileges to run zypper" 337 | exit 1 338 | fi 339 | echo "Updating package indexes..." 340 | ${SUDO} zypper refresh 341 | echo "Installing ${installer_name}..." 342 | ${SUDO} zypper --no-gpg-checks install ${yes} "${installer_name}" 343 | ;; 344 | esac 345 | } 346 | 347 | # Installs prerequisites for RHEL/CentOS and SUSE 348 | install_pre () { 349 | os=$1 350 | ver=$2 351 | 352 | case $os in 353 | "Fedora") 354 | ;; 355 | "RedHat" | "CentOS" | "Alma" | "Rocky" | "Oracle") 356 | install_epel "${os}" "${ver}" 357 | ;; 358 | "Amazon") 359 | install_epel_amzn 360 | ;; 361 | "SLES12") 362 | install_python_backports 363 | ;; 364 | "LEAP12" | "LEAP1X" | "SLES1X") 365 | ;; 366 | esac 367 | } 368 | 369 | # Installs EPEL for Amazon Linux 2 370 | install_epel_amzn () { 371 | yes= 372 | if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then 373 | yes="-y" 374 | fi 375 | ${SUDO} amazon-linux-extras install epel ${yes} 376 | } 377 | 378 | # Installs EPEL for RHEL/CentOS/Alma/Rocky 379 | install_epel () { 380 | os=$1 381 | ver=$2 382 | yes= 383 | if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then 384 | yes="-y" 385 | fi 386 | case $ver in 387 | "6") 388 | ${SUDO} yum install ${yes} https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm 389 | ;; 390 | "7") 391 | ${SUDO} yum install ${yes} https://dl.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm 392 | ;; 393 | "8") 394 | ;; 395 | "9") 396 | if [[ "${os}" == "RedHat" ]]; then 397 | ${SUDO} subscription-manager repos --enable "codeready-builder-for-rhel-9-$(arch)-rpms" 398 | ${SUDO} dnf install ${yes} https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm 399 | elif [[ "${os}" == "Oracle" ]]; then 400 | ${SUDO} dnf config-manager --set-enabled ol9_codeready_builder 401 | else 402 | ${SUDO} dnf install ${yes} dnf-plugins-core 403 | ${SUDO} dnf config-manager --set-enabled crb 404 | ${SUDO} dnf install ${yes} epel-release 405 | fi 406 | ;; 407 | "10") 408 | ;; 409 | esac 410 | } 411 | 412 | # Installs the Python backports repository for SLES 12 413 | install_python_backports () { 414 | SLE_VERSION="SLE_$(grep "^VERSION=" /etc/os-release | sed -e 's/VERSION=//' -e 's/"//g' -e 's/-/_/')" 415 | ${SUDO} zypper --gpg-auto-import-keys addrepo https://download.opensuse.org/repositories/devel:/languages:/python:/backports/$SLE_VERSION/devel:languages:python:backports.repo 416 | } 417 | 418 | do_download () { 419 | url=$1 420 | file_name=$(basename "${url}") 421 | 422 | wget_rc=$(check_command "wget") 423 | curl_rc=$(check_command "curl") 424 | rc=0 425 | 426 | if [ "${url}" = "" ]; then 427 | echo "Installer already exists. Not downloading." 428 | else 429 | echo "Downloading installer from ${url}..." 430 | 431 | if [[ -z "${wget_rc}" ]]; then 432 | echo "Downloading ${url}..." 433 | 434 | if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then 435 | wget -q --header "User-Agent: ${RS_USER_AGENT:-r-builds}" "${url}" 436 | else 437 | wget --progress=bar --header "User-Agent: ${RS_USER_AGENT:-r-builds}" "${url}" 438 | fi 439 | rc=$? 440 | # Or, If curl is around, use that. 441 | elif [[ -z "${curl_rc}" ]]; then 442 | echo "Downloading ${url}..." 443 | if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then 444 | curl -fsSL -H "User-Agent: ${RS_USER_AGENT:-r-builds}" --output "${file_name}" "${url}" 445 | else 446 | curl -fL -H "User-Agent: ${RS_USER_AGENT:-r-builds}" --output "${file_name}" --progress-bar "${url}" 447 | fi 448 | rc=$? 449 | # Otherwise, we can't go on. 450 | else 451 | echo 452 | echo "You need either wget or curl to be able to download an installation bundle." 453 | echo "Either install one of those two tools or download the installation bundle" 454 | echo "manually." 455 | return 7 456 | fi 457 | 458 | if [[ "${rc}" -ne "0" ]]; then 459 | echo 460 | echo "We were unable to download the installation bundle." 461 | exit ${rc} 462 | fi 463 | fi 464 | } 465 | 466 | # This helps determine whether a given command exists or not. 467 | check_command () { 468 | cmd=$1 469 | type "${cmd}" > /dev/null 2> /dev/null 470 | rc=$? 471 | 472 | if [[ "${rc}" = "0" ]]; then 473 | echo "" 474 | else 475 | echo "${rc}" 476 | fi 477 | } 478 | 479 | has_sudo () { 480 | if [[ "${SUDO}" == "" ]]; then 481 | test "0" == "0" 482 | else 483 | cmd=$1 484 | output=$(sudo -n -l "${cmd}") 485 | rc=$? 486 | 487 | test "0" == "${rc}" 488 | fi 489 | } 490 | 491 | check_commands () { 492 | curl_rc=$(check_command "curl") 493 | if [[ "${curl_rc}" != "" ]]; then 494 | echo "The curl command is required." 495 | exit 1 496 | fi 497 | 498 | if [[ "${SUDO}" != "" ]]; then 499 | sudo_rc=$(check_command "sudo") 500 | if [[ "${sudo_rc}" != "" ]]; then 501 | echo "The sudo command is required." 502 | exit 1 503 | fi 504 | fi 505 | } 506 | 507 | do_install () { 508 | 509 | # Check for curl 510 | check_commands 511 | 512 | # Detect OS 513 | os=$(detect_os) 514 | [ -z $os ] && { echo "OS not detected"; exit 1; } 515 | 516 | # Also detect the OS version (this may be blank if it's not relevant) 517 | os_ver=$(detect_os_version "${os}") 518 | 519 | # Determine version to download 520 | prompt_version 521 | [ -z $SELECTED_VERSION ] && { echo "Invalid version"; exit 1; } 522 | 523 | arch=$(uname -m) 524 | 525 | # Get the name of the installer to use 526 | installer_file_name=$(download_name "${os}" "${SELECTED_VERSION}" "${arch}") 527 | 528 | # Get the URL to download from. If the installer already exists in the current 529 | # directory, this will return a blank string. 530 | url=$(download_url "${os}" "${installer_file_name}" "${os_ver}") 531 | 532 | # Download the installer if necessary 533 | do_download ${url} 534 | 535 | # Install R 536 | installer_type=$(detect_installer_type "${os}") 537 | install "${installer_type}" "${installer_file_name}" "${os}" "${os_ver}" 538 | } 539 | 540 | do_show_usage() { 541 | echo "r-builds quick install version ${THIS_VERSION}" 542 | echo "Usage: `basename $0` [-i|-r|-v|-h|install|rversions|version|help]" 543 | echo "Where:" 544 | echo "'-i' or 'install' [version] [-y|yes] (default) list R versions available for quick install and prompt for one" 545 | echo "If a version is provided, the installation proceeds without prompting, confirmations can be optionally skipped" 546 | echo "'-r' or 'rversions' list the R versions available for quick install, one per line" 547 | echo "'-v' or 'version' shows the version of this command" 548 | echo "'-h' or 'help' show this info" 549 | } 550 | 551 | # Choose a command to perform 552 | case ${SCRIPT_ACTION} in 553 | "-i"|"install") 554 | do_install 555 | ;; 556 | "-r"|"rversions") 557 | do_show_versions 558 | ;; 559 | "-v"|"version") 560 | echo "r-builds quick install version ${THIS_VERSION}" 561 | ;; 562 | "-h"|"help"|*) 563 | do_show_usage 564 | ;; 565 | esac 566 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------