aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorknu <knu@FreeBSD.org>2000-10-01 01:34:44 +0800
committerknu <knu@FreeBSD.org>2000-10-01 01:34:44 +0800
commit8ac332a7a96860d2348167f7a2cc017d78f2a8fe (patch)
tree6e65f6fc5ae48833951be825ee07bfe6b2d41652 /Mk
parentd02c3374b5d4799ceb339c45358c6a378ae56fb4 (diff)
downloadfreebsd-ports-gnome-8ac332a7a96860d2348167f7a2cc017d78f2a8fe.tar.gz
freebsd-ports-gnome-8ac332a7a96860d2348167f7a2cc017d78f2a8fe.tar.zst
freebsd-ports-gnome-8ac332a7a96860d2348167f7a2cc017d78f2a8fe.zip
Add RUBY_SHEBANG_FILES, in which you can list files which shebang
lines need to be fixed.
Diffstat (limited to '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