| RUBY-MODULE(5) | File Formats Manual | RUBY-MODULE(5) |
ruby-module —
lang/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:
CONFIGURE_STYLE="ruby
gem"PKG_ARCH = * to the port.CONFIGURE_STYLE="ruby
gem ext"install when building the
port, set those via CONFIGURE_ARGS.CONFIGURE_STYLE="ruby gem" and
CONFIGURE_STYLE="ruby gem ext" both add
ruby32, ruby33, and ruby34 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 ruby34 to use Ruby 3.4. To specify
the Ruby version to use for a non Ruby-gem port, set
MODRUBY_REV to 3.2, 3.3, or 3.4.
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. ruby33-
for ruby 3.3, ruby34- for ruby 3.4).
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:
BUILD_DEPENDSMODRUBY_BUILDDEP is set to
No, or NO_BUILD is set to
Yes.CATEGORIESRUN_DEPENDSMODRUBY_RUNDEP is set to
No.TEST_DEPENDSMODRUBY_TEST is set
to rspec3.SUBST_VARSGEM_EXTENSIONS_DIR,
MODRUBY_RELEXAMPLEDIR,
MODRUBY_SITEARCHDIR,
MODRUBY_SITEDIR,
MODRUBY_LIBREV,
MODRUBY_ARCH, GEM_LIB,
GEM_BIN, and
DISTNAME.UPDATE_PLIST_ARGSMODRUBY_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:
EXTRACT_CASESIf using CONFIGURE_STYLE="ruby gem
ext", it also appends to the following variables:
WANTLIBLIB_DEPENDSMODRUBY_LIB_DEPENDS.PKG_ARGSSUBST_VARSGEM_EXTENSIONS_DIR.If using MODRUBY_HANDLE_FLAVORS=Yes, it
also appends to the following variables:
SUBST_VARSGEM_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:
GEMGEM_BASE_BINGEM_BASE_LIBGEM_BINPREFIX where the package
installs the gem's executable files.GEM_BIN_SUFFIXFLAVORs of the port do not conflict.GEM_EXTENSIONS_DIRPREFIX where the package
installs Ruby-version specific files for Ruby gems with C extensions.GEM_FLAGSinstall
when building the port.GEM_LIBPREFIX where Ruby gem
files are stored for the Ruby version in use.GEM_MAN_SUFFIXFLAVORs of the port do not conflict.MODRUBY_ADJ_FILESMODRUBY_RUBY_ADJ called on them during
pre-configure.MODRUBY_ARCHMODRUBY_BINREVMODRUBY_REV except without the dot
(‘.’), reflecting the suffix used by
the programs for the Ruby version in use.MODRUBY_BIN_RSPECMODRUBY_BUILD_DEPENDSMODRUBY_RUN_DEPENDS. It is designed to
be used in BUILD_DEPENDS values for other ports
depending on Ruby.MODRUBY_BUILDDEPNo. The default is
Yes.MODRUBY_FLAVORMODRUBY_HANDLE_FLAVORSFLAVORs, with each FLAVOR
supporting a separate Ruby version.MODRUBY_LIBREVMODRUBY_REV.MODRUBY_LIB_DEPENDSMODRUBY_RUN_DEPENDS. It is designed to
be used in LIB_DEPENDS values for other ports
depending on Ruby.MODRUBY_PKG_PREFIXMODRUBY_RELEXAMPLEDIRPREFIX where the package
installs example files for non-Ruby gem ports.MODRUBY_REV.’). The port
can override the value to specify which Ruby version to use, if the port
sets or defaults to
MODRUBY_HANDLE_FLAVORS=Yes.MODRUBY_RUBY_ADJRUBY.MODRUBY_RUN_DEPENDSRUN_DEPENDS values for other ports depending on
Ruby.MODRUBY_RUNDEPNo. The default is
Yes.MODRUBY_SITEARCHDIRPREFIX where the package
installs platform-specific library files for non-Ruby gem ports.MODRUBY_SITEDIRPREFIX where the package
installs non-platform-specific library files for non-Ruby gem ports.MODRUBY_TESTruby, rake,
rspec3, or testrb to
choose the appropriate program to run the regress tests, if the port
includes tests.MODRUBY_TEST_ENVMODRUBY_TEST_TARGETMODRUBY_WANTLIBRAKERUBY| January 10, 2025 | openbsd |