aboutsummaryrefslogtreecommitdiff
path: root/Mk/bsd.ruby.mk
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@FreeBSD.org>2000-09-30 17:34:44 +0000
committerAkinori MUSHA <knu@FreeBSD.org>2000-09-30 17:34:44 +0000
commitf5507f4941ac7be2aabf28631df210feaf26f9c0 (patch)
tree610bd39b81d11638415fd283de48b3657634abb4 /Mk/bsd.ruby.mk
parent83fa54885b0ec37af29622b6d8f2121deaccac5e (diff)
downloadports-f5507f4941ac7be2aabf28631df210feaf26f9c0.tar.gz
ports-f5507f4941ac7be2aabf28631df210feaf26f9c0.zip
Add RUBY_SHEBANG_FILES, in which you can list files which shebang
lines need to be fixed.
Notes
Notes: svn path=/head/; revision=33268
Diffstat (limited to 'Mk/bsd.ruby.mk')
-rw-r--r--Mk/bsd.ruby.mk14
1 files changed, 14 insertions, 0 deletions
diff --git a/Mk/bsd.ruby.mk b/Mk/bsd.ruby.mk
index 0a8ff702ed13..3908f7759fc8 100644
--- a/Mk/bsd.ruby.mk
+++ b/Mk/bsd.ruby.mk
@@ -26,6 +26,7 @@ Ruby_Include_MAINTAINER= knu@FreeBSD.org
# RUBY_SETUP - Set to the alternative name of setup.rb (default: setup.rb).
# USE_RUBY_AMSTD - Says that the port uses amstd for building and running.
# USE_RUBY_RD - Says that the port uses rd to generate documents.
+# RUBY_SHEBANG_FILES - Specify the files which shebang lines you want to fix.
#
# [variables that each port should not define]
#
@@ -114,6 +115,19 @@ PLIST_SUB+= RUBY_VERSION="${RUBY_VERSION}" \
RUBY_NAME="${RUBY_NAME}" \
${PLIST_RUBY_DIRS:S,DIR="${LOCALBASE}/,DIR=",}
+# fix shebang lines
+.if defined(RUBY_SHEBANG_FILES) && !empty(RUBY_SHEBANG_FILES)
+USE_RUBY= yes
+
+post-patch: ruby-shebang-patch
+
+ruby-shebang-patch:
+ @for f in ${RUBY_SHEBANG_FILES}; do \
+ ${ECHO_MSG} "===> Fixing the #! line of $$f"; \
+ ${RUBY} -i -pe '$$. == 1 and sub /^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"' $$f; \
+ done
+.endif
+
# extconf.rb
.if defined(USE_RUBY_EXTCONF)
USE_RUBY= yes