OpenBSD manual page server

Manual Page Search Parameters

RUBY-MODULE(5) File Formats Manual RUBY-MODULE(5)

ruby-modulelang/ruby port module

This manual page documents the behavior of setting MODULES=lang/ruby in the ports(7) tree.

The main usage of the lang/ruby module is to allow a single Ruby gem-based port to build packages for multiple versions of Ruby. The lang/ruby module also simplifies ports that depend on Ruby by automatically setting up the correct dependencies and defining commonly needed variables.

To allow a single Ruby gem-based port to build packages for multiple versions of Ruby, set a specific CONFIGURE_STYLE, which modifies some additional parameters:

="ruby gem"
For pure Ruby gems without C extensions. This adds PKG_ARCH = * to the port.
="ruby gem ext"
For Ruby gems with C extensions. To pass additional arguments to gem install when building the port, set those via CONFIGURE_ARGS.

CONFIGURE_STYLE="ruby gem" and CONFIGURE_STYLE="ruby gem ext" both add ruby31, ruby32, and ruby33 FLAVORs to the port. They also cause the FULLPKGNAME to use the FLAVOR- instead of ruby- as the package prefix.

The ports system defaults to using Ruby 3.3 if the version of Ruby is not specified. To specify a version for a gem port, use a specific FLAVOR, such as ruby32 to use Ruby 3.2. To specify the Ruby version to use for a non Ruby-gem port, set MODRUBY_REV to 3.1, 3.2, or 3.3.

To ensure that dependencies use the same Ruby implementation as the current port, all Ruby gem dependencies specified in the port should use this format:

category/ruby-foo,${MODRUBY_FLAVOR}

To prevent the ports system from automatically setting up FLAVORs in a gem port, set MODRUBY_HANDLE_FLAVORS to No. Similarly, to let the ports system automatically set up FLAVORs in a non-gem port, set MODRUBY_HANDLE_FLAVORS to Yes. When MODRUBY_HANDLE_FLAVORS is Yes, the ports system automatically adds the appropriate prefix to the FULLPKGNAME (e.g. ruby32- for ruby 3.2, ruby33- for ruby 3.3).

For Ruby gem ports that can work on multiple Ruby versions, append GEM_BIN_SUFFIX to every binary file entry in the PLIST. This is because the gem binaries for multiple Ruby versions are all installed to ${LOCALBASE}/bin, and the binaries all use a version-specific suffix. Any man pages and other files that would be installed to locations not specific to a Ruby implementation (such as under ${LOCALBASE}/share), should use GEM_MAN_SUFFIX before the extension so the different FLAVORs do not conflict.

make update-plist may remove GEM_BIN_SUFFIX and GEM_MAN_SUFFIX from the PLIST, or use them in inappropriate places, so be careful when updating gem ports with binaries or man pages. Additionally, for gem ports with C extensions, make update-plist will add back files used by the specific FLAVOR (such as files under the extension source directory), which may not exist for other FLAVORs, so always manually check the result of make update-plist and manually test that all supported FLAVORs are buildable before committing. Additionally, for gems with C extensions, make update-plist may add back the extension source files, which shouldn't be included in the files, so make sure to double check that all files added by make update-plist should be included in the package.

The lang/ruby module creates a do-test target if MODRUBY_TEST is used and one is not already defined.

The lang/ruby module appends to the following variables:

Adds dependency on version of Ruby in use unless MODRUBY_BUILDDEP is set to No, or NO_BUILD is set to Yes.
Adds the lang/ruby category.
Adds dependency on version of Ruby in use unless MODRUBY_RUNDEP is set to No.
Adds the rspec dependency if MODRUBY_TEST is set to rspec3.
Adds GEM_EXTENSIONS_DIR, MODRUBY_RELEXAMPLEDIR, MODRUBY_SITEARCHDIR, MODRUBY_SITEDIR, MODRUBY_LIBREV, MODRUBY_ARCH, GEM_LIB, GEM_BIN, and DISTNAME.
Adds options so that MODRUBY_RELEXAMPLEDIR, MODRUBY_SITEARCHDIR, MODRUBY_SITEDIR, GEM_LIB, and GEM_BIN are only substituted at the start of paths.

