-
Notifications
You must be signed in to change notification settings - Fork 785
Definitions
Build definitions are simple shell scripts that get sourced in the ruby-build environment so they can invoke functions that fetch necessary packages and compile them into the destination directory.
The basic invocation from a build definition is the function to download and install a package from a tarball:
install_package PACKAGE_NAME PACKAGE_URL#SHA2 [BUILD_STEPS...] [--if CONDITION]
PACKAGE_URL specifies the location of the tarball where the package is published. After download, its signature verified against the optional SHA2 checksum.
PACKAGE_NAME is the name of the directory to cd
into after extracting the
tarball. The subsequent BUILD_STEPS will be executed within that directory.
Alternatively, a package may be retrieved via git or SVN:
install_git PACKAGE_NAME GIT_URL BRANCH [...]
install_svn PACKAGE_NAME SVN_URL REVISION [...]
BUILD_STEPS is a list of operations to run in order to complete the installation of a Ruby version. If empty, the list defaults to "standard".
CONDITION is a way to specify that this package is optional and will only be installed if the function of the same name returns a success status. Some condition functions used in built-in definitions are:
- needs_openssl: true if there isn't an adequate OpenSSL version found on the system
Pre-build steps:
-
autoconf: Runs
autoconf
. Prerequisite for "standard" step when fetching Ruby versions from git/SVN.
Build steps:
-
standard:
./configure
+make
. This is the default. -
rbx:
bundle
+./configure
+rake install
for Rubinius. -
mruby:
rake
-
maglev:
./install.sh
- jruby: copies over pre-built JRuby.
- truffleruby: copies over pre-built TruffleRuby and runs its post-install hook.
- topaz: copies over pre-built Topaz.
-
ruby:
ruby setup.rb
. Used when installing RubyGems. - openssl: builds OpenSSL.
Post-build steps:
- verify_openssl: Checks that openssl extension can be loaded.
Before and after installing each package, ruby-build invokes these functions:
before_install_package PACKAGE_NAME
after_install_package PACKAGE_NAME
You can take advantage of this by defining these functions in the definition itself and filtering by package name as necessary:
before_install_package() {
local package_name="$1"
case "$package_name" in
ruby-* )
# do something for all Ruby packages
;;
esac
}
install_package ...