1.\" $OpenBSD: ruby-module.5,v 1.14 2014/10/17 17:09:50 jasper Exp $ 2.\" 3.\" Copyright (c) 2008 Marc Espie, Jeremy Evans 4.\" 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd $Mdocdate: October 17 2014 $ 28.Dt RUBY-MODULE 5 29.Os 30.Sh NAME 31.Nm ruby-module 32.Nd lang/ruby port module 33.Sh DESCRIPTION 34This manual page documents the behavior of setting 35.Li MODULE=lang/ruby 36in the 37.Xr ports 7 38tree. 39.Pp 40Sets 41.Ev MODRUBY_REV , 42.Ev RUBY , 43.Ev RAKE , 44.Ev RSPEC , 45.Ev MODRUBY_BIN_TESTRB , 46.Ev MODRUBY_BIN_RSPEC , 47.Ev MODRUBY_WANTLIB , 48.Ev MODRUBY_RUN_DEPENDS , 49.Ev MODRUBY_LIB_DEPENDS , 50.Ev MODRUBY_BUILD_DEPENDS , 51.Ev MODRUBY_ICONV_DEPENDS , 52.Ev MODRUBY_RAKE_DEPENDS , 53.Ev MODRUBY_RSPEC_DEPENDS , 54.Ev MODRUBY_RSPEC3_DEPENDS , 55.Ev MODRUBY_RUBY_ADJ , 56.Ev MODRUBY_ADJ_FILES , 57.Ev MODRUBY_LIBDIR , 58.Ev MODRUBY_DOCDIR , 59.Ev MODRUBY_SITEARCHDIR , 60.Ev MODRUBY_SITEDIR , 61.Ev MODRUBY_EXAMPLEDIR , 62.Ev MODRUBY_ARCH , 63.Ev MODRUBY_LIBREV , 64.Ev MODRUBY_BINREV , 65.Ev MODRUBY_HANDLE_FLAVORS , 66.Ev MODRUBY_PKG_PREFIX , 67.Ev MODRUBY_FLAVOR , 68.Ev MODRUBY_TEST , 69.Ev MODRUBY_TEST_TARGET , 70.Ev MODRUBY_TEST_DIR , 71.Ev MODRUBY_TEST_ENV , 72.Ev MODRUBY_BUILD_TARGET , 73.Ev MODRUBY_INSTALL_TARGET , 74.Ev MODRUBY_EXTRACT_TARGET , 75.Ev GEM , 76.Ev GEM_BIN , 77.Ev GEM_LIB , 78.Ev GEM_BASE_LIB , 79.Ev GEM_ABS_PATH , 80.Ev GEM_BASE_BIN , 81.Ev GEM_BIN_SUFFIX , 82.Ev GEM_MAN_SUFFIX , 83and 84.Ev GEM_FLAGS . 85.Pp 86Appends to 87.Ev CATEGORIES 88and 89.Ev SUBST_VARS . 90Appends to 91.Ev BUILD_DEPENDS 92unless 93.Ev MODRUBY_BUILDDEP 94is set to No or 95.Ev NO_BUILD 96is set to Yes. 97Appends to 98.Ev RUN_DEPENDS 99unless 100.Ev MODRUBY_RUNDEP 101is set to No. 102.Pp 103.Ev MODRUBY_ICONV_DEPENDS 104is set to the dependency line for the iconv port for the version of ruby in 105use. 106.Ev MODRUBY_RAKE_DEPENDS 107is set to the dependency line for the rake port for the version of ruby in 108use. 109.Ev MODRUBY_RSPEC_DEPENDS 110is set to the dependency line for the rspec 1 port for the version of ruby in 111use. 112.Ev MODRUBY_RSPEC3_DEPENDS 113is set to the dependency line for the rspec 3 port for the version of ruby in 114use. 115.Ev RUBY , 116.Ev RAKE , 117and 118.Ev MODRUBY_BIN_TESTRB 119are the path to the ruby, rake, and 120testrb binaries for the related ruby implementation. 121.Ev RSPEC 122and 123.Ev MODRUBY_BIN_RSPEC 124are the path to the spec (rspec 1) and 125rspec (rspec 2 and 3) binaries for the related ruby implementation. 126.Pp 127.Ev MODRUBY_RUBY_ADJ 128is a command that takes filename arguments and replaces 129the /usr/bin/env ruby shebang lines with 130.Ev RUBY . 131.Ev MODRUBY_ADJ_FILES 132is a list of filename patterns that will automatically have 133.Ev MODRUBY_RUBY_ADJ 134called on them during pre-configure. 135.Pp 136Creates a do-test target if 137.Ev MODRUBY_TEST 138is used and one is not already defined. 139.Ev MODRUBY_TEST 140can be set to ruby, rake, rspec, rspec3, or testrb to 141choose the appropriate binary to run the regress tests. 142.Ev MODRUBY_TEST_ENV 143can be used to set environment variables for the regress tests. 144.Ev MODRUBY_TEST_DIR 145can be used to set the directory in which to execute 146the regress tests, it defaults to 147.Ev WRKSRC . 148.Ev MODRUBY_TEST_TARGET 149sets the argument to the regress test program. 150.Pp 151Supports additional 152.Ev CONFIGURE_STYLE Ns s , 153and setting specific 154.Ev CONFIGURE_STYLE Ns s 155modifies some additional parameters: 156.Bl -bullet 157.It 158The "ruby gem" 159.Ev CONFIGURE_STYLE 160should be used for pure ruby gems without C extensions. 161This adds 162.Ev PKG_ARCH 163= * and adds ruby18, ruby19, ruby20, ruby21, rbx, and jruby 164.Ev FLAVOR Ns s 165to the port, so the same port can build packages for multiple versions of ruby. 166.It 167The "ruby gem ext" 168.Ev CONFIGURE_STYLE 169should be used for ruby gems with C extensions. 170This adds 171.Ev SHARED_ONLY Ns =Yes 172and adds 173.Ev MODRUBY_LIB_DEPENDS 174to 175.Ev LIB_DEPENDS 176and 177the appropriate libraries and 178.Ev MODRUBY_WANTLIB 179to 180.Ev WANTLIB . 181It also adds ruby18, ruby19, ruby20, ruby21, and rbx 182.Ev FLAVOR Ns s 183to the port. 184If the C extension in the gem requires specific arguments to extconf.rb, set those 185via 186.Ev CONFIGURE_ARGS . 187.It 188The "ruby extconf" 189.Ev CONFIGURE_STYLE 190is similar to the "ruby gem ext" 191.Ev CONFIGURE_STYLE , 192except that it is used when the package is distributed with an extconf.rb file 193and not as a ruby gem. 194.El 195.Pp 196To ensure that dependencies use the same ruby implementation as the 197current port, all ruby gem/extconf dependencies specified in the port 198should use this format: 199.Pp 200.Dl category/ruby-foo,${MODRUBY_FLAVOR} 201.Pp 202Use of a ruby19, ruby20, ruby21, rbx, or jruby 203.Ev FLAVOR 204causes the 205.Ev FULLPKGNAME 206to use the 207.Ev FLAVOR 208instead of ruby as the package prefix. 209Specifying 210.Ev MODRUBY_FLAVOR 211is necessary so that if a ruby 1.9 package is being built for the current 212port, it depends on the ruby 1.9 package of the 213dependencies. 214.Pp 215The ports system defaults to using ruby 2.0 if the version of ruby is not 216specified. 217If you want to specify a version for a gem/extconf port, use a specific 218.Ev FLAVOR , 219such as ruby18 to use ruby 1.8. 220If you want to specify a version for a non-gem/extconf port, set 221.Ev MODRUBY_REV 222for the version of ruby you want to use (1.8, 1.9, 2.0, 2.1, jruby, rbx). 223.Pp 224If you do not want the ports system to automatically set up 225.Ev FLAVOR Ns s 226when using a gem/extconf port, set 227.Ev MODRUBY_HANDLE_FLAVORS 228to No. 229Similarly, if you want the ports system to automatically set up 230.Ev FLAVOR Ns s 231when using a non-gem/extconf port, set 232.Ev MODRUBY_HANDLE_FLAVORS 233to Yes. 234When 235.Ev MODRUBY_HANDLE_FLAVORS 236is Yes, the ports system automatically adds the appropriate prefix to the 237.Ev FULLPKGNAME 238(e.g. ruby- for ruby 1.8, ruby19- for ruby 1.9). 239Additionally, it adds 240.Ev GEM_BIN_SUFFIX 241and 242.Ev GEM_MAN_SUFFIX 243to 244.Ev SUBST_VARS 245so that the PLISTs will work on multiple ruby versions. 246.Pp 247For ruby gem ports that can work on multiple ruby versions or implementations, 248any binary file entries in the PLIST should be appended with 249.Ev GEM_BIN_SUFFIX . 250This is because the gem binaries for multiple ruby versions are all 251installed to 252.Pa ${LOCALBASE}/bin , 253and ruby 1.9+ installs the binaries with a suffix. 254Any man pages and other files that would be installed to locations not 255specific to a ruby implementation (such as under 256.Pa ${LOCALBASE}/share ) , 257should use 258.Ev GEM_MAN_SUFFIX 259before the extension so the different 260.Ev FLAVOR Ns s 261do not conflict. 262.Pp 263make update-plist may remove 264.Ev GEM_BIN_SUFFIX 265and 266.Ev GEM_MAN_SUFFIX 267from the PLIST, or use them in inappropriate places where they shouldn't be 268used, so be careful when updating gem ports with binaries or man pages. 269Additionally, for gem ports with C extensions, make update-plist will add back 270files used by the specific 271.Ev FLAVOR 272you are using (such as files under the extension source directory), which may 273not exist for other 274.Ev FLAVOR Ns s , 275so always manually check the result of make update-plist and manually test that 276you can build the other 277.Ev FLAVOR Ns s 278before committing. 279.Sh SEE ALSO 280.Xr port-modules 5 281