View | Details | Raw Unified | Return to bug 209051
Collapse All | Expand All

(-)Mk/bsd.ruby.mk (-32 lines)
Lines 52-58 Link Here
52
#			  expression will be set to RUBY_PROVIDED, which is
52
#			  expression will be set to RUBY_PROVIDED, which is
53
#			  left undefined if the result is nil, false or a
53
#			  left undefined if the result is nil, false or a
54
#			  zero-length string.  Implies USE_RUBY.
54
#			  zero-length string.  Implies USE_RUBY.
55
# RUBY_SHEBANG_FILES	- Specify the files which shebang lines you want to fix.
56
# RUBY_RD_FILES		- Specify the RD files which you want to generate HTML
55
# RUBY_RD_FILES		- Specify the RD files which you want to generate HTML
57
#			  documents from. If this is defined and not empty,
56
#			  documents from. If this is defined and not empty,
58
#			  USE_RUBY_RDTOOL is implied and RUBY_RD_HTML_FILES is
57
#			  USE_RUBY_RDTOOL is implied and RUBY_RD_HTML_FILES is
Lines 388-424 Link Here
388
.endif
387
.endif
389
.endif
388
.endif
390
389
391
# fix shebang lines
392
.if defined(RUBY_SHEBANG_FILES) && !empty(RUBY_SHEBANG_FILES)
393
USE_RUBY=		yes
394
395
post-patch:	ruby-shebang-patch
396
397
ruby-shebang-patch:
398
	@cd ${WRKSRC}; for f in ${RUBY_SHEBANG_FILES}; do \
399
	${ECHO_MSG} "===>  Fixing the #! line of $$f"; \
400
	TMPFILE=`mktemp -t rubyshebang`; \
401
	cp $$f $$TMPFILE; \
402
	${AWK} 'BEGIN {flag = 0;}								\
403
		{										\
404
			if (flag == 0) {							\
405
				if ($$0 ~ /^#!/) {						\
406
					sub(/#!(.*\/)?(env[[:space:]]+)?ruby/, "#!${RUBY}", $$0);\
407
					print $$0;						\
408
				}								\
409
				else {								\
410
					print "#!${RUBY}";					\
411
					print $$0;						\
412
				}								\
413
				flag = 1;							\
414
			} else {								\
415
				print $$0;							\
416
			}									\
417
		}' $$TMPFILE > $$f; \
418
	rm -f $$TMPFILE; \
419
	done
420
.endif
421
422
.if ${PORT_OPTIONS:MDEBUG}
390
.if ${PORT_OPTIONS:MDEBUG}
423
RUBY_FLAGS+=	-d
391
RUBY_FLAGS+=	-d
424
.endif
392
.endif

Return to bug 209051