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