2 # bsd.ruby.mk - Utility definitions for Ruby related ports.
4 # Created by: Akinori MUSHA <knu@FreeBSD.org>
9 .if !defined(Ruby_Include)
11 Ruby_Include= bsd.ruby.mk
12 Ruby_Include_MAINTAINER= ruby@FreeBSD.org
15 # [variables that a user may define]
17 # RUBY_VER - (See below)
18 # RUBY_DEFAULT_VER - Set to (e.g.) "1.9" if you want to refer to "ruby19"
20 # RUBY_ARCH - (See below)
21 # RUBY_RD_HTML - Define if you want HTML files generated from RD files.
24 # [variables that each port can define]
26 # RUBY - Set to full path of ruby. If you set this, the values
27 # of the following variables are automatically obtained
28 # from the ruby executable: RUBY_VER, RUBY_VERSION,
29 # RUBY_NAME, RUBY_ARCH, RUBY_LIBDIR, RUBY_ARCHLIBDIR,
30 # RUBY_SITELIBDIR, and RUBY_SITEARCHLIBDIR.
31 # RUBY_VER - Set to the alternative short version of ruby in the
32 # form of `x.y' (see below for current value).
33 # USE_RUBY - Says that the port uses ruby for building and running.
34 # RUBY_NO_BUILD_DEPENDS - Says that the port should not build-depend on ruby.
35 # RUBY_NO_RUN_DEPENDS - Says that the port should not run-depend on ruby.
36 # USE_LIBRUBY - Says that the port uses libruby.
37 # USE_RUBY_EXTCONF - Says that the port uses extconf.rb to configure.
39 # RUBY_EXTCONF - Set to the alternative name of extconf.rb
40 # (default: extconf.rb).
41 # RUBY_EXTCONF_SUBDIRS - Set to list of subdirectories, if multiple modules
43 # USE_RUBY_SETUP - Says that the port uses setup.rb to configure and
45 # RUBY_SETUP - Set to the alternative name of setup.rb
46 # (default: setup.rb).
47 # USE_RUBY_RDTOOL - Says that the port uses rdtool to generate documents.
48 # USE_RUBY_RDOC - Says that the port uses rdoc to generate documents.
49 # USE_RUBY_FEATURES - Says that the port requires some of the following
50 # features for building and/or running (default: none):
52 # RUBY_REQUIRE - Set to a Ruby expression to evaluate before building
53 # the port. The constant "Ruby" is set to the integer
54 # version number of ruby, and the result of the
55 # expression will be set to RUBY_PROVIDED, which is
56 # left undefined if the result is nil, false or a
57 # zero-length string. Implies USE_RUBY.
58 # RUBY_SHEBANG_FILES - Specify the files which shebang lines you want to fix.
59 # RUBY_RD_FILES - Specify the RD files which you want to generate HTML
60 # documents from. If this is defined and not empty,
61 # USE_RUBY_RDTOOL is implied and RUBY_RD_HTML_FILES is
63 # USE_RUBYGEMS - Says that the port uses rubygems packaging system.
64 # RUBYGEM_AUTOPLIST - Generate packing list for rubygems based port
68 # [variables that each port should not (re)define]
70 # RUBY_PKGNAMEPREFIX - Common PKGNAMEPREFIX for ruby ports
71 # (default: ruby${RUBY_SUFFIX}-)
72 # RUBY_RELVERSION - Full version of ruby without preview/beta suffix in
73 # the form of `x.y.z' (see below for current value).
74 # RUBY_RELVERSION_CODE - Integer version of RUBY_RELVERSION in the form of
76 # RUBY_VERSION - Composite version of RUBY_RELVERSION and
77 # RUBY_PATCHLEVEL in the form of `x.y.z.p'.
78 # (default: ${RUBY_RELVERSION}.${RUBY_PATCHLEVEL})
79 # RUBY_VERSION_CODE - Composite integer version of RUBY_VERSION in the form
81 # RUBY_PORTVERSION - PORTVERSION for the standard ruby ports (ruby,
83 # RUBY_PORTREVISION - PORTREVISION for the standard ruby ports.
84 # RUBY_PORTEPOCH - PORTEPOCH for the standard ruby ports.
85 # RUBY_DISTNAME - DISTNAME for the standard ruby ports, i.e. the
86 # basename of the ruby distribution tarball.
87 # RUBY_DISTVERSION - The version number part of RUBY_DISTNAME.
88 # RUBY_PATCHFILES - PATCHFILES for the standard ruby ports, i.e. the
89 # basename of the ruby distribution tarball.
90 # RUBY_WRKSRC - WRKSRC for the ruby port.
91 # MASTER_SITE_SUBDIR_RUBY - MASTER_SITE_SUBDIR for the ruby distfiles.
93 # RUBY_SHLIBVER - Major version of libruby (see below for current
95 # RUBY_ARCH - Set to target architecture name.
96 # (e.g. i386-freebsd7)
97 # RUBY_SUFFIX - Suffix for ruby binaries and directories
98 # (${RUBY_VER:S/.//}).
99 # RUBY_WITHOUT_SUFFIX - Always ${LOCALBASE}/bin/ruby.
100 # RUBY_WITH_SUFFIX - Always ${RUBY_WITHOUT_SUFFIX}${RUBY_SUFFIX}.
101 # RUBY_NAME - Ruby's name with trailing suffix.
103 # RUBY_MODNAME - Set to the module name (default: ${PORTNAME}).
105 # RUBY_RD2 - Full path of rd2 executable.
106 # RUBY_RDOC - Full path of rdoc executable.
108 # RUBY_BASE_PORT - Port path of base ruby without PORTSDIR, without
109 # suffix except version.
110 # RUBY_PORT - Port path of ruby without PORTSDIR.
111 # RUBY_RDTOOL_PORT - Port path of rdtool without PORTSDIR.
112 # RUBY_RDOC_PORT - Port path of rdoc without PORTSDIR.
113 # RUBY_ICONV_PORT - Port path of ruby-iconv without PORTSDIR.
115 # DEPEND_LIBRUBY - LIB_DEPENDS entry for libruby.
116 # DEPEND_RUBY - BUILD_DEPENDS/RUN_DEPENDS entry for ruby.
117 # DEPEND_RUBY_RDTOOL - BUILD_DEPENDS entry for rdtool.
118 # DEPEND_RUBY_RDOC - BUILD_DEPENDS entry for rdoc.
119 # DEPEND_RUBY_ICONV - BUILD_DEPENDS/RUN_DEPENDS entry for ruby-iconv.
121 # RUBY_LIBDIR - Installation path for architecture independent
123 # RUBY_ARCHLIBDIR - Installation path for architecture dependent
125 # RUBY_SITELIBDIR - Installation path for site architecture independent
127 # RUBY_SITEARCHLIBDIR - Installation path for site architecture dependent
129 # RUBY_DOCDIR - Installation path for documents.
130 # RUBY_EXAMPLESDIR - Installation path for examples.
131 # RUBY_RIDIR - Installation path for site architecture independent ri
133 # RUBY_SITERIDIR - Installation path for site architecture dependent ri
135 # RUBY_MODDOCDIR - Installation path for the module's documents.
136 # RUBY_MODEXAMPLESDIR - Installation path for the module's examples.
137 # RUBY_ELISPDIR - Installation path for emacs lisp files.
140 .include "${PORTSDIR}/Mk/bsd.default-versions.mk"
142 .if defined(RUBY_DEFAULT_VER)
143 WARNING+= "RUBY_DEFAULT_VER is defined, consider using DEFAULT_VERSIONS=ruby=${RUBY_DEFAULT_VER} instead"
146 RUBY_DEFAULT_VER?= ${RUBY_DEFAULT}
148 RUBY_VER?= ${RUBY_DEFAULT_VER}
152 IGNORE= cannot install: you set the variable RUBY to "${RUBY}", but it does not seem to exist. Please specify an already installed ruby executable.
155 _RUBY_TEST!= ${RUBY} -e 'begin; require "rbconfig"; puts "ok" ; rescue LoadError; puts "error"; end'
156 .if !empty(_RUBY_TEST) && ${_RUBY_TEST} != "ok"
157 IGNORE= cannot install: you set the variable RUBY to "${RUBY}", but it failed to include rbconfig. Please specify a properly installed ruby executable.
160 _RUBY_CONFIG= ${RUBY} -r rbconfig -e 'C = RbConfig::CONFIG' -e
162 RUBY_VERSION!= ${_RUBY_CONFIG} 'puts C["ruby_version"]'
163 RUBY_SUFFIX?= # empty
165 RUBY_ARCH!= ${_RUBY_CONFIG} 'puts C["target"]'
166 RUBY_NAME!= ${_RUBY_CONFIG} 'puts C["ruby_install_name"]'
168 _RUBY_SYSLIBDIR!= ${_RUBY_CONFIG} 'puts C["libdir"]'
169 _RUBY_SITEDIR!= ${_RUBY_CONFIG} 'puts C["sitedir"]'
170 _RUBY_VENDORDIR!= ${_RUBY_CONFIG} 'puts C["vendordir"]'
172 RUBY?= ${LOCALBASE}/bin/${RUBY_NAME}
174 .if defined(RUBY_VER)
175 . if ${RUBY_VER} == 1.9
179 RUBY_RELVERSION= 1.9.3
191 . elif ${RUBY_VER} == 2.0
195 RUBY_RELVERSION= 2.0.0
207 . elif ${RUBY_VER} == 2.1
211 RUBY_RELVERSION= 2.1.1
227 IGNORE= Only ruby 1.9, 2.0 and 2.1 are supported
229 .endif # defined(RUBY_VER)
231 .if ${RUBY_PATCHLEVEL} == 0
232 RUBY_VERSION?= ${RUBY_RELVERSION}
233 RUBY_DISTVERSION?= ${RUBY_RELVERSION}
235 RUBY_VERSION?= ${RUBY_RELVERSION}.${RUBY_PATCHLEVEL}
236 RUBY_DISTVERSION?= ${RUBY_RELVERSION}-p${RUBY_PATCHLEVEL}
239 RUBY_WRKSRC= ${WRKDIR}/ruby-${RUBY_DISTVERSION}
241 RUBY_CONFIGURE_ARGS+= --with-rubyhdrdir="${PREFIX}/include/ruby-${RUBY_VER}/" \
242 --with-rubylibprefix="${PREFIX}/lib/ruby" \
243 --docdir="${RUBY_DOCDIR}" \
244 --with-soname=ruby${RUBY_SUFFIX}
246 CONFIGURE_TARGET?= ${ARCH}-portbld-${OPSYS:tl}${OSREL:C/\..*//}
248 RUBY_ARCH?= ${ARCH}-${OPSYS:tl}${OSREL:C/\..*//}
249 RUBY_NAME?= ruby${RUBY_SUFFIX}
251 _RUBY_SYSLIBDIR?= ${PREFIX}/lib
252 _RUBY_SITEDIR?= ${_RUBY_SYSLIBDIR}/ruby/site_ruby
253 _RUBY_VENDORDIR?= ${_RUBY_SYSLIBDIR}/ruby/vendor_ruby
257 .if defined(LANG) && !empty(LANG)
258 GEM_ENV+= LANG=${LANG}
260 GEM_ENV+= LANG=en_US.UTF-8
263 .if defined(LC_ALL) && !empty(LC_ALL)
264 GEM_ENV+= LC_ALL=${LC_ALL}
266 GEM_ENV+= LC_ALL=en_US.UTF-8
269 .if defined(LC_CTYPE) && !empty(LC_CTYPE)
270 GEM_ENV+= LC_CTYPE=${LC_CTYPE}
272 GEM_ENV+= LC_CTYPE=UTF-8
275 RUBY_DEFAULT_SUFFIX?= ${RUBY_DEFAULT_VER:S/.//}
277 RUBY_DISTVERSION?= ${RUBY_VERSION}
278 RUBY_PORTVERSION?= ${RUBY_VERSION}
279 MASTER_SITE_SUBDIR_RUBY?= ${RUBY_VER}
280 RUBY_DISTNAME?= ruby-${RUBY_DISTVERSION}
282 RUBY_WRKSRC?= ${WRKDIR}/${RUBY_DISTNAME}
284 RUBY_RELVERSION_CODE?= ${RUBY_RELVERSION:S/.//g}
285 RUBY_VERSION_CODE?= ${RUBY_VERSION:S/.//g}
286 RUBY_VER= ${RUBY_VERSION:C/([[:digit:]]+\.[[:digit:]]+).*/\1/}
287 RUBY_SUFFIX= ${RUBY_VER:S/.//}
289 RUBY_WITHOUT_SUFFIX?= ${LOCALBASE}/bin/ruby
290 RUBY_WITH_SUFFIX?= ${RUBY_WITHOUT_SUFFIX}${RUBY_SUFFIX}
292 RUBY_PKGNAMEPREFIX?= ruby${RUBY_SUFFIX}-
293 RUBY_SHLIBVER?= ${RUBY_VER:S/.//}
295 RUBY_CONFIGURE_ARGS+= --program-prefix=""
297 DEPENDS_ARGS+= RUBY_VER="${RUBY_VER}"
299 RUBY_CONFIGURE_ARGS+= --program-suffix="${RUBY_SUFFIX}"
301 RUBY_MODNAME?= ${PORTNAME}
304 RUBY_RD2?= ${LOCALBASE}/bin/rd2
305 RUBY_RDOC?= ${LOCALBASE}/bin/rdoc${RUBY_VER:S/.//}
308 RUBY_BASE_PORT?= lang/ruby${RUBY_VER:S/.//}
309 RUBY_PORT?= ${RUBY_BASE_PORT}
310 RUBY_RDTOOL_PORT?= textproc/ruby-rdtool
311 RUBY_RDOC_PORT?= textproc/ruby-rdoc
312 RUBY_ICONV_PORT?= converters/ruby-iconv
315 DEPEND_LIBRUBY?= ${RUBY_NAME}.${RUBY_SHLIBVER}:${PORTSDIR}/${RUBY_PORT}
316 DEPEND_RUBY?= ${RUBY}:${PORTSDIR}/${RUBY_PORT}
317 DEPEND_RUBY_RDTOOL?= ${RUBY_RD2}:${PORTSDIR}/${RUBY_RDTOOL_PORT}
318 DEPEND_RUBY_ICONV= ${RUBY_ARCHLIBDIR}/iconv.so:${PORTSDIR}/${RUBY_ICONV_PORT}
321 RUBY_LIBDIR?= ${_RUBY_SYSLIBDIR}/ruby/${RUBY_VER}
322 RUBY_ARCHLIBDIR?= ${RUBY_LIBDIR}/${RUBY_ARCH}
323 RUBY_SITELIBDIR?= ${_RUBY_SITEDIR}/${RUBY_VER}
324 RUBY_SITEARCHLIBDIR?= ${RUBY_SITELIBDIR}/${RUBY_ARCH}
325 RUBY_VENDORLIBDIR?= ${_RUBY_VENDORDIR}/${RUBY_VER}
326 RUBY_VENDORARCHLIBDIR?= ${RUBY_VENDORLIBDIR}/${RUBY_ARCH}
327 RUBY_DOCDIR?= ${PREFIX}/share/doc/${RUBY_NAME}
328 RUBY_EXAMPLESDIR?= ${PREFIX}/share/examples/${RUBY_NAME}
329 RUBY_RIDIR?= ${PREFIX}/share/ri/${RUBY_VER}/system
330 RUBY_SITERIDIR?= ${PREFIX}/share/ri/${RUBY_VER}/site
331 RUBY_MODDOCDIR?= ${RUBY_DOCDIR}/${RUBY_MODNAME}
332 RUBY_MODEXAMPLESDIR?= ${RUBY_EXAMPLESDIR}/${RUBY_MODNAME}
333 RUBY_ELISPDIR?= ${PREFIX}/lib/ruby/elisp
336 PLIST_RUBY_DIRS= RUBY_LIBDIR="${RUBY_LIBDIR}" \
337 RUBY_ARCHLIBDIR="${RUBY_ARCHLIBDIR}" \
338 RUBY_SITELIBDIR="${RUBY_SITELIBDIR}" \
339 RUBY_SITEARCHLIBDIR="${RUBY_SITEARCHLIBDIR}" \
340 RUBY_VENDORLIBDIR="${RUBY_VENDORLIBDIR}" \
341 RUBY_VENDORARCHLIBDIR="${RUBY_VENDORARCHLIBDIR}" \
342 RUBY_MODDOCDIR="${RUBY_MODDOCDIR}" \
343 RUBY_MODEXAMPLESDIR="${RUBY_MODEXAMPLESDIR}" \
344 RUBY_DOCDIR="${RUBY_DOCDIR}" \
345 RUBY_EXAMPLESDIR="${RUBY_EXAMPLESDIR}" \
346 RUBY_RIDIR="${RUBY_RIDIR}" \
347 RUBY_SITERIDIR="${RUBY_SITERIDIR}" \
348 RUBY_ELISPDIR="${RUBY_ELISPDIR}"
350 PLIST_SUB+= ${PLIST_RUBY_DIRS:C,DIR="(${LOCALBASE}|${PREFIX})/,DIR=",} \
351 RUBY_VERSION="${RUBY_VERSION}" \
352 RUBY_VER="${RUBY_VER}" \
353 RUBY_SHLIBVER="${RUBY_SHLIBVER}" \
354 RUBY_ARCH="${RUBY_ARCH}" \
355 RUBY_SUFFIX="${RUBY_SUFFIX}" \
356 RUBY_NAME="${RUBY_NAME}" \
357 RUBY_DEFAULT_SUFFIX="${RUBY_DEFAULT_SUFFIX}" \
362 .if defined(USE_RUBY_RDOC)
363 MAKE_ENV+= RUBY_RDOC=${RUBY_RDOC}
367 .if defined(RUBY_REQUIRE)
371 RUBY_PROVIDED!= ${RUBY} -e '\
372 Ruby = ${RUBY_RELVERSION_CODE}; \
373 value = begin; ${RUBY_REQUIRE}; end and puts value'
375 RUBY_PROVIDED= "should be" # the latest version is going to be installed
378 .if empty(RUBY_PROVIDED)
384 .if defined(RUBY_SHEBANG_FILES) && !empty(RUBY_SHEBANG_FILES)
387 post-patch: ruby-shebang-patch
390 @cd ${WRKSRC}; for f in ${RUBY_SHEBANG_FILES}; do \
391 ${ECHO_MSG} "===> Fixing the #! line of $$f"; \
392 TMPFILE=`mktemp -t rubyshebang`; \
394 ${AWK} 'BEGIN {flag = 0;} \
398 sub(/#!(.*\/)?(env[[:space:]]+)?ruby/, "#!${RUBY}", $$0);\
409 }' $$TMPFILE > $$f; \
414 .if ${PORT_OPTIONS:MDEBUG}
421 .if defined(USE_RUBYGEMS)
423 BUILD_DEPENDS+= ${RUBYGEMBIN}:${PORTSDIR}/devel/ruby-gems
424 RUN_DEPENDS+= ${RUBYGEMBIN}:${PORTSDIR}/devel/ruby-gems
426 PKGNAMEPREFIX?= rubygem-
431 EXTRACT_DEPENDS+= ${RUBYGEMBIN}:${PORTSDIR}/devel/ruby-gems
432 GEMS_BASE_DIR= lib/ruby/gems/${RUBY_VER}
433 GEMS_DIR= ${GEMS_BASE_DIR}/gems
434 DOC_DIR= ${GEMS_BASE_DIR}/doc
435 CACHE_DIR= ${GEMS_BASE_DIR}/cache
436 SPEC_DIR= ${GEMS_BASE_DIR}/specifications
437 GEM_NAME?= ${PORTNAME}-${PORTVERSION}
438 GEM_LIB_DIR?= ${GEMS_DIR}/${GEM_NAME}
439 GEM_DOC_DIR?= ${DOC_DIR}/${GEM_NAME}
440 GEM_SPEC?= ${SPEC_DIR}/${GEM_NAME}.gemspec
441 GEM_CACHE?= ${CACHE_DIR}/${GEM_NAME}.gem
443 PLIST_SUB+= PORTVERSION="${PORTVERSION}" \
445 GEMS_BASE_DIR="lib/ruby/gems/${RUBY_VER}" \
446 GEMS_DIR="${GEMS_DIR}" \
447 DOC_DIR="${DOC_DIR}" \
448 CACHE_DIR="${CACHE_DIR}" \
449 SPEC_DIR="${SPEC_DIR}" \
450 PORT="${PORTNAME}-${PORTVERSION}" \
451 GEM_NAME="${GEM_NAME}" \
452 GEM_LIB_DIR="${GEM_LIB_DIR}" \
453 GEM_DOC_DIR="${GEM_DOC_DIR}" \
454 GEM_SPEC="${GEM_SPEC}" \
455 GEM_CACHE="${GEM_CACHE}" \
456 EXTRACT_SUFX="${EXTRACT_SUFX}"
458 RUBYGEMBIN= ${LOCALBASE}/bin/gem${RUBY_VER:S/.//}
460 . if defined(DISTFILES)
461 GEMFILES= ${DISTFILES:C/:[^:]+$//}
463 GEMFILES= ${DISTNAME}${EXTRACT_SUFX}
466 RUBYGEM_ARGS=-l --no-update-sources --no-ri --install-dir ${STAGEDIR}${PREFIX}/lib/ruby/gems/${RUBY_VER} --ignore-dependencies --bindir=${STAGEDIR}${PREFIX}/bin
467 GEM_ENV+= RB_USER_INSTALL=yes
468 .if defined(NOPORTDOCS)
469 RUBYGEM_ARGS+= --no-rdoc
473 @${SETENV} ${GEM_ENV} ${RUBYGEMBIN} unpack --target=${WRKDIR} ${DISTDIR}/${DIST_SUBDIR}/${GEMFILES}
474 @${TAR} -xOzf ${DISTDIR}/${DIST_SUBDIR}/${GEMFILES} metadata.gz | ${GZCAT} > ${BUILD_WRKSRC}/${GEMFILES}spec
477 @(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} build --force ${GEMFILES}spec ; then \
478 if [ -n "${BUILD_FAIL_MESSAGE}" ] ; then \
479 ${ECHO_MSG} "===> Compilation failed unexpectedly."; \
480 (${ECHO_CMD} "${BUILD_FAIL_MESSAGE}") | ${FMT} 75 79 ; \
486 @(cd ${BUILD_WRKSRC}; ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} install ${RUBYGEM_ARGS} ${GEMFILES} -- --build-args ${CONFIGURE_ARGS})
488 . if defined(RUBYGEM_AUTOPLIST)
489 . if !target(post-install-script)
491 @${ECHO} ${GEM_CACHE} >> ${TMPPLIST}
492 @${ECHO} ${GEM_SPEC} >> ${TMPPLIST}
493 .if !defined(NOPORTDOCS)
494 @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_DOC_DIR} -type f -print | ${SED} -E -e \
495 's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST}
496 @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_DOC_DIR} -type d -print | ${SED} -E -e \
497 's,^${STAGEDIR}${PREFIX}/?,@dirrm ,' >> ${TMPPLIST}
499 @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_LIB_DIR} -type f -print | ${SED} -E -e \
500 's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST}
501 @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_LIB_DIR} -type d -print | ${SED} -E -e \
502 's,^${STAGEDIR}${PREFIX}/?,@dirrm ,' >> ${TMPPLIST}
503 @${ECHO_CMD} "@unexec rmdir %D/${GEMS_DIR} 2>/dev/null || true" >> ${TMPPLIST}
504 .if !defined(NOPORTDOCS)
505 @${ECHO_CMD} "@unexec rmdir %D/${DOC_DIR} 2>/dev/null || true" >> ${TMPPLIST}
507 @${ECHO_CMD} "@unexec rmdir %D/${CACHE_DIR} 2>/dev/null || true" >> ${TMPPLIST}
508 @${ECHO_CMD} "@unexec rmdir %D/${SPEC_DIR} 2>/dev/null || true" >> ${TMPPLIST}
509 @${ECHO_CMD} "@unexec rmdir %D/${GEMS_BASE_DIR} 2>/dev/null || true" >> ${TMPPLIST}
510 @${ECHO_CMD} "@unexec rmdir %D/lib/ruby/gems 2>/dev/null || true" >> ${TMPPLIST}
511 @${ECHO_CMD} "@unexec rmdir %D/lib/ruby 2>/dev/null || true" >> ${TMPPLIST}
515 .endif # USE_RUBYGEMS
520 .if defined(USE_RUBY_EXTCONF)
523 RUBY_EXTCONF?= extconf.rb
524 CONFIGURE_ARGS+= --with-opt-dir="${LOCALBASE}"
526 do-configure: ruby-extconf-configure
528 ruby-extconf-configure:
529 .if defined(RUBY_EXTCONF_SUBDIRS)
530 .for d in ${RUBY_EXTCONF_SUBDIRS}
531 @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} in ${d} to configure"
532 @cd ${CONFIGURE_WRKSRC}/${d}; \
533 ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_EXTCONF} ${CONFIGURE_ARGS}
536 @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} to configure"
537 @cd ${CONFIGURE_WRKSRC}; \
538 ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_EXTCONF} ${CONFIGURE_ARGS}
545 .if defined(USE_RUBY_SETUP)
546 RUBY_SETUP?= setup.rb
548 do-configure: ruby-setup-configure
550 ruby-setup-configure:
551 @${ECHO_MSG} "===> Running ${RUBY_SETUP} to configure"
552 @cd ${BUILD_WRKSRC}; \
553 ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} config ${CONFIGURE_ARGS}
555 do-build: ruby-setup-build
558 @${ECHO_MSG} "===> Running ${RUBY_SETUP} to build"
559 @cd ${BUILD_WRKSRC}; \
560 ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} setup
562 do-install: ruby-setup-install
565 @${ECHO_MSG} "===> Running ${RUBY_SETUP} to install"
566 @cd ${INSTALL_WRKSRC}; \
567 ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} install --prefix=${STAGEDIR}
570 .if defined(USE_LIBRUBY)
571 LIB_DEPENDS+= ${DEPEND_LIBRUBY}
574 .if defined(USE_RUBY)
575 .if !defined(RUBY_NO_BUILD_DEPENDS)
576 EXTRACT_DEPENDS+= ${DEPEND_RUBY}
577 PATCH_DEPENDS+= ${DEPEND_RUBY}
578 BUILD_DEPENDS+= ${DEPEND_RUBY}
580 .if !defined(RUBY_NO_RUN_DEPENDS)
581 RUN_DEPENDS+= ${DEPEND_RUBY}
585 .if defined(USE_RUBY_FEATURES)
587 _use= ${USE_RUBY_FEATURES:Miconv}
589 .if (${RUBY_VER} == 1.9)
590 BUILD_DEPENDS+= ${DEPEND_RUBY_ICONV}
591 RUN_DEPENDS+= ${DEPEND_RUBY_ICONV}
598 .if defined(USE_RAKE)
599 BUILD_DEPENDS+= ${LOCALBASE}/bin/rake:${PORTSDIR}/devel/rubygem-rake
600 RAKE_BIN= ${LOCALBASE}/bin/rake
607 .if defined(RUBY_RD_HTML)
608 .undef RUBY_NO_RD_HTML
611 .if defined(NOPORTDOCS)
615 .if defined(RUBY_RD_FILES) && !defined(RUBY_NO_RD_HTML)
618 RUBY_RD_HTML_FILES= ${RUBY_RD_FILES:S/.rb$//:S/.rd././:S/.rd$//:S/$/.html/}
620 PLIST_SUB+= RUBY_RD_HTML_FILES=""
622 pre-install: ruby-rd-build
625 .if !empty(RUBY_RD_FILES)
626 @${ECHO_MSG} "===> Generating HTML documents from RD documents"
627 @cd ${WRKSRC}; for rd in ${RUBY_RD_FILES}; do \
628 html=$$(echo $$rd | ${SED} 's/\.rb$$//;s/\.rd\././;s/\.rd$$//').html; \
629 ${ECHO_MSG} "${RUBY_RD2} $$rd > $$html"; \
630 ${RUBY_RD2} $$rd > $$html; \
637 RUBY_RD_HTML_FILES= # empty
639 PLIST_SUB+= RUBY_RD_HTML_FILES="@comment "
642 .if !defined(NOPORTDOCS) && defined(USE_RUBY_RDTOOL)
643 BUILD_DEPENDS+= ${DEPEND_RUBY_RDTOOL}