diff options
author | taca <taca@pkgsrc.org> | 2011-11-23 05:18:58 +0000 |
---|---|---|
committer | taca <taca@pkgsrc.org> | 2011-11-23 05:18:58 +0000 |
commit | d1e8594c368a618d7f3303df38427640c70b551a (patch) | |
tree | 4c01e5fdbeba97002f18abad02440dd4ed4e78eb /lang | |
parent | b52c77a6c203922228bc746f4484ec3d5ea67753 (diff) | |
download | pkgsrc-d1e8594c368a618d7f3303df38427640c70b551a.tar.gz |
Add lang/ruby/json.mk. It handles dependency to ruby-json and deal with
bundled version with ruby{19,193}-base.
Diffstat (limited to 'lang')
-rw-r--r-- | lang/ruby/json.mk | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/lang/ruby/json.mk b/lang/ruby/json.mk new file mode 100644 index 00000000000..f46ade1156c --- /dev/null +++ b/lang/ruby/json.mk @@ -0,0 +1,79 @@ +# $NetBSD: json.mk,v 1.1 2011/11/23 05:18:58 taca Exp $ + +# This file handles appropriate dependency to ruby-json pacakge. +# + +# === Package-settable variables === +# +# RUBY_JSON_REQD +# Specify required version of ruby-json. +# +# Default: (empty) +# +# RUBY_JSON_TYPE +# Specify depending packages: ruby-json, ruby-json-pure or both. +# +# Possible values: json, pure, both +# Default: json +# + +.if !defined(_RUBY_JSON_MK) +_RUBY_JSON_MK= # defined + +RUBY_JSON_TYPE?= json + +.if empty(RUBY_JSON_REQD) +.warning "No needs to include ../../lang/ruby/json.mk" +.else # !empty(RUBY_JSON_REQD) + +.include "../../lang/ruby/rubyversion.mk" + +. if ${RUBY_VER} != "193" +_RUBY_JSON_REQD= true +. else + +RUBY_JSON_VERSION= 1.5.4 + +_RUBY_JSON_MAJOR= ${RUBY_JSON_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/} +_RUBY_JSON_MINOR= ${RUBY_JSON_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/} +_RUBY_JSON_TEENY= ${RUBY_JSON_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\3/} + +_RUBY_JSON_REQD_MAJOR= ${RUBY_JSON_REQD:C/^([0-9]+).*/\1/} +_RUBY_JSON_REQD_MINOR= \ + ${RUBY_JSON_REQD:C/^${_RUBY_JSON_REQD_MAJOR}\.?//:C/^([0-9]+).*/\1/} +. if empty(_RUBY_JSON_REQD_MINOR) +_RUBY_JSON_REQD_MINOR= 0 +_RUBY_JSON_REQD_TEENY= 0 +. else +_RUBY_JSON_REQD_TEENY= \ + ${RUBY_JSON_REQD:C/^${_RUBY_JSON_REQD_MAJOR}\.${_RUBY_JSON_REQD_MINOR}\.?//} +. endif +. if empty(_RUBY_JSON_REQD_TEENY) +_RUBY_JSON_REQD_TEENY= 0 +. endif + +. if ${_RUBY_JSON_REQD_MAJOR} > ${_RUBY_JSON_MAJOR} +_RUBY_JSON_REQD= true +. elif ${_RUBY_JSON_REQD_MAJOR} == ${_RUBY_JSON_MAJOR} +. if ${_RUBY_JSON_REQD_MINOR} > ${_RUBY_JSON_MINOR} +_RUBY_JSON_REQD= true +. elif ${_RUBY_JSON_REQD_MINOR} == ${_RUBY_JSON_MINOR} +. if ${_RUBY_JSON_REQD_TEENY} > ${_RUBY_JSON_TEENY} +_RUBY_JSON_REQD= true +. endif +. endif +. endif +. endif # ${RUBY_VER} == "193" + +. if !empty(_RUBY_JSON_REQD) +. if ${RUBY_JSON_TYPE} == "json" || ${RUBY_JSON_TYPE} == "both" +DEPENDS+= ${RUBY_PKGPREFIX}-json>=${RUBY_JSON_REQD}:../../textproc/ruby-json +. endif +. if ${RUBY_JSON_TYPE} == "pure" || ${RUBY_JSON_TYPE} == "both" +DEPENDS+= ${RUBY_PKGPREFIX}-json-pure>=${RUBY_JSON_REQD}:../../textproc/ruby-json-pure +. endif +. endif + +.endif # !empty(RUBY_JSON_REQD) + +.endif |