Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ruby-build
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ruby-build
Commits
8ebfd1d0
Commit
8ebfd1d0
authored
Dec 20, 2013
by
Mislav Marohnić
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'apply-patch'
Closes #469
parents
379cd32a
f4a34da8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
6 deletions
+79
-6
README.md
+19
-0
bin/rbenv-install
+12
-4
bin/ruby-build
+16
-1
test/build.bats
+24
-0
test/test_helper.bash
+8
-1
No files found.
README.md
View file @
8ebfd1d0
...
...
@@ -123,6 +123,25 @@ You can set certain environment variables to control the build process.
make options for buildling MRI. These variables will be passed to Ruby only,
not any dependent packages (e.g. libyaml).
### Applying patches to Ruby before compiling
Both
`rbenv install`
and
`ruby-build`
support the
`--patch`
(
`-p`
) flag that
signals that a patch from stdin should be applied to Ruby, JRuby, or Rubinius
source code before the
`./configure`
and compilation steps.
Example usage:
```
sh
# 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
`md5`
,
`openssl`
, or
`md5sum`
tool installed, ruby-build will
...
...
bin/rbenv-install
View file @
8ebfd1d0
#!/usr/bin/env bash
#
# Summary: Install a Ruby version using
the ruby-build plugin
# Summary: Install a Ruby version using
ruby-build
#
# Usage: rbenv install [-f
|--force] [-k|--keep] [-v|--verbose
] <version>
# rbenv install [-f
|--force] [-k|--keep] [-v|--verbose
] <definition-file>
# Usage: rbenv install [-f
] [-kvp
] <version>
# rbenv install [-f
] [-kvp
] <definition-file>
# rbenv install -l|--list
#
# -l/--list List all available versions
# -f/--force Install even if the version appears to be installed already
#
# ruby-build options:
#
# -k/--keep Keep source tree in $RBENV_BUILD_ROOT after installation
# (defaults to $RBENV_ROOT/sources)
# -v/--verbose Verbose mode: print compilation status to stdout
# -p/--patch Apply a patch from stdin before building
#
# For detailed information on installing Ruby versions with
# ruby-build, including a list of environment variables for adjusting
...
...
@@ -49,6 +53,7 @@ indent() {
unset
FORCE
unset
KEEP
unset
VERBOSE
unset
HAS_PATCH
parse_options
"
$@
"
for
option
in
"
${
OPTIONS
[@]
}
"
;
do
...
...
@@ -70,6 +75,9 @@ for option in "${OPTIONS[@]}"; do
"v"
|
"verbose"
)
VERBOSE
=
"-v"
;;
"p"
|
"patch"
)
HAS_PATCH
=
"-p"
;;
"version"
)
exec
ruby-build
--version
;;
...
...
@@ -161,7 +169,7 @@ trap cleanup SIGINT
# Invoke `ruby-build` and record the exit status in $STATUS.
STATUS
=
0
ruby-build
$KEEP
$VERBOSE
"
$DEFINITION
"
"
$PREFIX
"
||
STATUS
=
"
$?
"
ruby-build
$KEEP
$VERBOSE
$HAS_PATCH
"
$DEFINITION
"
"
$PREFIX
"
||
STATUS
=
"
$?
"
# Display a more helpful message if the definition wasn't found.
if
[
"
$STATUS
"
==
"2"
]
;
then
...
...
bin/ruby-build
View file @
8ebfd1d0
...
...
@@ -364,6 +364,8 @@ build_package() {
echo
"Installing
${
package_name
}
..."
>
&2
[
-n
"
$HAS_PATCH
"
]
&&
apply_ruby_patch
"
$package_name
"
for
command
in
$commands
;
do
"build_package_
${
command
}
"
"
$package_name
"
done
...
...
@@ -783,13 +785,21 @@ isolated_gem_install() {
gem install
"
$@
"
}
apply_ruby_patch
()
{
case
"
$1
"
in
ruby-
*
|
jruby-
*
|
rubinius-
*
)
patch
-p0
-i
"
${
2
:-
-
}
"
;;
esac
}
version
()
{
echo
"ruby-build
${
RUBY_BUILD_VERSION
}
"
}
usage
()
{
{
version
echo
"usage: ruby-build [-k|--keep] [-v|--verbose] definition prefix"
echo
"usage: ruby-build [-k|--keep] [-v|--verbose]
[-p|--patch]
definition prefix"
echo
" ruby-build --definitions"
}
>
&2
...
...
@@ -809,6 +819,7 @@ list_definitions() {
unset
VERBOSE
unset
KEEP_BUILD_PATH
unset
HAS_PATCH
RUBY_BUILD_ROOT
=
"
$(
abs_dirname
"
$0
"
)
/.."
parse_options
"
$@
"
...
...
@@ -820,6 +831,7 @@ for option in "${OPTIONS[@]}"; do
{
echo
echo
" -k/--keep Do not remove source tree after installation"
echo
" -v/--verbose Verbose mode: print compilation status to stdout"
echo
" -p/--patch Apply a patch from stdin before building"
echo
" --definitions List all built-in definitions"
echo
}
>
&2
...
...
@@ -835,6 +847,9 @@ for option in "${OPTIONS[@]}"; do
"v"
|
"verbose"
)
VERBOSE
=
true
;;
"p"
|
"patch"
)
HAS_PATCH
=
true
;;
"version"
)
version
exit
0
...
...
test/build.bats
View file @
8ebfd1d0
...
...
@@ -71,6 +71,30 @@ make -j 2
OUT
}
@test "apply ruby patch before building" {
cached_tarball "yaml-0.1.4"
cached_tarball "ruby-2.0.0"
stub brew false
stub_make_install
stub_make_install
stub patch ' : echo patch "$@" >> build.log'
install_fixture --patch definitions/needs-yaml
assert_success
unstub make
unstub patch
assert_build_log <<OUT
yaml-0.1.4: --prefix=$INSTALL_ROOT
make -j 2
patch -p0 -i -
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
OUT
}
@test "yaml is linked from Homebrew" {
cached_tarball "ruby-2.0.0"
...
...
test/test_helper.bash
View file @
8ebfd1d0
...
...
@@ -51,11 +51,18 @@ run_inline_definition() {
}
install_fixture
()
{
local
args
while
[
"
${
1
#-
}
"
!=
"
$1
"
]
;
do
args
=
"
$args
$1
"
shift
1
done
local
name
=
"
$1
"
local
destination
=
"
$2
"
[
-n
"
$destination
"
]
||
destination
=
"
$INSTALL_ROOT
"
run ruby-build
"
$FIXTURE_ROOT
/
$name
"
"
$destination
"
run ruby-build
$args
"
$FIXTURE_ROOT
/
$name
"
"
$destination
"
}
assert
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment