summaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/gem.mk3
-rw-r--r--Mk/Uses/ruby.mk (renamed from Mk/bsd.ruby.mk)65
-rw-r--r--Mk/bsd.port.mk10
-rw-r--r--Mk/bsd.sanity.mk13
4 files changed, 57 insertions, 34 deletions
diff --git a/Mk/Uses/gem.mk b/Mk/Uses/gem.mk
index de5f2fbd6fd3..a1e77273932a 100644
--- a/Mk/Uses/gem.mk
+++ b/Mk/Uses/gem.mk
@@ -19,6 +19,9 @@ IGNORE= Incorrect 'USES+= gem:${gem_ARGS}' usage: argument [${arg}] is not recog
. endif
. endfor
+# "USES=gem" implies "USES=ruby"
+.include "${USESDIR}/ruby.mk"
+
PKGNAMEPREFIX?= rubygem-
EXTRACT_SUFX= .gem
EXTRACT_ONLY=
diff --git a/Mk/bsd.ruby.mk b/Mk/Uses/ruby.mk
index a9a6ce42574e..da2e4ea30a4e 100644
--- a/Mk/bsd.ruby.mk
+++ b/Mk/Uses/ruby.mk
@@ -1,11 +1,16 @@
-# bsd.ruby.mk - Utility definitions for Ruby related ports.
+# 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, 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*.
+# 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]
#
@@ -23,20 +28,12 @@ Ruby_Include_MAINTAINER= ruby@FreeBSD.org
# RUBY_SITELIBDIR, and RUBY_SITEARCHLIBDIR.
# RUBY_VER - Set to the alternative short version of ruby in the
# 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
# (default: extconf.rb).
# RUBY_EXTCONF_SUBDIRS - Set to list of subdirectories, if multiple modules
# 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
# (default: setup.rb).
-# USE_RUBYGEMS - Do not use this -- instead USES=gem
#
# [variables that each port should not (re)define]
#
@@ -44,7 +41,7 @@ Ruby_Include_MAINTAINER= ruby@FreeBSD.org
# (default: ruby${RUBY_SUFFIX}-)
# RUBY_VERSION - Full version of ruby without preview/beta suffix in
# 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
# `xyz'.
# RUBY_DISTVERSION - DISTVERSION for the standard ruby ports (ruby,
# ruby-gdbm, etc.).
@@ -93,6 +90,25 @@ Ruby_Include_MAINTAINER= ruby@FreeBSD.org
# RUBY_MODDOCDIR - Installation path for the module's documents.
# 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 run setup
+
+# "USES=gem" implies "USES=ruby"
+. if defined(_INCLUDE_USES_GEM_MK)
+ruby_ARGS=
+. endif
+
+# 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)
WARNING+= "RUBY_DEFAULT_VER is defined, consider using DEFAULT_VERSIONS=ruby=${RUBY_DEFAULT_VER} instead"
@@ -282,8 +298,7 @@ RUBY_FLAGS+= -d
#
# extconf.rb support
#
-. if defined(USE_RUBY_EXTCONF)
-USE_RUBY= yes
+. if ${ruby_ARGS:Mextconf}
RUBY_EXTCONF?= extconf.rb
CONFIGURE_ARGS+= --with-opt-dir="${LOCALBASE}"
@@ -308,7 +323,7 @@ ruby-extconf-configure:
#
# setup.rb support
#
-. if defined(USE_RUBY_SETUP)
+. if ${ruby_ARGS:Msetup}
RUBY_SETUP?= setup.rb
do-configure: ruby-setup-configure
@@ -333,15 +348,17 @@ ruby-setup-install:
${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_FLAGS} ${RUBY_SETUP} install --prefix=${STAGEDIR}
. endif
-. if defined(USE_RUBY)
-. if !defined(RUBY_NO_BUILD_DEPENDS)
+. if !${ruby_ARGS:Mbuild} && !${ruby_ARGS:Mrun} && !${ruby_ARGS:Mnone}
EXTRACT_DEPENDS+= ${DEPEND_RUBY}
PATCH_DEPENDS+= ${DEPEND_RUBY}
BUILD_DEPENDS+= ${DEPEND_RUBY}
-. endif
-. if !defined(RUBY_NO_RUN_DEPENDS)
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 # _INVALID_RUBY_VER
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 7628e7d1d48a..b20876eff9f0 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -371,9 +371,6 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org
# USE_OCAML - If set, this port relies on the OCaml language.
# Implies inclusion of bsd.ocaml.mk. (Also see
# that file for more information on USE_OCAML*).
-# USE_RUBY - If set, this port relies on the Ruby language.
-# Implies inclusion of bsd.ruby.mk. (Also see
-# that file for more information on USE_RUBY_*).
##
# USE_GECKO - If set, this port uses the Gecko/Mozilla product.
# See bsd.gecko.mk for more details.
@@ -1391,10 +1388,6 @@ PKGCOMPATDIR?= ${LOCALBASE}/lib/compat/pkg
.include "${PORTSDIR}/Mk/bsd.java.mk"
. endif
-. if defined(USE_RUBY)
-.include "${PORTSDIR}/Mk/bsd.ruby.mk"
-. endif
-
. if defined(USE_OCAML)
.include "${PORTSDIR}/Mk/bsd.ocaml.mk"
. endif
@@ -1640,8 +1633,7 @@ QA_ENV+= STAGEDIR=${STAGEDIR} \
DISABLE_LICENSES="${DISABLE_LICENSES:Dyes}" \
PORTNAME=${PORTNAME} \
NO_ARCH=${NO_ARCH} \
- "NO_ARCH_IGNORE=${NO_ARCH_IGNORE}" \
- USE_RUBY=${USE_RUBY}
+ "NO_ARCH_IGNORE=${NO_ARCH_IGNORE}"
. if !empty(USES:Mssl)
QA_ENV+= USESSSL=yes
. endif
diff --git a/Mk/bsd.sanity.mk b/Mk/bsd.sanity.mk
index 621445045470..5d60596d85f4 100644
--- a/Mk/bsd.sanity.mk
+++ b/Mk/bsd.sanity.mk
@@ -161,6 +161,10 @@ DEV_ERROR+= "USE_TCL and USE_TK are no longer supported, please use USES=tcl or
DEV_ERROR+= "USE_FPC=yes is no longer supported, please use USES=fpc"
.endif
+.if ! empty(USES:Mruby) && ! empty(USES:Mgem)
+DEV_ERROR= "'USES=gem' implies 'USES=ruby'. You should not specify both of them"
+.endif
+
.for _type in EXAMPLES DOCS
. if defined(PORT${_type}) && empty(_REALLY_ALL_POSSIBLE_OPTIONS:M${_type})
DEV_ERROR+= "PORT${_type} does not do anything unless the ${_type} option is present."
@@ -203,7 +207,9 @@ SANITY_UNSUPPORTED= USE_OPENAL USE_FAM USE_MAKESELF USE_ZIP USE_LHA USE_CMAKE \
INSTALLS_EGGINFO USE_DOS2UNIX NO_STAGE USE_RUBYGEMS USE_GHOSTSCRIPT \
USE_GHOSTSCRIPT_BUILD USE_GHOSTSCRIPT_RUN USE_AUTOTOOLS APACHE_PORT \
USE_FPC_RUN WANT_FPC_BASE WANT_FPC_ALL USE_QT4 USE_QT5 QT_NONSTANDARD \
- XORG_CAT CARGO_USE_GITHUB CARGO_USE_GITLAB CARGO_GIT_SUBDIR
+ XORG_CAT CARGO_USE_GITHUB CARGO_USE_GITLAB CARGO_GIT_SUBDIR \
+ USE_RUBY USE_RUBY_EXTCONF USE_RUBY_SETUP RUBY_NO_BUILD_DEPENDS \
+ RUBY_NO_RUN_DEPENDS
SANITY_DEPRECATED= MLINKS \
USE_MYSQL WANT_MYSQL_VER \
PYDISTUTILS_INSTALLNOSINGLE \
@@ -294,6 +300,11 @@ XORG_CAT_ALT= USES=xorg-cat:${XORG_CAT}
CARGO_USE_GITHUB_ALT= CARGO_CRATES \(regenerate it with make cargo-crates\)
CARGO_USE_GITLAB_ALT= CARGO_CRATES \(regenerate it with make cargo-crates\)
CARGO_GIT_SUBDIR_ALT= CARGO_CRATES \(regenerate it with make cargo-crates\)
+USE_RUBY_ALT= USES=ruby
+USE_RUBY_EXTCONF_ALT= USES=ruby:extconf
+USE_RUBY_SETUP_ALT= USES=ruby:setup
+RUBY_NO_BUILD_DEPENDS_ALT= USES=ruby:run
+RUBY_NO_RUN_DEPENDS_ALT= USES=ruby:build
.for a in ${SANITY_DEPRECATED}
. if defined(${a})