"/bin/env ruby" in bang line. It was broken after switching to use subst frame work. The problem was noted by OBATA Akio via private mail, thanks much.
50 lines
1.3 KiB
Makefile
50 lines
1.3 KiB
Makefile
# $NetBSD: replace.mk,v 1.4 2006/01/30 16:30:05 taca Exp $
|
|
#
|
|
|
|
.if !defined(_RUBY_REPLACE_MK)
|
|
_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.
|
|
#
|
|
.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} \)
|
|
|
|
replace-ruby-dirs:
|
|
${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${REPLACE_RUBY_DIRS} \
|
|
-type f ${_REPLACE_FILE_FIND_ARGS} -print | \
|
|
while read f; do \
|
|
${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-dirs:
|
|
.endif # defined(REPLACE_RUBY_DIRS)
|
|
.endif # _RUBY_REPLACE_MK
|