[DRE-commits] [SCM] ruby-build.git branch, upstream, updated. a64f1c1fa6fdce4ea089151498ef0b5416c82644
Sebastian Boehm
sebastian at sometimesfood.org
Thu Jun 28 16:39:53 UTC 2012
The following commit has been merged in the upstream branch:
commit a64f1c1fa6fdce4ea089151498ef0b5416c82644
Author: Sebastian Boehm <sebastian at sometimesfood.org>
Date: Thu Jun 28 17:51:51 2012 +0200
Imported Upstream version 20120524
diff --git a/README.md b/README.md
index 6ab22e7..3364349 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,35 @@
# ruby-build
-ruby-build provides a simple way to compile and install different
-versions of Ruby on UNIX-like systems.
+ruby-build is an [rbenv](https://github.com/sstephenson/rbenv) plugin
+that provides an `rbenv install` command to compile and install
+different versions of Ruby on UNIX-like systems.
-### Installing ruby-build
+You can also use ruby-build without rbenv in environments where you
+need precise control over Ruby version installation.
+
+
+## Installation
+
+### Installing as an rbenv plugin (recommended)
+
+Installing ruby-build as an rbenv plugin will give you access to the
+`rbenv install` command.
+
+ $ mkdir -p ~/.rbenv/plugins
+ $ cd ~/.rbenv/plugins
+ $ git clone git://github.com/sstephenson/ruby-build.git
+
+This will install the latest development version of ruby-build into
+the `~/.rbenv/plugins/ruby-build` directory. From that directory, you
+can check out a specific release tag. To update ruby-build, run `git
+pull` to download the latest changes.
+
+### Installing as a standalone program (advanced)
+
+Installing ruby-build as a standalone program will give you access to
+the `ruby-build` command for precise control over Ruby version
+installation. If you have rbenv installed, you will also be able to
+use the `rbenv install` command.
$ git clone git://github.com/sstephenson/ruby-build.git
$ cd ruby-build
@@ -14,46 +40,123 @@ write permission to `/usr/local`, you will need to run `sudo
./install.sh` instead. You can install to a different prefix by
setting the `PREFIX` environment variable.
-If you only intend to use ruby-build via rbenv then you can
-install it locally as a plugin:
+To update ruby-build after it has been installed, run `git pull` in
+your cloned copy of the repository, then re-run the install script.
- $ mkdir -p ~/.rbenv/plugins
- $ cd ~/.rbenv/plugins
- $ git clone git://github.com/sstephenson/ruby-build.git
+### Installing with Homebrew (for OS X users)
-And if you're using Homebrew, you can just
+Mac OS X users can install ruby-build with the
+[Homebrew](http://mxcl.github.com/homebrew/) package manager. This
+will give you access to the `ruby-build` command. If you have rbenv
+installed, you will also be able to use the `rbenv install` command.
+
+*This is the recommended method of installation if you installed rbenv
+ with Homebrew.*
$ brew install ruby-build
-to get the latest release, or
+Or, if you would like to install the latest development release:
$ brew install --HEAD ruby-build
-to pull the latest from git.
+## Usage
+
+### Using `rbenv install` with rbenv
+
+To install a Ruby version for use with rbenv, run `rbenv install` with
+the exact name of the version you want to install. For example,
+
+ $ rbenv install 1.9.3-p194
+
+Ruby versions will be installed into a directory of the same name
+under `~/.rbenv/versions`.
+
+To see a list of all available Ruby versions, run `rbenv install`
+without any arguments. You may also tab-complete available Ruby
+versions if your rbenv installation is properly configured.
+
+### Using `ruby-build` standalone
+
+If you have installed ruby-build as a standalone program, you can use
+the `ruby-build` command to compile and install Ruby versions into
+specific locations.
+
+Run the `ruby-build` command with the exact name of the version you
+want to install and the full path where you want to install it. For
+example,
+
+ $ ruby-build 1.9.3-p194 ~/local/ruby-1.9.3-p194
+
+To see a list of all available Ruby versions, run `ruby-build
+--definitions`.
+
+Pass the `-v` or `--verbose` flag to `ruby-build` as the first
+argument to see what's happening under the hood.
+
+### Custom definitions
+
+Both `rbenv install` and `ruby-build` accept a path to a custom
+definition file in place of a version name. Custom definitions let you
+develop and install versions of Ruby that are not yet supported by
+ruby-build.
+
+See the [ruby-build built-in
+definitions](https://github.com/sstephenson/ruby-build/tree/share/ruby-build)
+as a starting point for custom definition files.
+
+### Special environment variables
+
+You can set certain environment variables to control the build
+process.
+
+* `TMPDIR` sets the location where ruby-build stores temporary files.
+* `RUBY_BUILD_BUILD_PATH` sets the location in which sources are
+ downloaded and built. By default, this is a subdirectory of
+ `TMPDIR`.
+* `CC` sets the path to the C compiler.
+* `CONFIGURE_OPTS` lets you pass additional options to `./configure`.
+* `MAKE_OPTS` (or `MAKEOPTS`) lets you pass additional options to
+ `make`.
+
+### 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`.
-### Installing Ruby
-To install a Ruby version, run the `ruby-build` command with the path
-to a definition file and the path where you want to install it. (A
-number of [built-in
-definitions](https://github.com/sstephenson/ruby-build/tree/master/share/ruby-build)
-may be specified instead.)
+## Getting Help
- $ ruby-build 1.9.2-p290 ~/local/ruby-1.9.2-p290
- ...
- $ ~/local/ruby-1.9.2-p290/bin/ruby --version
- ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
+Please see the [ruby-build
+wiki](https://github.com/sstephenson/ruby-build/wiki) for solutions to
+common problems.
-You can use it with [rbenv](https://github.com/sstephenson/rbenv):
+If you can't find an answer on the wiki, open an issue on the [issue
+tracker](https://github.com/sstephenson/ruby-build/issues). Be sure to
+include the full build log for build failures.
- $ ruby-build 1.9.2-p290 ~/.rbenv/versions/1.9.2-p290
-ruby-build provides an `rbenv-install` command that shortens this to:
+## Version History
- $ rbenv install 1.9.2-p290
+#### 20120524
-### Version History
+* Added definitions for JRuby 1.6.7.2 and 1.7.0-preview1.
+* Removed the definition for JRuby 1.7.0-dev. (In general we do not
+ like to remove definitions, but the JRuby team has deleted the
+ 1.7.0-dev package from their servers -- caveat emptor.)
+* Added support for specifying the build location with the
+ `RUBY_BUILD_BUILD_PATH` environment variable.
+* Added a `-k`/`--keep` flag to `ruby-build` and `rbenv install` for
+ keeping the source code around after installation.
+* Updated the readme to emphasize installation as an rbenv plugin.
#### 20120423
diff --git a/bin/rbenv-install b/bin/rbenv-install
index 486e5c9..35496be 100755
--- a/bin/rbenv-install
+++ b/bin/rbenv-install
@@ -23,10 +23,20 @@ case "$DEFINITION" in
} >&2
exit 1
;;
+"-k" | "--keep" )
+ [ -z "${RBENV_BUILD_ROOT}" ] && RBENV_BUILD_ROOT="${RBENV_ROOT}/sources"
+ RUBY_BUILD_OPTIONS="${RUBY_BUILD_OPTIONS} -k"
+ ;;
esac
VERSION_NAME="${DEFINITION##*/}"
PREFIX="${RBENV_ROOT}/versions/${VERSION_NAME}"
-ruby-build "$DEFINITION" "$PREFIX"
-rbenv rehash
\ No newline at end of file
+# If RBENV_BUILD_ROOT is set, then always pass keep options to ruby-build
+if [ -n "${RBENV_BUILD_ROOT}" ]; then
+ export RUBY_BUILD_BUILD_PATH="${RBENV_BUILD_ROOT}/${VERSION_NAME}"
+ RUBY_BUILD_OPTIONS="${RUBY_BUILD_OPTIONS} -k"
+fi
+
+ruby-build "$DEFINITION" "$PREFIX" "$RUBY_BUILD_OPTIONS"
+rbenv rehash
diff --git a/bin/ruby-build b/bin/ruby-build
index d29d855..9f897ac 100755
--- a/bin/ruby-build
+++ b/bin/ruby-build
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-RUBY_BUILD_VERSION="20120423"
+RUBY_BUILD_VERSION="20120524"
set -E
exec 3<&2 # preserve original stderr at fd 3
@@ -28,8 +28,8 @@ build_failed() {
echo "BUILD FAILED"
echo
- if ! rmdir "${TEMP_PATH}" 2>/dev/null; then
- echo "Inspect or clean up the working tree at ${TEMP_PATH}"
+ if ! rmdir "${BUILD_PATH}" 2>/dev/null; then
+ echo "Inspect or clean up the working tree at ${BUILD_PATH}"
if file_is_not_empty "$LOG_PATH"; then
echo "Results logged to ${LOG_PATH}"
@@ -68,7 +68,7 @@ install_package_using() {
local package_name="$3"
shift 3
- pushd "$TEMP_PATH" >&4
+ pushd "$BUILD_PATH" >&4
"fetch_${package_type}" "$package_name" $*
shift $(($package_type_nargs))
make_package "$package_name" $*
@@ -396,6 +396,15 @@ if [ -z "$PREFIX_PATH" ]; then
usage
fi
+OPTIONS="$3"
+for option in $OPTIONS; do
+ case "$option" in
+ "-k" | "--keep" )
+ KEEP_BUILD_PATH="y"
+ ;;
+ esac
+done
+
if [ -z "$TMPDIR" ]; then
TMP="/tmp"
else
@@ -404,10 +413,15 @@ fi
SEED="$(date "+%Y%m%d%H%M%S").$$"
LOG_PATH="${TMP}/ruby-build.${SEED}.log"
-TEMP_PATH="${TMP}/ruby-build.${SEED}"
RUBY_BIN="${PREFIX_PATH}/bin/ruby"
CWD="$(pwd)"
+if [ -z $RUBY_BUILD_BUILD_PATH ]; then
+ BUILD_PATH="${TMP}/ruby-build.${SEED}"
+else
+ BUILD_PATH=$RUBY_BUILD_BUILD_PATH
+fi
+
exec 4<> "$LOG_PATH" # open the log file at fd 4
if [ -n "$VERBOSE" ]; then
tail -f "$LOG_PATH" &
@@ -421,7 +435,7 @@ unset RUBYOPT
unset RUBYLIB
trap build_failed ERR
-mkdir -p "$TEMP_PATH"
+mkdir -p "$BUILD_PATH"
source "$DEFINITION_PATH"
-rm -fr "$TEMP_PATH"
+[ -z "${KEEP_BUILD_PATH}" ] && rm -fr "$BUILD_PATH"
trap - ERR
diff --git a/share/ruby-build/jruby-1.6.7.2 b/share/ruby-build/jruby-1.6.7.2
new file mode 100644
index 0000000..c27d480
--- /dev/null
+++ b/share/ruby-build/jruby-1.6.7.2
@@ -0,0 +1 @@
+install_package "jruby-1.6.7.2" "http://jruby.org.s3.amazonaws.com/downloads/1.6.7.2/jruby-bin-1.6.7.2.tar.gz" jruby
diff --git a/share/ruby-build/jruby-1.7.0-dev b/share/ruby-build/jruby-1.7.0-dev
deleted file mode 100644
index bb1531c..0000000
--- a/share/ruby-build/jruby-1.7.0-dev
+++ /dev/null
@@ -1 +0,0 @@
-install_package "jruby-1.7.0.dev" "http://ci.jruby.org/snapshots/1.7.x/jruby-bin-1.7.0.dev.tar.gz" jruby
diff --git a/share/ruby-build/jruby-1.7.0-preview1 b/share/ruby-build/jruby-1.7.0-preview1
new file mode 100644
index 0000000..403b76b
--- /dev/null
+++ b/share/ruby-build/jruby-1.7.0-preview1
@@ -0,0 +1 @@
+install_package "jruby-1.7.0.preview1" "http://ci.jruby.org/snapshots/1.7.x/jruby-bin-1.7.0.preview1.tar.gz" jruby
--
ruby-build.git
More information about the Pkg-ruby-extras-commits
mailing list