Index: en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml =================================================================== --- en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml +++ en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml @@ -2595,25 +2595,48 @@ A lot of software uses incorrect locations for script interpreters, most notably /usr/bin/perl - and /bin/bash. The shebagngfix macro fixes + and /bin/bash. The shebangfix macro fixes shebang lines in scripts listed in SHEBANG_REGEX, SHEBANG_GLOB, or - SHEBANG_FILES. - SHEBANG_REGEX contains an extended regular - expressions, and is used with the -iregex - argument of &man.find.1;. SHEBANG_GLOB - contains a pattern used with the -name - argument of &man.find.1;. The shebangfix macro is run - from ${WRKSRC}, so - SHEBANG_FILES can contain paths that - are relative to ${WRKSRC}. It can also deal - with absolute paths if files outside of - ${WRKSRC} require patching. For - example when using SHEBANG_FILES: - - USES= shebangfix -SHEBANG_FILES= scripts/foobar.pl scripts/*.sh + SHEBANG_FILES. + + + + SHEBANG_REGEX + + + Contains one extended regular + expressions, and is used with the + -iregex argument of &man.find.1;. See + . + + + + + SHEBANG_GLOB + + + Contains a list of patterns used with the + -name argument of &man.find.1;. See + . + + + + + SHEBANG_FILES + + + Contains a list of files or &man.sh.1; globs. The + shebangfix macro is run from ${WRKSRC}, + so SHEBANG_FILES can contain paths that + are relative to ${WRKSRC}. It can also + deal with absolute paths if files outside of + ${WRKSRC} require patching. See . + + + Currently Bash, @@ -2653,51 +2676,128 @@ are typically obsolete paths, or paths used on other operating systems that are incorrect on &os;. They will be replaced by the correct path in - interp_CMD. - This list will always be part of - interp_OLD_CMD: - "/usr/bin/env interp" - /bin/interp - /usr/bin/interp - /usr/local/bin/interp. + interp_CMD. + + + These will always be part of + interp_OLD_CMD: + "/usr/bin/env + interp" + /bin/interp + /usr/bin/interp + /usr/local/bin/interp. + + + + interp_OLD_CMD + contain multiple values. Any entry with spaces must be + quoted. See . + - To add another interpreter, set - SHEBANG_LANG. For example: + + The fixing of shebangs is done during the + patch phase. If scripts are + created with incorrect shebangs during the + build phase, the build process (for + example, the configure script, or the + Makefiles) must be patched or given the + right path (for example, with + CONFIGURE_ENV, + CONFIGURE_ARGS, + MAKE_ENV, or MAKE_ARGS) + to generate the right shebangs. + + Correct paths for supported interpreters + are available in + interp_CMD. + + + + Adding Another Interpreter to + <literal>USES=shebangfix</literal> - SHEBANG_LANG= lua + To add another interpreter, set + SHEBANG_LANG. For example: + + SHEBANG_LANG= lua + - interp_OLD_CMD - will contain multiple values. Any entry with spaces must be - quoted. For example, if it was not already defined, the - Ksh entry could be defined as: + + Specifying all the Paths When Adding an Interpreter to + <literal>USES=shebangfix</literal> - SHEBANG_LANG= ksh + If it was not already defined, and there were no default + values for + interp_OLD_CMD + and interp_CMD + the Ksh entry could be defined + as: + + SHEBANG_LANG= ksh ksh_OLD_CMD= "/usr/bin/env ksh" /bin/ksh /usr/bin/ksh ksh_CMD= ${LOCALBASE}/bin/ksh + - Some software uses strange locations for an interpreter. - For example, an application might expect - Python to be located in - /opt/bin/python2.7. The strange path to be - replaced can be declared in the port - Makefile: + + Adding a Strange Location for an Interpreter - python_OLD_CMD= /opt/bin/python2.7 + Some software uses strange locations for an interpreter. + For example, an application might expect + Python to be located in + /opt/bin/python2.7. The strange path to + be replaced can be declared in the port + Makefile: - - The fixing of shebangs is done during the - patch phase. If scripts are - created with incorrect shebangs during the - build phase, the build process (for - examples, the configure script, or the - Makefiles) must be patched to generate - the right shebangs. Correct paths for supported interpreters - are available in - interp_CMD. - + python_OLD_CMD= /opt/bin/python2.7 + + + + <literal>USES=shebangfix</literal> with + <varname>SHEBANG_REGEX</varname> + + To fix all the files in + ${WRKSRC}/scripts ending in + .pl, .sh, or + .cgi do: + + USES= shebangfix +SHEBANG_REGEX= ./scripts/.*\.(sh|pl|cgi) + + + SHEBANG_REGEX is used by running + find -E, which uses modern regular + expressions also known as extended regular expressions. See + &man.re.format.7; for more information. + + + + + <literal>USES=shebangfix</literal> with + <varname>SHEBANG_GLOB</varname> + + To fix all the files in ${WRKSRC} + ending in .pl or + .sh, do: + + USES= shebangfix +SHEBANG_GLOB= *.sh *.pl + + + + <literal>USES=shebangfix</literal> with + <varname>SHEBANG_FILES</varname> + + To fix the files script/foobar.pl and + script/*.sh in + ${WRKSRC}, do: + + USES= shebangfix +SHEBANG_FILES= scripts/foobar.pl scripts/*.sh +