Annotation of pkgsrc/lang/ruby/replace.mk, revision 1.7
1.7 ! minskim 1: # $NetBSD: replace.mk,v 1.6 2006/07/20 13:54:44 jlam Exp $
1.1 taca 2: #
3:
1.3 rillig 4: .if !defined(_RUBY_REPLACE_MK)
1.1 taca 5: _RUBY_REPLACE_MK= # defined
6:
1.5 rillig 7: .include "${.PARSEDIR}/rubyversion.mk"
8:
1.1 taca 9: # fix shebang line.
10: #
11: # REPLACE_RUBY replace shebang line of specified files.
1.2 taca 12: #
13: REPLACE_FILE_PAT?= *.rb
14:
15: .if defined(REPLACE_RUBY)
16: REPLACE_INTERPRETER+= ${RUBY_NAME}
17:
1.7 ! minskim 18: REPLACE.${RUBY_NAME}.old= .*ruby[0-9]*
1.6 jlam 19: REPLACE.${RUBY_NAME}.new= ${RUBY}
20: REPLACE_FILES.${RUBY_NAME}= ${REPLACE_RUBY}
1.2 taca 21:
22: .endif # defined(REPLACE_RUBY)
23:
1.1 taca 24: # REPLACE_RUBY_DIRS replace shebang line of files under specified
25: # directories.
26: # REPLACE_FILE_PAT specify pattern to match target files under
27: # REPLACE_RUBY_DIRS directories.
28: #
1.2 taca 29: .if defined(REPLACE_RUBY_DIRS) && !empty(REPLACE_RUBY_DIRS)
30: pre-configure: replace-ruby-dirs
1.1 taca 31:
32: .for f in ${REPLACE_FILE_PAT}
33: _REPLACE_FILE_PAT+= -o -name "${f}"
34: .endfor
35: _REPLACE_FILE_FIND_ARGS=\( ${_REPLACE_FILE_PAT:S/-o//1} \)
36:
37: replace-ruby-dirs:
38: ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${REPLACE_RUBY_DIRS} \
39: -type f ${_REPLACE_FILE_FIND_ARGS} -print | \
40: while read f; do \
41: ${SED} -e '1s| *[a-z0-9_/\.-][a-z0-9_/\.-]*/env *||g' \
42: -e '1s| *[a-z0-9_/\.-]*ruby|${RUBY}|' $$f > $$f.tmp; \
43: if ${CMP} -s $$f $$f.tmp; then \
44: ${RM} $$f.tmp; \
45: else \
46: ${MV} $$f.tmp $$f; \
47: fi; \
48: done
49: .else
50: replace-ruby-dirs:
1.2 taca 51: .endif # defined(REPLACE_RUBY_DIRS)
1.1 taca 52: .endif # _RUBY_REPLACE_MK
CVSweb <webmaster@jp.NetBSD.org>