If using CONFIGURE_STYLE="ruby gem" or CONFIGURE_STYLE="ruby gem ext", it also appends to the following variables:

Adds support for extracting .gem files.

If using CONFIGURE_STYLE="ruby gem ext", it also appends to the following variables:

Adds libraries used by Ruby.
Adds MODRUBY_LIB_DEPENDS.
Adds additional PLIST so that loading native extensions will not attempt to rebuild them at runtime.
Adds GEM_EXTENSIONS_DIR.

If using MODRUBY_HANDLE_FLAVORS=Yes, it also appends to the following variables:

Adds GEM_BIN_SUFFIX and GEM_MAN_SUFFIX to SUBST_VARS so that the PLISTs work on multiple Ruby versions.

The lang/ruby module sets the following variables:

The path to the appropriate gem binary for the current Ruby version (/usr/local/bin/gem${MODRUBY_BINREV}).
The absolute path where the gem program will install the executable files provided by the gem (if any) during the fake target.
The absolute path where the gem program will install library files provided by the gem during the fake target.
The relative path under PREFIX where the package installs the gem's executable files.
The suffix to use for the gem's executable files, so that separate FLAVORs of the port do not conflict.
The relative path under PREFIX where the package installs Ruby-version specific files for Ruby gems with C extensions.
Option flags for gem install when building the port.
The relative path under PREFIX where Ruby gem files are stored for the Ruby version in use.
The suffix to use for the gem's manual pages, so that separate FLAVORs of the port do not conflict.
A list of filename patterns that will automatically have MODRUBY_RUBY_ADJ called on them during pre-configure.
The platform-specific string used by Ruby for files installed into platform-specific directories.
The same as MODRUBY_REV except without the dot (‘.’), reflecting the suffix used by the programs for the Ruby version in use.
The path to the rspec (rspec 3) binaries for the Ruby version in use.
The same as MODRUBY_RUN_DEPENDS. It is designed to be used in BUILD_DEPENDS values for other ports depending on Ruby.
If Ruby does not need to be installed while building the package(s), set to No. The default is Yes.
The FLAVOR to use for Ruby dependencies to ensure that they use the same version of Ruby as the current port.
Determines whether the port allows building with multiple FLAVORs, with each FLAVOR supporting a separate Ruby version.
The same as MODRUBY_REV.
The same as MODRUBY_RUN_DEPENDS. It is designed to be used in LIB_DEPENDS values for other ports depending on Ruby.
The prefix to use for packages built using the lang/ruby module, if the port support building with multiple Ruby versions.
The relative path under PREFIX where the package installs example files for non-Ruby gem ports.
Includes the major and minor versions of the version of Ruby in use, separated by a dot (‘.’). The port can override the value to specify which Ruby version to use, if the port sets or defaults to MODRUBY_HANDLE_FLAVORS=Yes.
A command that takes filename arguments and replaces the /usr/bin/env ruby shebang lines with RUBY.
The port path for the Ruby version in use. It is designed to be used in RUN_DEPENDS values for other ports depending on Ruby.
If the packages do not depend on Ruby at runtime, set to No. The default is Yes.
The relative path under PREFIX where the package installs platform-specific library files for non-Ruby gem ports.
The relative path under PREFIX where the package installs non-platform-specific library files for non-Ruby gem ports.
Set to ruby, rake, rspec3, or testrb to choose the appropriate program to run the regress tests, if the port includes tests.
Sets environment variables for the regress tests.
Sets the argument to the regress test program.
Includes the library-specs for the Ruby version in use.
The path to the program for the Ruby version in use (/usr/local/bin/rake${MODRUBY_BINREV}).
The path to the ruby(1) program for the Ruby version in use (/usr/local/bin/ruby${MODRUBY_BINREV}).

bsd.port.mk(5), port-modules(5)

June 20, 2024 OpenBSD-current