1 Star 0 Fork 0

wen / ruby-build

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ruby-build

ruby-build is a command-line utility that makes it easy to install virtually any version of Ruby, from source.

It is available as a plugin for rbenv that provides the rbenv install command, or as a standalone program.

Installation

# Using Homebrew on macOS
$ brew install ruby-build

# As an rbenv plugin
$ mkdir -p "$(rbenv root)"/plugins
$ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

# As a standalone program
$ git clone https://github.com/rbenv/ruby-build.git
$ PREFIX=/usr/local ./ruby-build/install.sh

Upgrading

# Via Homebrew
$ brew update && brew upgrade ruby-build

# As an rbenv plugin
$ cd "$(rbenv root)"/plugins/ruby-build && git pull

Usage

Basic Usage

# As an rbenv plugin
$ rbenv install --list                 # lists all available versions of Ruby
$ rbenv install 2.2.0                  # installs Ruby 2.2.0 to ~/.rbenv/versions

# As a standalone program
$ ruby-build --definitions             # lists all available versions of Ruby
$ ruby-build 2.2.0 ~/local/ruby-2.2.0  # installs Ruby 2.2.0 to ~/local/ruby-2.2.0

ruby-build does not check for system dependencies before downloading and attempting to compile the Ruby source. Please ensure that all requisite libraries are available on your system.

Advanced Usage

Custom Build Definitions

If you wish to develop and install a version of Ruby that is not yet supported by ruby-build, you may specify the path to a custom “build definition file” in place of a Ruby version number.

Use the default build definitions as a template for your custom definitions.

Custom Build Configuration

The build process may be configured through the following environment variables:

Variable Function
TMPDIR Where temporary files are stored.
RUBY_BUILD_BUILD_PATH Where sources are downloaded and built. (Default: a timestamped subdirectory of TMPDIR)
RUBY_BUILD_CACHE_PATH Where to cache downloaded package files. (Default: ~/.rbenv/cache if invoked as rbenv plugin)
RUBY_BUILD_MIRROR_URL Custom mirror URL root.
RUBY_BUILD_SKIP_MIRROR Always download from official sources, not mirrors. (Default: unset)
RUBY_BUILD_ROOT Custom build definition directory. (Default: share/ruby-build)
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).
CONFIGURE_OPTS Additional ./configure options.
MAKE Custom make command (e.g., gmake).
MAKE_OPTS / MAKEOPTS Additional make options.
MAKE_INSTALL_OPTS Additional make install options.
RUBY_CONFIGURE_OPTS Additional ./configure options (applies only to Ruby source).
RUBY_MAKE_OPTS Additional make options (applies only to Ruby source).
RUBY_MAKE_INSTALL_OPTS Additional make install options (applies only to Ruby source).

Applying Patches

Both rbenv install and ruby-build support the --patch (-p) flag to apply a patch to the Ruby (/JRuby/Rubinius/TruffleRuby) source code before building. Patches are read from STDIN:

# applying a single patch
$ rbenv install --patch 1.9.3-p429 < /path/to/ruby.patch

# applying a patch from HTTP
$ rbenv install --patch 1.9.3-p429 < <(curl -sSL http://git.io/ruby.patch)

# applying multiple patches
$ cat fix1.patch fix2.patch | rbenv install --patch 1.9.3-p429

Checksum Verification

If you have the shasum, openssl, or sha256sum tool installed, ruby-build will automatically verify the SHA2 checksum of each downloaded package before installing it.

Checksums are optional and specified as anchors on the package URL in each definition. (All bundled definitions include checksums.)

Package Mirrors

By default, ruby-build downloads package files from a mirror hosted on Amazon CloudFront. If a package is not available on the mirror, if the mirror is down, or if the download is corrupt, ruby-build will fall back to the official URL specified in the definition file.

You can point ruby-build to another mirror by specifying the RUBY_BUILD_MIRROR_URL environment variable--useful if you'd like to run your own local mirror, for example. Package mirror URLs are constructed by joining this variable with the SHA2 checksum of the package file.

If you don't have an SHA2 program installed, ruby-build will skip the download mirror and use official URLs instead. You can force ruby-build to bypass the mirror by setting the RUBY_BUILD_SKIP_MIRROR environment variable.

The official ruby-build download mirror is sponsored by Basecamp.

Keeping the build directory after installation

Both ruby-build and rbenv install accept the -k or --keep flag, which tells ruby-build to keep the downloaded source after installation. This can be useful if you need to use gdb and memprof with Ruby.

Source code will be kept in a parallel directory tree ~/.rbenv/sources when using --keep with the rbenv install command. You should specify the location of the source code with the RUBY_BUILD_BUILD_PATH environment variable when using --keep with ruby-build.

Getting Help

Please see the ruby-build wiki for solutions to common problems.

If you can't find an answer on the wiki, open an issue on the issue tracker. Be sure to include the full build log for build failures.

Copyright (c) 2012-2013 Sam Stephenson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/shiqinwen/ruby-build.git
git@gitee.com:shiqinwen/ruby-build.git
shiqinwen
ruby-build
ruby-build
master

搜索帮助