1*9d930ed6Sjeremy.\" $OpenBSD: ruby-module.5,v 1.49 2025/01/10 03:41:02 jeremy Exp $ 2de9e3489Sespie.\" 398f70928Sjeremy.\" Copyright (c) 2011-2015, 2023 Jeremy Evans <jeremy@openbsd.org> 498f70928Sjeremy.\" Copyright (c) 2008, 2011 Marc Espie <espie@openbsd.org> 5de9e3489Sespie.\" 6de9e3489Sespie.\" All rights reserved. 7de9e3489Sespie.\" 8de9e3489Sespie.\" Redistribution and use in source and binary forms, with or without 9de9e3489Sespie.\" modification, are permitted provided that the following conditions 10de9e3489Sespie.\" are met: 11de9e3489Sespie.\" 1. Redistributions of source code must retain the above copyright 12de9e3489Sespie.\" notice, this list of conditions and the following disclaimer. 13de9e3489Sespie.\" 2. Redistributions in binary form must reproduce the above copyright 14de9e3489Sespie.\" notice, this list of conditions and the following disclaimer in the 15de9e3489Sespie.\" documentation and/or other materials provided with the distribution. 16de9e3489Sespie.\" 17de9e3489Sespie.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 18de9e3489Sespie.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19de9e3489Sespie.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20de9e3489Sespie.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 21de9e3489Sespie.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22de9e3489Sespie.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23de9e3489Sespie.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24de9e3489Sespie.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25de9e3489Sespie.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26de9e3489Sespie.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27de9e3489Sespie.\" 28*9d930ed6Sjeremy.Dd $Mdocdate: January 10 2025 $ 29de9e3489Sespie.Dt RUBY-MODULE 5 30de9e3489Sespie.Os 31de9e3489Sespie.Sh NAME 32de9e3489Sespie.Nm ruby-module 33de9e3489Sespie.Nd lang/ruby port module 34de9e3489Sespie.Sh DESCRIPTION 35de9e3489SespieThis manual page documents the behavior of setting 3698f70928Sjeremy.Ev MODULES Ns Li =lang/ruby 37de9e3489Sespiein the 38de9e3489Sespie.Xr ports 7 39de9e3489Sespietree. 40de9e3489Sespie.Pp 4198f70928SjeremyThe main usage of the lang/ruby module is to allow a single Ruby gem-based 4298f70928Sjeremyport to build packages for multiple versions of Ruby. 4398f70928SjeremyThe lang/ruby module also simplifies ports that depend on Ruby by 4498f70928Sjeremyautomatically setting up the correct dependencies and defining commonly 4598f70928Sjeremyneeded variables. 469f548227Sjeremy.Pp 4798f70928SjeremyTo allow a single Ruby gem-based port to build packages for multiple versions 4898f70928Sjeremyof Ruby, set a specific 4998f70928Sjeremy.Ev CONFIGURE_STYLE , 5098f70928Sjeremywhich modifies some additional parameters: 5198f70928Sjeremy.Bl -tag -width Ds 5298f70928Sjeremy.It Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem 5398f70928SjeremyFor pure Ruby gems without C extensions. 54de9e3489SespieThis adds 55de9e3489Sespie.Ev PKG_ARCH 5698f70928Sjeremy= * to the port. 5798f70928Sjeremy.It Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext 5898f70928SjeremyFor Ruby gems with C extensions. 5998f70928SjeremyTo pass additional arguments to 6098f70928Sjeremy.Sy gem Cm install 6198f70928Sjeremywhen building the port, set 6298f70928Sjeremythose via 6349384c04Sjeremy.Ev CONFIGURE_ARGS . 64a706c36bSjmc.El 659f548227Sjeremy.Pp 6698f70928Sjeremy.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem 6798f70928Sjeremyand 6898f70928Sjeremy.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext 69*9d930ed6Sjeremyboth add ruby32, ruby33, and ruby34 7098f70928Sjeremy.Ev FLAVOR Ns s 7198f70928Sjeremyto the port. 7298f70928SjeremyThey also cause the 73de9e3489Sespie.Ev FULLPKGNAME 74de9e3489Sespieto use the 7598f70928Sjeremy.Ev FLAVOR Ns \- 7698f70928Sjeremyinstead of ruby\- as the package prefix. 779f548227Sjeremy.Pp 78bd7efcc2SjeremyThe ports system defaults to using Ruby 3.3 if the version of Ruby is not 7949384c04Sjeremyspecified. 8098f70928SjeremyTo specify a version for a gem port, use a specific 8149384c04Sjeremy.Ev FLAVOR , 82*9d930ed6Sjeremysuch as ruby34 to use Ruby 3.4. 8398f70928SjeremyTo specify the Ruby version to use for a non Ruby-gem port, set 8449384c04Sjeremy.Ev MODRUBY_REV 85*9d930ed6Sjeremyto 3.2, 3.3, or 3.4. 8649384c04Sjeremy.Pp 8798f70928SjeremyTo ensure that dependencies use the same Ruby implementation as the 8898f70928Sjeremycurrent port, all Ruby gem dependencies specified in the port 8998f70928Sjeremyshould use this format: 9098f70928Sjeremy.Pp 9198f70928Sjeremy.Dl category/ruby\-foo,${MODRUBY_FLAVOR} 9298f70928Sjeremy.Pp 9398f70928SjeremyTo prevent the ports system from automatically setting up 9449384c04Sjeremy.Ev FLAVOR Ns s 9598f70928Sjeremyin a gem port, set 9649384c04Sjeremy.Ev MODRUBY_HANDLE_FLAVORS 9798f70928Sjeremyto 9898f70928Sjeremy.Cm \&No . 9998f70928SjeremySimilarly, to let the ports system automatically set up 10049384c04Sjeremy.Ev FLAVOR Ns s 10198f70928Sjeremyin a non-gem port, set 10249384c04Sjeremy.Ev MODRUBY_HANDLE_FLAVORS 10398f70928Sjeremyto 10498f70928Sjeremy.Cm Yes . 10549384c04SjeremyWhen 10649384c04Sjeremy.Ev MODRUBY_HANDLE_FLAVORS 10798f70928Sjeremyis 10898f70928Sjeremy.Cm Yes , 10998f70928Sjeremythe ports system automatically adds the appropriate prefix to the 11049384c04Sjeremy.Ev FULLPKGNAME 111*9d930ed6Sjeremy(e.g. ruby33\- for ruby 3.3, ruby34\- for ruby 3.4). 11249384c04Sjeremy.Pp 11398f70928SjeremyFor Ruby gem ports that can work on multiple Ruby versions, append 11498f70928Sjeremy.Ev GEM_BIN_SUFFIX 11598f70928Sjeremyto every binary file entry in the PLIST. 11698f70928SjeremyThis is because the gem binaries for multiple Ruby versions are all 1179c1cdf0fSjeremyinstalled to 118179fe6e6Sespie.Pa ${LOCALBASE}/bin , 1196bdb104aSjeremyand the binaries all use a version-specific suffix. 120de9e3489SespieAny man pages and other files that would be installed to locations not 12198f70928Sjeremyspecific to a Ruby implementation (such as under 122179fe6e6Sespie.Pa ${LOCALBASE}/share ) , 123de9e3489Sespieshould use 124de9e3489Sespie.Ev GEM_MAN_SUFFIX 125de9e3489Sespiebefore the extension so the different 126de9e3489Sespie.Ev FLAVOR Ns s 127de9e3489Sespiedo not conflict. 1289c1cdf0fSjeremy.Pp 12998f70928Sjeremymake update\-plist may remove 130de9e3489Sespie.Ev GEM_BIN_SUFFIX 131de9e3489Sespieand 1329c1cdf0fSjeremy.Ev GEM_MAN_SUFFIX 13398f70928Sjeremyfrom the PLIST, or use them in inappropriate places, so be careful when 13498f70928Sjeremyupdating gem ports with binaries or man pages. 13598f70928SjeremyAdditionally, for gem ports with C extensions, make update\-plist will add back 1369c1cdf0fSjeremyfiles used by the specific 1379c1cdf0fSjeremy.Ev FLAVOR 13898f70928Sjeremy(such as files under the extension source directory), which may 1399c1cdf0fSjeremynot exist for other 1409c1cdf0fSjeremy.Ev FLAVOR Ns s , 14198f70928Sjeremyso always manually check the result of make update\-plist and manually test that 14298f70928Sjeremyall supported 1439c1cdf0fSjeremy.Ev FLAVOR Ns s 14498f70928Sjeremyare buildable before committing. 14598f70928SjeremyAdditionally, for gems with C extensions, make update\-plist may add back the 1463cfceaccSjeremyextension source files, which shouldn't be included in the files, so make sure 14798f70928Sjeremyto double check that all files added by make update\-plist should be included 1483cfceaccSjeremyin the package. 14998f70928Sjeremy.Pp 15098f70928SjeremyThe lang/ruby module creates a do\-test target if 15198f70928Sjeremy.Ev MODRUBY_TEST 15298f70928Sjeremyis used and one is not already defined. 15398f70928Sjeremy.Pp 15498f70928SjeremyThe lang/ruby module appends to the following variables: 15598f70928Sjeremy.Bl -tag -width Ds 15698f70928Sjeremy.It Ev BUILD_DEPENDS 15798f70928SjeremyAdds dependency on version of Ruby in use unless 15898f70928Sjeremy.Ev MODRUBY_BUILDDEP 15998f70928Sjeremyis set to 16098f70928Sjeremy.Cm \&No , 16198f70928Sjeremyor 16298f70928Sjeremy.Ev NO_BUILD 16398f70928Sjeremyis set to 16498f70928Sjeremy.Cm Yes . 16598f70928Sjeremy.It Ev CATEGORIES 16698f70928SjeremyAdds the lang/ruby category. 16798f70928Sjeremy.It Ev RUN_DEPENDS 16898f70928SjeremyAdds dependency on version of Ruby in use unless 16998f70928Sjeremy.Ev MODRUBY_RUNDEP 17098f70928Sjeremyis set to 17198f70928Sjeremy.Cm \&No . 17298f70928Sjeremy.It Ev TEST_DEPENDS 17398f70928SjeremyAdds the rspec dependency if 17498f70928Sjeremy.Ev MODRUBY_TEST 17598f70928Sjeremyis set to rspec3. 17698f70928Sjeremy.It Ev SUBST_VARS 17798f70928SjeremyAdds 17898f70928Sjeremy.Ev GEM_EXTENSIONS_DIR , 17998f70928Sjeremy.Ev MODRUBY_RELEXAMPLEDIR , 18098f70928Sjeremy.Ev MODRUBY_SITEARCHDIR , 18198f70928Sjeremy.Ev MODRUBY_SITEDIR , 18298f70928Sjeremy.Ev MODRUBY_LIBREV , 18398f70928Sjeremy.Ev MODRUBY_ARCH , 18498f70928Sjeremy.Ev GEM_LIB , 18598f70928Sjeremy.Ev GEM_BIN , 18698f70928Sjeremyand 18798f70928Sjeremy.Ev DISTNAME . 18898f70928Sjeremy.It Ev UPDATE_PLIST_ARGS 18998f70928SjeremyAdds options so that 19098f70928Sjeremy.Ev MODRUBY_RELEXAMPLEDIR , 19198f70928Sjeremy.Ev MODRUBY_SITEARCHDIR , 19298f70928Sjeremy.Ev MODRUBY_SITEDIR , 19398f70928Sjeremy.Ev GEM_LIB , 19498f70928Sjeremyand 19598f70928Sjeremy.Ev GEM_BIN 19698f70928Sjeremyare only substituted at the start of paths. 19798f70928Sjeremy.El 19898f70928Sjeremy.Pp 19998f70928SjeremyIf using 20098f70928Sjeremy.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem 20198f70928Sjeremyor 20298f70928Sjeremy.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext , 20398f70928Sjeremyit also appends to the following variables: 20498f70928Sjeremy.Bl -tag -width Ds 20598f70928Sjeremy.It Ev EXTRACT_CASES 20698f70928SjeremyAdds support for extracting .gem files. 20798f70928Sjeremy.El 20898f70928Sjeremy.Pp 20998f70928SjeremyIf using 21098f70928Sjeremy.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext , 21198f70928Sjeremyit also appends to the following variables: 21298f70928Sjeremy.Bl -tag -width Ds 21398f70928Sjeremy.It Ev WANTLIB 21498f70928SjeremyAdds libraries used by Ruby. 21598f70928Sjeremy.It Ev LIB_DEPENDS 21698f70928SjeremyAdds 21798f70928Sjeremy.Ev MODRUBY_LIB_DEPENDS . 21898f70928Sjeremy.It Ev PKG_ARGS 21998f70928SjeremyAdds additional PLIST so that loading native extensions will not attempt to 22098f70928Sjeremyrebuild them at runtime. 22198f70928Sjeremy.It Ev SUBST_VARS 22298f70928SjeremyAdds 22398f70928Sjeremy.Ev GEM_EXTENSIONS_DIR . 22498f70928Sjeremy.El 22598f70928Sjeremy.Pp 22698f70928SjeremyIf using 22798f70928Sjeremy.Ev MODRUBY_HANDLE_FLAVORS Ns = Ns Yes , 22898f70928Sjeremyit also appends to the following variables: 22998f70928Sjeremy.Bl -tag -width Ds 23098f70928Sjeremy.It Ev SUBST_VARS 23198f70928SjeremyAdds 23298f70928Sjeremy.Ev GEM_BIN_SUFFIX 23398f70928Sjeremyand 23498f70928Sjeremy.Ev GEM_MAN_SUFFIX 23598f70928Sjeremyto 23698f70928Sjeremy.Ev SUBST_VARS 23798f70928Sjeremyso that the PLISTs work on multiple Ruby versions. 23898f70928Sjeremy.El 23998f70928Sjeremy.Pp 24098f70928SjeremyThe lang/ruby module sets the following variables: 24198f70928Sjeremy.Bl -tag -width Ds 24298f70928Sjeremy.It Ev GEM 24398f70928SjeremyThe path to the appropriate 24498f70928Sjeremy.Sy gem 24598f70928Sjeremybinary for the current Ruby version (/usr/local/bin/gem${MODRUBY_BINREV}). 24698f70928Sjeremy.It Ev GEM_BASE_BIN 24798f70928SjeremyThe absolute path where the 24898f70928Sjeremy.Sy gem 24998f70928Sjeremyprogram will install the executable 25098f70928Sjeremyfiles provided by the gem (if any) during the fake target. 25198f70928Sjeremy.It Ev GEM_BASE_LIB 25298f70928SjeremyThe absolute path where the 25398f70928Sjeremy.Sy gem 25498f70928Sjeremyprogram will install library files 25598f70928Sjeremyprovided by the gem during the fake target. 25698f70928Sjeremy.It Ev GEM_BIN 25798f70928SjeremyThe relative path under 25898f70928Sjeremy.Ev PREFIX 25998f70928Sjeremywhere the package installs the gem's executable files. 26098f70928Sjeremy.It Ev GEM_BIN_SUFFIX 26198f70928SjeremyThe suffix to use for the gem's executable files, so that separate 26298f70928Sjeremy.Ev FLAVOR Ns s 26398f70928Sjeremyof the port do not conflict. 26498f70928Sjeremy.It Ev GEM_EXTENSIONS_DIR 26598f70928SjeremyThe relative path under 26698f70928Sjeremy.Ev PREFIX 26798f70928Sjeremywhere the package installs Ruby-version specific files for Ruby gems 26898f70928Sjeremywith C extensions. 26998f70928Sjeremy.It Ev GEM_FLAGS 27098f70928SjeremyOption flags for 27198f70928Sjeremy.Sy gem Cm install 27298f70928Sjeremywhen building the port. 27398f70928Sjeremy.It Ev GEM_LIB 27498f70928SjeremyThe relative path under 27598f70928Sjeremy.Ev PREFIX 27698f70928Sjeremywhere Ruby gem files are stored for the Ruby version in use. 27798f70928Sjeremy.It Ev GEM_MAN_SUFFIX 27898f70928SjeremyThe suffix to use for the gem's manual pages, so that separate 27998f70928Sjeremy.Ev FLAVOR Ns s 28098f70928Sjeremyof the port do not conflict. 28198f70928Sjeremy.It Ev MODRUBY_ADJ_FILES 28298f70928SjeremyA list of filename patterns that will automatically have 28398f70928Sjeremy.Ev MODRUBY_RUBY_ADJ 28498f70928Sjeremycalled on them during pre\-configure. 28598f70928Sjeremy.It Ev MODRUBY_ARCH 2861a4ae3eeSjsgThe platform-specific string used by Ruby for files installed 28798f70928Sjeremyinto platform-specific directories. 28898f70928Sjeremy.It Ev MODRUBY_BINREV 28998f70928SjeremyThe same as 29098f70928Sjeremy.Ev MODRUBY_REV 29198f70928Sjeremyexcept without the dot 29298f70928Sjeremy.Pq Ql \&. , 29398f70928Sjeremyreflecting the suffix used by the 29498f70928Sjeremyprograms for the Ruby version in use. 29598f70928Sjeremy.It Ev MODRUBY_BIN_RSPEC 29698f70928SjeremyThe path to the rspec (rspec 3) binaries for the Ruby 29798f70928Sjeremyversion in use. 29898f70928Sjeremy.It Ev MODRUBY_BUILD_DEPENDS 29998f70928SjeremyThe same as 30098f70928Sjeremy.Ev MODRUBY_RUN_DEPENDS . 30198f70928SjeremyIt is designed to be used in 30298f70928Sjeremy.Ev BUILD_DEPENDS 30398f70928Sjeremyvalues for other ports depending on Ruby. 30498f70928Sjeremy.It Ev MODRUBY_BUILDDEP 30598f70928SjeremyIf Ruby does not need to be installed 30698f70928Sjeremywhile building the package(s), set to 30798f70928Sjeremy.Cm \&No . 30898f70928SjeremyThe default is 30998f70928Sjeremy.Cm Yes . 31098f70928Sjeremy.It Ev MODRUBY_FLAVOR 31198f70928SjeremyThe FLAVOR to use for Ruby dependencies to ensure that 31298f70928Sjeremythey use the same version of Ruby as the current port. 31398f70928Sjeremy.It Ev MODRUBY_HANDLE_FLAVORS 31498f70928SjeremyDetermines whether the port allows building with multiple 31598f70928Sjeremy.Ev FLAVOR Ns s, 31698f70928Sjeremywith each 31798f70928Sjeremy.Ev FLAVOR 31898f70928Sjeremysupporting a separate Ruby version. 31998f70928Sjeremy.It Ev MODRUBY_LIBREV 32098f70928SjeremyThe same as 32198f70928Sjeremy.Ev MODRUBY_REV . 32298f70928Sjeremy.It Ev MODRUBY_LIB_DEPENDS 32398f70928SjeremyThe same as 32498f70928Sjeremy.Ev MODRUBY_RUN_DEPENDS . 32598f70928SjeremyIt is designed to be used in 32698f70928Sjeremy.Ev LIB_DEPENDS 32798f70928Sjeremyvalues for other ports depending on Ruby. 32898f70928Sjeremy.It Ev MODRUBY_PKG_PREFIX 32998f70928SjeremyThe prefix to use for packages built using the lang/ruby module, 33098f70928Sjeremyif the port support building with multiple Ruby versions. 33198f70928Sjeremy.It Ev MODRUBY_RELEXAMPLEDIR 33298f70928SjeremyThe relative path under 33398f70928Sjeremy.Ev PREFIX 33498f70928Sjeremywhere the package installs example files for non-Ruby gem ports. 33598f70928Sjeremy.It Ev MODRUBY_REV 33698f70928SjeremyIncludes the major and minor versions of the version of Ruby in use, 33798f70928Sjeremyseparated by a dot 33898f70928Sjeremy.Pq Ql \&. . 33998f70928SjeremyThe port can override the value to specify which Ruby version to use, 34098f70928Sjeremyif the port sets or defaults to 34198f70928Sjeremy.Ev MODRUBY_HANDLE_FLAVORS Ns =Yes . 34298f70928Sjeremy.It Ev MODRUBY_RUBY_ADJ 34398f70928SjeremyA command that takes filename arguments and replaces 34498f70928Sjeremythe 34598f70928Sjeremy.Pa /usr/bin/env 34698f70928Sjeremyruby shebang lines with 34798f70928Sjeremy.Ev RUBY . 34898f70928Sjeremy.It Ev MODRUBY_RUN_DEPENDS 34998f70928SjeremyThe port path for the Ruby version in use. 35098f70928SjeremyIt is designed to be used in 35198f70928Sjeremy.Ev RUN_DEPENDS 35298f70928Sjeremyvalues for other ports depending on Ruby. 35398f70928Sjeremy.It Ev MODRUBY_RUNDEP 35498f70928SjeremyIf the packages do not depend on Ruby at runtime, set to 35598f70928Sjeremy.Cm \&No . 35698f70928SjeremyThe default is 35798f70928Sjeremy.Cm Yes . 35898f70928Sjeremy.It Ev MODRUBY_SITEARCHDIR 35998f70928SjeremyThe relative path under 36098f70928Sjeremy.Ev PREFIX 36198f70928Sjeremywhere the package installs platform-specific library files for non-Ruby gem 36298f70928Sjeremyports. 36398f70928Sjeremy.It Ev MODRUBY_SITEDIR 36498f70928SjeremyThe relative path under 36598f70928Sjeremy.Ev PREFIX 36698f70928Sjeremywhere the package installs non-platform-specific library files for non-Ruby 36798f70928Sjeremygem ports. 36898f70928Sjeremy.It Ev MODRUBY_TEST 36998f70928SjeremySet to 37098f70928Sjeremy.Cm ruby , 37198f70928Sjeremy.Cm rake , 37298f70928Sjeremy.Cm rspec3 , 37398f70928Sjeremyor 37498f70928Sjeremy.Cm testrb 37598f70928Sjeremyto choose the appropriate program to run the regress tests, if the port 37698f70928Sjeremyincludes tests. 37798f70928Sjeremy.It Ev MODRUBY_TEST_ENV 37898f70928SjeremySets environment variables for the regress tests. 37998f70928Sjeremy.It Ev MODRUBY_TEST_TARGET 38098f70928SjeremySets the argument to the regress test program. 38198f70928Sjeremy.It Ev MODRUBY_WANTLIB 38298f70928SjeremyIncludes the library-specs for the Ruby version in use. 38398f70928Sjeremy.It Ev RAKE 38498f70928SjeremyThe path to the 38598f70928Sjeremy.Sy rake 38698f70928Sjeremyprogram for the Ruby version in use (/usr/local/bin/rake${MODRUBY_BINREV}). 38798f70928Sjeremy.It Ev RUBY 38898f70928SjeremyThe path to the 38998f70928Sjeremy.Xr ruby 1 39098f70928Sjeremyprogram for the Ruby version in use (/usr/local/bin/ruby${MODRUBY_BINREV}). 39198f70928Sjeremy.El 392de9e3489Sespie.Sh SEE ALSO 39398f70928Sjeremy.Xr bsd.port.mk 5 , 394de9e3489Sespie.Xr port-modules 5 395