This patch adds MODPERL_BIN_ADJ and MODPERL_ADJ_FILES, similar to
what other MODULEs do. There are already quite a few ports that
could use this functionality instead of inventing analogs each time.

Okay? Already tested with upcoming TeXLive shebangs patch.

--
  WBR,
    Vadim Zhukov


Index: perl.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/perl.port.mk,v
retrieving revision 1.21
diff -u -p -r1.21 perl.port.mk
--- perl.port.mk        11 Mar 2013 11:50:17 -0000      1.21
+++ perl.port.mk        4 May 2013 08:07:07 -0000
@@ -8,6 +8,18 @@ TEST_TARGET ?= test
 MODPERL_BUILD ?= Build
 SHARED_ONLY ?= No
 
+# set /usr/bin/perl for executable scripts
+MODPERL_BIN_ADJ =      perl -pi \
+       -e '$$. == 1 && s|^.*env perl([\s].*)?$$|\#!/usr/bin/perl$$1|;' \
+       -e '$$. == 1 && s|^.*bin/perl([\s].*)?$$|\#!/usr/bin/perl$$1|;' \
+       -e 'close ARGV if eof;'
+
+MODPERL_ADJ_FILES ?=
+.if !empty(MODPERL_ADJ_FILES)
+MODPERL_pre-configure = for f in ${MODPERL_ADJ_FILES}; do \
+       ${MODPERL_BIN_ADJ} ${WRKSRC}/$${f}; done
+.endif
+
 .if ${CONFIGURE_STYLE:L:Mmodbuild}
 MODPERL_configure = \
        arch=`perl -e 'use Config; print $$Config{archname}, "\n";'`; \

Reply via email to