Unverified Commit 5f4cea14 authored by Mislav Marohnić's avatar Mislav Marohnić Committed by GitHub
Browse files

Merge pull request #2258 from eregon/overridable-url

Add RUBY_BUILD_TARBALL_OVERRIDE to override the ruby tarball URL
parents 4bf2fece 216084d3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ The build process may be configured through the following environment variables:
| `RUBY_BUILD_MIRROR_PACKAGE_URL` | Custom complete mirror URL (e.g. http://mirror.example.com/package-1.0.0.tar.gz).                |
| `RUBY_BUILD_SKIP_MIRROR`        | Bypass the download mirror and fetch all package files from their original URLs.                 |
| `RUBY_BUILD_ROOT`               | Custom build definition directory. (Default: `share/ruby-build`)                                 |
| `RUBY_BUILD_TARBALL_OVERRIDE`   | Override the URL to fetch the ruby tarball from, optionally followed by `#checksum`.             |
| `RUBY_BUILD_DEFINITIONS`        | Additional paths to search for build definitions. (Colon-separated list)                         |
| `CC`                            | Path to the C compiler.                                                                          |
| `RUBY_CFLAGS`                   | Additional `CFLAGS` options (_e.g.,_ to override `-O3`).                                         |
+15 −2
Original line number Diff line number Diff line
@@ -381,6 +381,10 @@ fetch_tarball() {
  local checksum
  local extracted_dir

  if is_ruby_package "$1" && [ -n "$RUBY_BUILD_TARBALL_OVERRIDE" ]; then
    package_url="$RUBY_BUILD_TARBALL_OVERRIDE"
  fi

  if [ "$package_url" != "${package_url/\#}" ]; then
    checksum="${package_url#*#}"
    package_url="${package_url%%#*}"
@@ -1257,14 +1261,23 @@ isolated_gem_install() {

apply_ruby_patch() {
  local patchfile
  case "$1" in
  ruby-* | jruby-* | rubinius-* | truffleruby-* )
  if is_ruby_package "$1"; then
    patchfile="$(mktemp "${TMP}/ruby-patch.XXXXXX")"
    cat "${2:--}" >"$patchfile"

    local striplevel=0
    grep -q '^--- a/' "$patchfile" && striplevel=1
    patch -p$striplevel --force -i "$patchfile"
  fi
}

is_ruby_package() {
  case "$1" in
  ruby-* | jruby-* | rubinius-* | truffleruby[+-]* | mruby-* | picoruby-* )
    return 0
    ;;
  *)
    return 1
    ;;
  esac
}