diff --git a/Mk/Uses/gem.mk b/Mk/Uses/gem.mk --- a/Mk/Uses/gem.mk +++ b/Mk/Uses/gem.mk @@ -19,6 +19,9 @@ . 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 rename from Mk/bsd.ruby.mk rename to Mk/Uses/ruby.mk --- 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_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] # @@ -93,6 +90,25 @@ # 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 @@ # # 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 @@ # # 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 @@ ${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 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -371,9 +371,6 @@ # 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. @@ -1386,10 +1383,6 @@ .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 @@ -1635,8 +1628,7 @@ 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 --- a/Mk/bsd.sanity.mk +++ b/Mk/bsd.sanity.mk @@ -161,6 +161,10 @@ 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 @@ 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 @@ 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})