summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaca <taca@pkgsrc.org>2014-02-11 16:20:03 +0000
committertaca <taca@pkgsrc.org>2014-02-11 16:20:03 +0000
commite09900bc8dde7d6aaa5320cdd3a08cf3263dce3a (patch)
tree097413fadea0263ffbd1eb59b5fcf854ac0fae9f
parent87bf31a694a5f15015fa78c6c94fef7338acab2a (diff)
downloadpkgsrc-e09900bc8dde7d6aaa5320cdd3a08cf3263dce3a.tar.gz
Make RUBY_JSON_REQD support build time dependency adding ":build" after
minimum version.
-rw-r--r--lang/ruby/json.mk33
1 files changed, 24 insertions, 9 deletions
diff --git a/lang/ruby/json.mk b/lang/ruby/json.mk
index 1792370f8b5..b2d008824dc 100644
--- a/lang/ruby/json.mk
+++ b/lang/ruby/json.mk
@@ -1,4 +1,4 @@
-# $NetBSD: json.mk,v 1.6 2014/02/09 06:08:18 taca Exp $
+# $NetBSD: json.mk,v 1.7 2014/02/11 16:20:03 taca Exp $
# This file handles appropriate dependency to ruby-json pacakge.
#
@@ -6,7 +6,9 @@
# === Package-settable variables ===
#
# RUBY_JSON_REQD
-# Specify required version of ruby-json.
+# Specify required version of ruby-json and optionally dependency
+# method after colon. For example, RUBY_JSON_REQD=1.8.0:build
+# request ruby-json 1.8.0 and later for BUILD_DEPENDS.
#
# Default: (empty)
#
@@ -26,6 +28,14 @@ RUBY_JSON_TYPE?= json
WARNINGS+= "[lang/ruby/json.mk] No needs to include ../../lang/ruby/json.mk"
.else # !empty(RUBY_JSON_REQD)
+.if !empty(RUBY_JSON_REQD:M*\:*)
+_RUBY_JSON_DEPENDS= ${RUBY_JSON_REQD:C/([0-9\.]+)\:(.*)/\2/}
+_RUBY_JSON_VERS= ${RUBY_JSON_REQD:C/([0-9\.]+)\:(.*)/\1/}
+.else
+_RUBY_JSON_DEPENDS= full
+_RUBY_JSON_VERS= ${RUBY_JSON_REQD}
+.endif
+
.include "../../lang/ruby/rubyversion.mk"
. if empty(RUBY_JSON_VERSION)
@@ -36,15 +46,15 @@ _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_MAJOR= ${_RUBY_JSON_VERS:C/^([0-9]+).*/\1/}
_RUBY_JSON_REQD_MINOR= \
- ${RUBY_JSON_REQD:C/^${_RUBY_JSON_REQD_MAJOR}\.?//:C/^([0-9]+).*/\1/}
+ ${_RUBY_JSON_VERS: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}\.?//}
+ ${_RUBY_JSON_VERS:C/^${_RUBY_JSON_REQD_MAJOR}\.${_RUBY_JSON_REQD_MINOR}\.?//}
. endif
. if empty(_RUBY_JSON_REQD_TEENY)
_RUBY_JSON_REQD_TEENY= 0
@@ -64,10 +74,15 @@ _RUBY_JSON_REQD= true
. endif # empty(RUBY_JSON_VERSION)
. if !empty(_RUBY_JSON_REQD)
-. if ${RUBY_JSON_TYPE} == "json"
-DEPENDS+= ${RUBY_PKGPREFIX}-json>=${RUBY_JSON_REQD}:../../textproc/ruby-json
-. elif ${RUBY_JSON_TYPE} == "pure"
-DEPENDS+= ${RUBY_PKGPREFIX}-json-pure>=${RUBY_JSON_REQD}:../../textproc/ruby-json-pure
+. if ${RUBY_JSON_TYPE} == "pure"
+_RUBY_JSON_PKG= ../../textproc/ruby-json-pure
+. else
+_RUBY_JSON_PKG= ../../textproc/ruby-json
+. endif
+. if ${_RUBY_JSON_DEPENDS} == "build"
+BUILD_DEPENDS+= ${RUBY_PKGPREFIX}-json>=${_RUBY_JSON_VERS}:${_RUBY_JSON_PKG}
+. else
+DEPENDS+= ${RUBY_PKGPREFIX}-json>=${_RUBY_JSON_VERS}:${_RUBY_JSON_PKG}
. endif
. endif