Annotation of pkgsrc/lang/ruby/replace.mk, revision 1.8

1.8     ! taca        1: # $NetBSD: replace.mk,v 1.7 2007/05/01 23:03:29 minskim 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: .if defined(REPLACE_RUBY)
                     14: REPLACE_INTERPRETER+=  ${RUBY_NAME}
                     15: 
1.7       minskim    16: REPLACE.${RUBY_NAME}.old=      .*ruby[0-9]*
1.6       jlam       17: REPLACE.${RUBY_NAME}.new=      ${RUBY}
                     18: REPLACE_FILES.${RUBY_NAME}=    ${REPLACE_RUBY}
1.2       taca       19: 
                     20: .endif # defined(REPLACE_RUBY)
                     21: 
1.1       taca       22: # REPLACE_RUBY_DIRS    replace shebang line of files under specified
                     23: #                      directories.
1.8     ! taca       24: # REPLACE_RUBY_PAT     specify pattern to match target files under
1.1       taca       25: #                      REPLACE_RUBY_DIRS directories.
                     26: #
1.8     ! taca       27: REPLACE_RUBY_PAT?=     *.rb
        !            28: 
1.2       taca       29: .if defined(REPLACE_RUBY_DIRS) && !empty(REPLACE_RUBY_DIRS)
                     30: pre-configure: replace-ruby-dirs
1.1       taca       31: 
1.8     ! taca       32: .for f in ${REPLACE_RUBY_PAT}
        !            33: _REPLACE_RUBY_PAT+= -o -name "${f}"
1.1       taca       34: .endfor
1.8     ! taca       35: _REPLACE_RUBY_FIND_ARGS=\( ${_REPLACE_RUBY_PAT:S/-o//1} \)
1.1       taca       36: 
                     37: replace-ruby-dirs:
                     38:        ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${REPLACE_RUBY_DIRS} \
1.8     ! taca       39:            -type f ${_REPLACE_RUBY_FIND_ARGS} -print | \
1.1       taca       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>