ports/51152: bsd.port.mk: generic SHEBANG_FILES

Kimura Fuyuki fuyuki at hadaly.org
Sat Apr 19 08:50:14 UTC 2003


>Number:         51152
>Category:       ports
>Synopsis:       bsd.port.mk: generic SHEBANG_FILES
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 19 01:50:12 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Kimura Fuyuki <fuyuki at hadaly.org>
>Release:        FreeBSD 5.0-RELEASE-p5 i386
>Organization:
>Environment:

  FreeBSD hadaly.dyndns.org 5.0-RELEASE-p5 FreeBSD 5.0-RELEASE-p5 #1: Fri Mar 21 10:29:48 JST 2003     root at hadaly.dyndns.org:/.2/obj/usr/src/sys/NS  i386

>Description:
bsd.ruby.mk's RUBY_SHEBANG_FILES is very nifty and I want to use it
for non-ruby scripts.

>How-To-Repeat:

>Fix:
The following patch would be incomplete but better than nothing.

USE_REINPLACE=	yes
post-patch:
	${REINPLACE_CMD} -e 's|/usr/bin/perl|${PERL}|' ${WRKSRC}/somescript

can be replaced by

SHEBANG_FILES=	somescript
SHEBANG_CMD=	${PERL}

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.446
diff -u -r1.446 bsd.port.mk
--- bsd.port.mk	2003/04/17 10:27:06	1.446
+++ bsd.port.mk	2003/04/19 08:41:05
@@ -1003,6 +1003,19 @@
 # Location of mounted CDROM(s) to search for files
 CD_MOUNTPTS?=	/cdrom ${CD_MOUNTPT}
 
+# fix shebang lines
+.if defined(SHEBANG_FILES) && !empty(SHEBANG_FILES)
+USE_REINPLACE=		yes
+
+post-patch:	shebang-patch
+
+shebang-patch:
+.for f in ${SHEBANG_FILES}
+	@${ECHO_MSG} "===>  Fixing the #! line of $f"
+	@${REINPLACE_CMD} -E  -e "1{s|^#! *([^ ]*env )?[^ ]+|#!${SHEBANG_CMD}|;/^#!/!{x;s|^|#!${SHEBANG_CMD}|;G;};}" ${WRKSRC}/$f
+.endfor
+.endif
+
 .endif
 # End of pre-makefile section.
 
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list