Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/ruby.mk
- This file was moved from Mk/bsd.ruby.mk.
# | |||||
# bsd.ruby.mk - Utility definitions for Ruby related ports. | |||||
# | |||||
# Created by: Akinori MUSHA <knu@FreeBSD.org> | # Created by: Akinori MUSHA <knu@FreeBSD.org> | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# Provide support for Ruby releated ports. | |||||
.if !defined(Ruby_Include) | |||||
Ruby_Include= bsd.ruby.mk | |||||
Ruby_Include_MAINTAINER= ruby@FreeBSD.org | |||||
# | # | ||||
# Feature: ruby | |||||
# Usage: USES=ruby[:args,..] | |||||
# Valid ARGS: build, extconf, rdoc, run, setup | |||||
# ARGS description: | |||||
# build Says that ruby is required only for build time. | |||||
# extconf Says that the port uses extconf.rb to configure. | |||||
# none Says that no dependency is added to the port. | |||||
# Intended to be used with lang/ruby*. | |||||
# rdoc Says that the port uses rdoc to generate documents. | |||||
# run Says that ruby is required only for run time. | |||||
# setup Says that the port uses setup.rb to configure and | |||||
# build. | |||||
# | |||||
# [variables that a user may define] | # [variables that a user may define] | ||||
# | # | ||||
# RUBY_VER - (See below) | # RUBY_VER - (See below) | ||||
# RUBY_DEFAULT_VER - Set to (e.g.) "2.5" if you want to refer to "ruby25" | # RUBY_DEFAULT_VER - Set to (e.g.) "2.5" if you want to refer to "ruby25" | ||||
# just as "ruby". | # just as "ruby". | ||||
# RUBY_ARCH - (See below) | # RUBY_ARCH - (See below) | ||||
# | # | ||||
# [variables that each port can define] | # [variables that each port can define] | ||||
# | # | ||||
# RUBY - Set to full path of ruby. If you set this, the values | # RUBY - Set to full path of ruby. If you set this, the values | ||||
# of the following variables are automatically obtained | # of the following variables are automatically obtained | ||||
# from the ruby executable: RUBY_VER, RUBY_VERSION, | # from the ruby executable: RUBY_VER, RUBY_VERSION, | ||||
# RUBY_NAME, RUBY_ARCH, RUBY_LIBDIR, RUBY_ARCHLIBDIR, | # RUBY_NAME, RUBY_ARCH, RUBY_LIBDIR, RUBY_ARCHLIBDIR, | ||||
# RUBY_SITELIBDIR, and RUBY_SITEARCHLIBDIR. | # RUBY_SITELIBDIR, and RUBY_SITEARCHLIBDIR. | ||||
# RUBY_VER - Set to the alternative short version of ruby in the | # RUBY_VER - Set to the alternative short version of ruby in the | ||||
# form of `x.y' (see below for current value). | # form of `x.y' (see below for current value). | ||||
# USE_RUBY - Says that the port uses ruby for building and running. | |||||
# RUBY_NO_BUILD_DEPENDS - Says that the port should not build-depend on ruby. | |||||
# RUBY_NO_RUN_DEPENDS - Says that the port should not run-depend on ruby. | |||||
# USE_RUBY_EXTCONF - Says that the port uses extconf.rb to configure. | |||||
# Implies USE_RUBY. | |||||
# RUBY_EXTCONF - Set to the alternative name of extconf.rb | # RUBY_EXTCONF - Set to the alternative name of extconf.rb | ||||
# (default: extconf.rb). | # (default: extconf.rb). | ||||
# RUBY_EXTCONF_SUBDIRS - Set to list of subdirectories, if multiple modules | # RUBY_EXTCONF_SUBDIRS - Set to list of subdirectories, if multiple modules | ||||
# are included. | # are included. | ||||
# USE_RUBY_SETUP - Says that the port uses setup.rb to configure and | |||||
# build. | |||||
# RUBY_SETUP - Set to the alternative name of setup.rb | # RUBY_SETUP - Set to the alternative name of setup.rb | ||||
# (default: setup.rb). | # (default: setup.rb). | ||||
# USE_RUBY_RDOC - Says that the port uses rdoc to generate documents. | |||||
# RUBY_REQUIRE - Set to a Ruby expression to evaluate before building | |||||
# the port. The constant "Ruby" is set to the integer | |||||
# version number of ruby, and the result of the | |||||
# expression will be set to RUBY_PROVIDED, which is | |||||
# left undefined if the result is nil, false or a | |||||
# zero-length string. Implies USE_RUBY. | |||||
# USE_RUBYGEMS - Do not use this -- instead USES=gem | |||||
# | # | ||||
# [variables that each port should not (re)define] | # [variables that each port should not (re)define] | ||||
# | # | ||||
# RUBY_PKGNAMEPREFIX - Common PKGNAMEPREFIX for ruby ports | # RUBY_PKGNAMEPREFIX - Common PKGNAMEPREFIX for ruby ports | ||||
# (default: ruby${RUBY_SUFFIX}-) | # (default: ruby${RUBY_SUFFIX}-) | ||||
# RUBY_VERSION - Full version of ruby without preview/beta suffix in | # RUBY_VERSION - Full version of ruby without preview/beta suffix in | ||||
# the form of `x.y.z' (see below for current value). | # the form of `x.y.z' (see below for current value). | ||||
# RUBY_VERSION_CODE - Integer version of RUBY_VERSION in the form of | # RUBY_VERSION_CODE - Integer version of RUBY_VERSION in the form of | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
# RUBY_EXAMPLESDIR - Installation path for examples. | # RUBY_EXAMPLESDIR - Installation path for examples. | ||||
# RUBY_RIDIR - Installation path for site architecture independent ri | # RUBY_RIDIR - Installation path for site architecture independent ri | ||||
# documents. | # documents. | ||||
# RUBY_SITERIDIR - Installation path for site architecture dependent ri | # RUBY_SITERIDIR - Installation path for site architecture dependent ri | ||||
# documents. | # documents. | ||||
# RUBY_MODDOCDIR - Installation path for the module's documents. | # RUBY_MODDOCDIR - Installation path for the module's documents. | ||||
# RUBY_MODEXAMPLESDIR - Installation path for the module's examples. | # RUBY_MODEXAMPLESDIR - Installation path for the module's examples. | ||||
# | # | ||||
# MAINTAINER: ruby@FreeBSD.org | |||||
.if !defined(_INCLUDE_USES_RUBY_MK) | |||||
_INCLUDE_USES_RUBY_MK= yes | |||||
_valid_ARGS= build extconf none rdoc run setup | |||||
# "USES=gem" implies "USES=ruby" | |||||
.if defined(_INCLUDE_USES_GEM_MK) | |||||
ruby_ARGS= | |||||
.endif | |||||
mat: What happens if there is a port with:
```
USES= ruby gem
``` | |||||
matUnsubmitted Not Done Inline ActionsI meant: USES=ruby:something gem mat: I meant:
```
USES=ruby:something gem
``` | |||||
# Sanity check | |||||
.for arg in ${ruby_ARGS} | |||||
.if empty(_valid_ARGS:M${arg}) | |||||
IGNORE= Incorrect 'USES+= ruby:${ruby_ARGS}' usage: argument [${arg}] is not recognized | |||||
.endif | |||||
.endfor | |||||
.if defined(RUBY_DEFAULT_VER) | .if defined(RUBY_DEFAULT_VER) | ||||
WARNING+= "RUBY_DEFAULT_VER is defined, consider using DEFAULT_VERSIONS=ruby=${RUBY_DEFAULT_VER} instead" | WARNING+= "RUBY_DEFAULT_VER is defined, consider using DEFAULT_VERSIONS=ruby=${RUBY_DEFAULT_VER} instead" | ||||
.endif | .endif | ||||
RUBY_DEFAULT_VER?= ${RUBY_DEFAULT} | RUBY_DEFAULT_VER?= ${RUBY_DEFAULT} | ||||
RUBY_VER?= ${RUBY_DEFAULT_VER} | RUBY_VER?= ${RUBY_DEFAULT_VER} | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | PLIST_SUB+= ${PLIST_RUBY_DIRS:C,DIR="(${LOCALBASE}|${PREFIX})/,DIR=",} \ | ||||
RUBY_SUFFIX="${RUBY_SUFFIX}" \ | RUBY_SUFFIX="${RUBY_SUFFIX}" \ | ||||
RUBY_NAME="${RUBY_NAME}" \ | RUBY_NAME="${RUBY_NAME}" \ | ||||
RUBY_DEFAULT_SUFFIX="${RUBY_DEFAULT_SUFFIX}" \ | RUBY_DEFAULT_SUFFIX="${RUBY_DEFAULT_SUFFIX}" \ | ||||
RUBY25=${RUBY25} \ | RUBY25=${RUBY25} \ | ||||
RUBY26=${RUBY26} \ | RUBY26=${RUBY26} \ | ||||
RUBY27=${RUBY27} \ | RUBY27=${RUBY27} \ | ||||
RUBY30=${RUBY30} | RUBY30=${RUBY30} | ||||
.if defined(USE_RUBY_RDOC) | .if ${ruby_ARGS:Mrdoc} | ||||
MAKE_ENV+= RUBY_RDOC=${RUBY_RDOC} | MAKE_ENV+= RUBY_RDOC=${RUBY_RDOC} | ||||
.endif | .endif | ||||
# require check | |||||
.if defined(RUBY_REQUIRE) | |||||
USE_RUBY= yes | |||||
.if exists(${RUBY}) | |||||
RUBY_PROVIDED!= ${RUBY} -e '\ | |||||
Ruby = ${RUBY_RELVERSION_CODE}; \ | |||||
value = begin; ${RUBY_REQUIRE}; end and puts value' | |||||
.else | |||||
RUBY_PROVIDED= "should be" # the latest version is going to be installed | |||||
.endif | |||||
.if empty(RUBY_PROVIDED) | |||||
.undef RUBY_PROVIDED | |||||
.endif | |||||
.endif | |||||
.if ${PORT_OPTIONS:MDEBUG} | .if ${PORT_OPTIONS:MDEBUG} | ||||
RUBY_FLAGS+= -d | RUBY_FLAGS+= -d | ||||
.endif | .endif | ||||
# | # | ||||
# extconf.rb support | # extconf.rb support | ||||
# | # | ||||
.if defined(USE_RUBY_EXTCONF) | .if ${ruby_ARGS:Mextconf} | ||||
USE_RUBY= yes | |||||
RUBY_EXTCONF?= extconf.rb | RUBY_EXTCONF?= extconf.rb | ||||
CONFIGURE_ARGS+= --with-opt-dir="${LOCALBASE}" | CONFIGURE_ARGS+= --with-opt-dir="${LOCALBASE}" | ||||
CONFIGURE_ENV+= RB_USER_INSTALL=yes | CONFIGURE_ENV+= RB_USER_INSTALL=yes | ||||
do-configure: ruby-extconf-configure | do-configure: ruby-extconf-configure | ||||
ruby-extconf-configure: | ruby-extconf-configure: | ||||
.if defined(RUBY_EXTCONF_SUBDIRS) | .if defined(RUBY_EXTCONF_SUBDIRS) | ||||
.for d in ${RUBY_EXTCONF_SUBDIRS} | .for d in ${RUBY_EXTCONF_SUBDIRS} | ||||
@${ECHO_MSG} "===> Running ${RUBY_EXTCONF} in ${d} to configure" | @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} in ${d} to configure" | ||||
@cd ${CONFIGURE_WRKSRC}/${d}; \ | @cd ${CONFIGURE_WRKSRC}/${d}; \ | ||||
${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_EXTCONF} ${CONFIGURE_ARGS} | ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_EXTCONF} ${CONFIGURE_ARGS} | ||||
.endfor | .endfor | ||||
.else | .else | ||||
@${ECHO_MSG} "===> Running ${RUBY_EXTCONF} to configure" | @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} to configure" | ||||
@cd ${CONFIGURE_WRKSRC}; \ | @cd ${CONFIGURE_WRKSRC}; \ | ||||
${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_EXTCONF} ${CONFIGURE_ARGS} | ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_EXTCONF} ${CONFIGURE_ARGS} | ||||
.endif | .endif | ||||
.endif | .endif | ||||
# | # | ||||
# setup.rb support | # setup.rb support | ||||
# | # | ||||
.if defined(USE_RUBY_SETUP) | .if ${ruby_ARGS:Msetup} | ||||
RUBY_SETUP?= setup.rb | RUBY_SETUP?= setup.rb | ||||
do-configure: ruby-setup-configure | do-configure: ruby-setup-configure | ||||
ruby-setup-configure: | ruby-setup-configure: | ||||
@${ECHO_MSG} "===> Running ${RUBY_SETUP} to configure" | @${ECHO_MSG} "===> Running ${RUBY_SETUP} to configure" | ||||
@cd ${BUILD_WRKSRC}; \ | @cd ${BUILD_WRKSRC}; \ | ||||
${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} config ${CONFIGURE_ARGS} | ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} config ${CONFIGURE_ARGS} | ||||
do-build: ruby-setup-build | do-build: ruby-setup-build | ||||
ruby-setup-build: | ruby-setup-build: | ||||
@${ECHO_MSG} "===> Running ${RUBY_SETUP} to build" | @${ECHO_MSG} "===> Running ${RUBY_SETUP} to build" | ||||
@cd ${BUILD_WRKSRC}; \ | @cd ${BUILD_WRKSRC}; \ | ||||
${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} setup | ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} setup | ||||
do-install: ruby-setup-install | do-install: ruby-setup-install | ||||
ruby-setup-install: | ruby-setup-install: | ||||
@${ECHO_MSG} "===> Running ${RUBY_SETUP} to install" | @${ECHO_MSG} "===> Running ${RUBY_SETUP} to install" | ||||
@cd ${INSTALL_WRKSRC}; \ | @cd ${INSTALL_WRKSRC}; \ | ||||
${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} install --prefix=${STAGEDIR} | ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} install --prefix=${STAGEDIR} | ||||
.endif | .endif | ||||
.if defined(USE_RUBY) | .if !${ruby_ARGS:Mbuild} && !${ruby_ARGS:Mrun} && !${ruby_ARGS:Mnone} | ||||
.if !defined(RUBY_NO_BUILD_DEPENDS) | |||||
EXTRACT_DEPENDS+= ${DEPEND_RUBY} | EXTRACT_DEPENDS+= ${DEPEND_RUBY} | ||||
PATCH_DEPENDS+= ${DEPEND_RUBY} | PATCH_DEPENDS+= ${DEPEND_RUBY} | ||||
BUILD_DEPENDS+= ${DEPEND_RUBY} | BUILD_DEPENDS+= ${DEPEND_RUBY} | ||||
.endif | |||||
.if !defined(RUBY_NO_RUN_DEPENDS) | |||||
RUN_DEPENDS+= ${DEPEND_RUBY} | RUN_DEPENDS+= ${DEPEND_RUBY} | ||||
.endif | .elif ${ruby_ARGS:Mbuild} | ||||
EXTRACT_DEPENDS+= ${DEPEND_RUBY} | |||||
PATCH_DEPENDS+= ${DEPEND_RUBY} | |||||
BUILD_DEPENDS+= ${DEPEND_RUBY} | |||||
.elif ${ruby_ARGS:Mrun} | |||||
RUN_DEPENDS+= ${DEPEND_RUBY} | |||||
.endif | .endif | ||||
.endif # _INVALID_RUBY_VER | .endif # _INVALID_RUBY_VER | ||||
.endif | .endif |
What happens if there is a port with: