Index: Mk/Uses/shebangfix.mk =================================================================== --- Mk/Uses/shebangfix.mk +++ Mk/Uses/shebangfix.mk @@ -9,13 +9,17 @@ # Usage: USES=shebangfix # # SHEBANG_REGEX a regular expression to match files that needs to be converted -# SHEBANG_FILES list of files or glob pattern relative to ${WRKSRC} +# SHEBANG_FILES_* list of files or glob pattern: +# SHEBANG_FILES_PATCH files relative to ${WRKSRC} to fix during +# the patch phase +# SHEBANG_FILES_INSTALL files relative to ${STAGEDIR}${PREFIX} to +# fix during the stage phase # SHEBANG_GLOB list of glob pattern find(1) will match with # # To specify that ${WRKSRC}/path1/file and all .pl files in ${WRKSRC}/path2 # should be processed: # -# SHEBANG_FILES= path1/file path2/*.pl +# SHEBANG_FILES_PATCH= path1/file path2/*.pl # # To define custom shebangs to replace, use the following (note that # shebangs with spaces should be quoted): @@ -78,21 +82,35 @@ . endfor .endfor -_USES_patch+= 210:fix-shebang -fix-shebang: +.if defined(SHEBANG_FILES) +# Allow original SHEBANG_FILES as a synonym for SHEBANG_FILES_PATCH. +SHEBANG_FILES_PATCH= ${SHEBANG_FILES} +.endif +.if defined(SHEBANG_FILES_PATCH) +_USES_patch+= 210:fix-shebang-patch +_SHEBANG_PATCH_DIR= ${WRKSRC} +.endif +.if defined(SHEBANG_FILES_INSTALL) +_USES_install+= 899:fix-shebang-install +_SHEBANG_INSTALL_DIR= ${STAGEDIR}${PREFIX} +.endif +_fix-shebang: .USE + echo TARGET: ${.TARGET} .if defined(SHEBANG_REGEX) - @cd ${WRKSRC}; \ + @cd ${_SHEBANG_${.TARGET:C/fix-shebang-//:tu}_DIR}; \ ${FIND} -E . -type f -iregex '${SHEBANG_REGEX}' \ -exec ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} {} + .elif defined(SHEBANG_GLOB) .for f in ${SHEBANG_GLOB} - @cd ${WRKSRC}; \ + @cd ${_SHEBANG_${.TARGET:C/fix-shebang-//:tu}_DIR}; \ ${FIND} . -type f -name '${f}' \ -exec ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} {} + .endfor .else - @cd ${WRKSRC}; \ - ${ECHO_CMD} ${SHEBANG_FILES} | ${XARGS} ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} + @cd ${_SHEBANG_${.TARGET:C/fix-shebang-//:tu}_DIR}; \ + ${ECHO_CMD} ${SHEBANG_FILES_${.TARGET:C/fix-shebang-//:tu}} | ${XARGS} ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} .endif +fix-shebang-install: _fix-shebang +fix-shebang-patch: _fix-shebang .endif Index: devel/renpy/Makefile =================================================================== --- devel/renpy/Makefile +++ devel/renpy/Makefile @@ -36,7 +36,7 @@ EXCLUDE= gen 'module/*.py[co]' 'renpy/*.py[co]' EXTRACT_AFTER_ARGS=${EXCLUDE:S,^,--exclude ,} SHEBANG_FILES= renpy.py launcher/game/tkaskdir.py -TARGET_ORDER_OVERRIDE=610:fix-shebang +TARGET_ORDER_OVERRIDE=610:fix-shebang-patch BUILD_WRKSRC= ${WRKSRC}/module INSTALL_WRKSRC= ${BUILD_WRKSRC} MAKE_ENV+= RENPY_DEPS_INSTALL="${LOCALBASE}" Index: emulators/wine-devel/Makefile =================================================================== --- emulators/wine-devel/Makefile +++ emulators/wine-devel/Makefile @@ -149,7 +149,7 @@ CONFIGURE_ARGS+=--without-pulse USE_AUTOTOOLS= autoconf:env -post-extract: fix-shebang +post-extract: fix-shebang-patch cd ${WRKSRC} && ${TAR} xf ${DISTDIR}/${COMP_DIST} --strip-components 1 ${REINPLACE_CMD} 's|autoreconf|${AUTORECONF}|g' ${WRKSRC}/patches/patchinstall.sh cd ${WRKSRC} && bash ./patches/patchinstall.sh --backend=patch DESTDIR=${WRKSRC} --all Index: mail/adcomplain/Makefile =================================================================== --- mail/adcomplain/Makefile +++ mail/adcomplain/Makefile @@ -21,9 +21,10 @@ NO_BUILD= yes PLIST_FILES= bin/adcomplain -# fix-shebang normally runs before the patches in ${FILESDIR} are applied. In -# this case, we need it to run after, so that it can fix the right shebang. -TARGET_ORDER_OVERRIDE= 750:fix-shebang +# fix-shebang-patch normally runs before the patches in ${FILESDIR} are +# applied. In this case, we need it to run after, so that it can fix +# the right shebang. +TARGET_ORDER_OVERRIDE= 750:fix-shebang-patch do-install: ${INSTALL_SCRIPT} ${WRKSRC}/adcomplain.pl \