RUBY-MODULE(5)
π NAME π
Okay bestie, meet ruby-module(5) β the lang/ruby port module. This page is chillin' in the File Formats Manual, and it's all about what happens when you set MODULES=lang/ruby in the ports(7) tree. π
β¨ DESCRIPTION β¨
The big main-character use of the lang/ruby module is letting one single Ruby gem-based port build packages for multiple versions of Ruby. It also makes ports that depend on Ruby way easier, because it automatically sets up the correct dependencies and defines the commonly needed variables. No cap. π«Ά
π CONFIGURE_STYLE and the multi-Ruby glow-up π
To let a single Ruby gem-based port build packages for multiple versions of Ruby, set a specific CONFIGURE_STYLE, which modifies some additional parameters:
CONFIGURE_STYLE="ruby gem"β for pure Ruby gems without C extensions. This addsPKG_ARCH = *to the port. π§CONFIGURE_STYLE="ruby gem ext"β for Ruby gems with C extensions. Wanna pass additional arguments togem installwhen building the port? Set those viaCONFIGURE_ARGS. β¨
Both CONFIGURE_STYLE="ruby gem" and CONFIGURE_STYLE="ruby gem ext" add ruby33, ruby34, and ruby40 FLAVORs to the port. They also make FULLPKGNAME use FLAVOR- instead of ruby- as the package prefix. Iconic. π
The ports system defaults to using Ruby 3.4 if the version of Ruby is not specified. To specify a version for a gem port, use a specific FLAVOR, such as ruby33 to use Ruby 3.3. To specify the Ruby version to use for a non Ruby-gem port, set MODRUBY_REV to 3.3, 3.4, or 4.0. Easy. πΈ
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. ruby40- for ruby 4.0, 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. π
Careful, bestie!make update-plistmay removeGEM_BIN_SUFFIXandGEM_MAN_SUFFIXfrom thePLIST, 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-plistwill 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 ofmake update-plistand manually test that all supported FLAVORs are buildable before committing. Additionally, for gems with C extensions,make update-plistmay add back the extension source files, which shouldn't be included in the files, so make sure to double check that all files added bymake update-plistshould 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.
π«Ά Variables it appends to (the glow-up list) π«Ά
The lang/ruby module appends to the following variables:
BUILD_DEPENDSβ adds a dependency on the version of Ruby in use unlessMODRUBY_BUILDDEPis set toNo, orNO_BUILDis set toYes.CATEGORIESβ adds thelang/rubycategory.RUN_DEPENDSβ adds a dependency on the version of Ruby in use unlessMODRUBY_RUNDEPis set toNo.TEST_DEPENDSβ adds therspecdependency ifMODRUBY_TESTis set torspec3.SUBST_VARSβ addsGEM_EXTENSIONS_DIR,MODRUBY_RELEXAMPLEDIR,MODRUBY_SITEARCHDIR,MODRUBY_SITEDIR,MODRUBY_LIBREV,MODRUBY_ARCH,GEM_LIB,GEM_BIN, andDISTNAME.UPDATE_PLIST_ARGSβ adds options so thatMODRUBY_RELEXAMPLEDIR,MODRUBY_SITEARCHDIR,MODRUBY_SITEDIR,GEM_LIB, andGEM_BINare 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_CASESβ adds support for extracting.gemfiles.
If using CONFIGURE_STYLE="ruby gem ext", it also appends to the following variables:
WANTLIBβ adds libraries used by Ruby.LIB_DEPENDSβ addsMODRUBY_LIB_DEPENDS.PKG_ARGSβ adds additionalPLISTso that loading native extensions will not attempt to rebuild them at runtime.SUBST_VARSβ addsGEM_EXTENSIONS_DIR.
If using MODRUBY_HANDLE_FLAVORS=Yes, it also appends to the following variables:
SUBST_VARSβ addsGEM_BIN_SUFFIXandGEM_MAN_SUFFIXtoSUBST_VARSso that thePLISTs work on multiple Ruby versions.
π Variables it sets (main character list) π
The lang/ruby module sets the following variables:
GEMβ the path to the appropriategembinary for the current Ruby version (/usr/local/bin/gem${MODRUBY_BINREV}).GEM_BASE_BINβ the absolute path where thegemprogram will install the executable files provided by the gem (if any) during thefaketarget.GEM_BASE_LIBβ the absolute path where thegemprogram will install library files provided by the gem during thefaketarget.GEM_BINβ the relative path underPREFIXwhere the package installs the gem's executable files.GEM_BIN_SUFFIXβ the suffix to use for the gem's executable files, so that separate FLAVORs of the port do not conflict.GEM_EXTENSIONS_DIRβ the relative path underPREFIXwhere the package installs Ruby-version specific files for Ruby gems with C extensions.GEM_FLAGSβ option flags forgem installwhen building the port.GEM_LIBβ the relative path underPREFIXwhere Ruby gem files are stored for the Ruby version in use.GEM_MAN_SUFFIXβ the suffix to use for the gem's manual pages, so that separate FLAVORs of the port do not conflict.MODRUBY_ADJ_FILESβ a list of filename patterns that will automatically haveMODRUBY_RUBY_ADJcalled on them duringpre-configure.MODRUBY_ARCHβ the platform-specific string used by Ruby for files installed into platform-specific directories.MODRUBY_BINREVβ the same asMODRUBY_REVexcept without the dot (.), reflecting the suffix used by the programs for the Ruby version in use.MODRUBY_BIN_RSPECβ the path to therspec(rspec 3) binaries for the Ruby version in use.MODRUBY_BUILD_DEPENDSβ the same asMODRUBY_RUN_DEPENDS. It is designed to be used inBUILD_DEPENDSvalues for other ports depending on Ruby.MODRUBY_BUILDDEPβ if Ruby does not need to be installed while building the package(s), set toNo. The default isYes.MODRUBY_FLAVORβ the FLAVOR to use for Ruby dependencies to ensure that they use the same version of Ruby as the current port.MODRUBY_HANDLE_FLAVORSβ determines whether the port allows building with multiple FLAVORs, with each FLAVOR supporting a separate Ruby version.MODRUBY_LIBREVβ the same asMODRUBY_REV.MODRUBY_LIB_DEPENDSβ the same asMODRUBY_RUN_DEPENDS. It is designed to be used inLIB_DEPENDSvalues for other ports depending on Ruby.MODRUBY_PKG_PREFIXβ the prefix to use for packages built using thelang/rubymodule, if the port support building with multiple Ruby versions.MODRUBY_RELEXAMPLEDIRβ the relative path underPREFIXwhere the package installs example files for non-Ruby gem ports.MODRUBY_REVβ 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 toMODRUBY_HANDLE_FLAVORS=Yes.MODRUBY_RUBY_ADJβ a command that takes filename arguments and replaces the/usr/bin/env rubyshebang lines withRUBY.MODRUBY_RUN_DEPENDSβ the port path for the Ruby version in use. It is designed to be used inRUN_DEPENDSvalues for other ports depending on Ruby.MODRUBY_RUNDEPβ if the packages do not depend on Ruby at runtime, set toNo. The default isYes.MODRUBY_SITEARCHDIRβ the relative path underPREFIXwhere the package installs platform-specific library files for non-Ruby gem ports.MODRUBY_SITEDIRβ the relative path underPREFIXwhere the package installs non-platform-specific library files for non-Ruby gem ports.MODRUBY_TESTβ set toruby,rake,rspec3, ortestrbto choose the appropriate program to run the regress tests, if the port includes tests.MODRUBY_TEST_ENVβ sets environment variables for the regress tests.MODRUBY_TEST_TARGETβ sets the argument to the regress test program.MODRUBY_WANTLIBβ includes the library-specs for the Ruby version in use.RAKEβ the path to therakeprogram for the Ruby version in use (/usr/local/bin/rake${MODRUBY_BINREV}).RUBYβ the path to theruby(1)program for the Ruby version in use (/usr/local/bin/ruby${MODRUBY_BINREV}).
π¦ SEE ALSO π¦
That's the whole vibe, bestie. This page is marked RUBY-MODULE(5), and the footer says Debian / December 27, 2025 β mwah. π
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2011-2015, 2023 Jeremy Evans <jeremy@openbsd.org>
- Copyright (c) 2008, 2011 Marc Espie <espie@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms