diff options
author | taca <taca@pkgsrc.org> | 2005-11-02 07:44:33 +0000 |
---|---|---|
committer | taca <taca@pkgsrc.org> | 2005-11-02 07:44:33 +0000 |
commit | 2c3170f56f53ea4e1eceda22a004f962b0a13e73 (patch) | |
tree | 2713048438d9504f3fab33960d9b4acf521dfe05 | |
parent | 90a1578320cae692ed06060483bf1e523d0712ff (diff) | |
download | pkgsrc-2c3170f56f53ea4e1eceda22a004f962b0a13e73.tar.gz |
Use subst framework to process REPLACE_RUBY.
-rw-r--r-- | lang/ruby/replace.mk | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/lang/ruby/replace.mk b/lang/ruby/replace.mk index 4ee9ae2168f..4d783b0a505 100644 --- a/lang/ruby/replace.mk +++ b/lang/ruby/replace.mk @@ -1,4 +1,4 @@ -# $NetBSD: replace.mk,v 1.1.1.1 2004/11/27 13:57:21 taca Exp $ +# $NetBSD: replace.mk,v 1.2 2005/11/02 07:44:33 taca Exp $ # .ifndef _RUBY_REPLACE_MK @@ -7,42 +7,31 @@ _RUBY_REPLACE_MK= # defined # fix shebang line. # # REPLACE_RUBY replace shebang line of specified files. +# +REPLACE_FILE_PAT?= *.rb + +.if defined(REPLACE_RUBY) +REPLACE_INTERPRETER+= ${RUBY_NAME} + +_REPLACE.${RUBY_NAME}.old= .*/ruby +_REPLACE.${RUBY_NAME}.new= ${RUBY} +_REPLACE_FILES.${RUBY_NAME}= ${REPLACE_RUBY} + +.endif # defined(REPLACE_RUBY) + # REPLACE_RUBY_DIRS replace shebang line of files under specified # directories. # REPLACE_FILE_PAT specify pattern to match target files under # REPLACE_RUBY_DIRS directories. # -REPLACE_FILE_PAT?= *.rb - -.if defined(REPLACE_RUBY) || defined(REPLACE_RUBY_DIRS) -pre-configure: replace-ruby-scripts replace-ruby-dirs - -.if defined(REPLACE_RUBY) && !empty(REPLACE_RUBY) -replace-ruby-scripts: - ${_PKG_SILENT}${_PKG_DEBUG}for s in ${REPLACE_RUBY}; do \ - case $${s} in \ - /*) f=$${s};; \ - *) f=${WRKSRC}/$${s};; \ - esac; \ - ${ECHO_MSG} "===> Fixing the #! line of $${s}"; \ - ${SED} -e '1s| *[a-z0-9_/\.-][a-z0-9_/\.-]*/env *||g' \ - -e '1s| *[a-z0-9_/\.-]*ruby|${RUBY}|' $$f > $$f.tmp; \ - if ${CMP} -s $$f $$f.tmp; then \ - ${RM} $$f.tmp; \ - else \ - ${MV} $$f.tmp $$f; \ - fi; \ - done -.else -replace-ruby-scripts: -.endif +.if defined(REPLACE_RUBY_DIRS) && !empty(REPLACE_RUBY_DIRS) +pre-configure: replace-ruby-dirs .for f in ${REPLACE_FILE_PAT} _REPLACE_FILE_PAT+= -o -name "${f}" .endfor _REPLACE_FILE_FIND_ARGS=\( ${_REPLACE_FILE_PAT:S/-o//1} \) -.if defined(REPLACE_RUBY_DIRS) && !empty(REPLACE_RUBY_DIRS) replace-ruby-dirs: ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${REPLACE_RUBY_DIRS} \ -type f ${_REPLACE_FILE_FIND_ARGS} -print | \ @@ -57,7 +46,5 @@ replace-ruby-dirs: done .else replace-ruby-dirs: -.endif - -.endif # defined(REPLACE_RUBY) || defined(REPLACE_RUBY_DIRS) +.endif # defined(REPLACE_RUBY_DIRS) .endif # _RUBY_REPLACE_MK |