From owner-svn-doc-all@freebsd.org Fri May 5 10:33:49 2017 Return-Path: Delivered-To: svn-doc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33D44D5E3B5; Fri, 5 May 2017 10:33:49 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10A5917D2; Fri, 5 May 2017 10:33:48 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45AXmE6097716; Fri, 5 May 2017 10:33:48 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45AXmRp097715; Fri, 5 May 2017 10:33:48 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201705051033.v45AXmRp097715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Fri, 5 May 2017 10:33:48 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r50232 - head/en_US.ISO8859-1/books/porters-handbook/uses X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 10:33:49 -0000 Author: mat Date: Fri May 5 10:33:47 2017 New Revision: 50232 URL: https://svnweb.freebsd.org/changeset/doc/50232 Log: Rewrite the USES=shebangfix section. Reviewed by: bcr Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D10584 Modified: head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml Modified: head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml Fri May 5 07:06:24 2017 (r50231) +++ head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml Fri May 5 10:33:47 2017 (r50232) @@ -2595,25 +2595,48 @@ USE_PYQT= core doc_build designer_run

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: + SHEBANG_FILES. - USES= shebangfix -SHEBANG_FILES= scripts/foobar.pl scripts/*.sh + + + 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 @@ SHEBANG_FILES= scripts/foobar.pl scripts 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. - SHEBANG_LANG= lua + Correct paths for supported interpreters + are available in + interp_CMD. + - 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: + + Adding Another Interpreter to + <literal>USES=shebangfix</literal> + + To add another interpreter, set + SHEBANG_LANG. For example: + + SHEBANG_LANG= lua + + + + Specifying all the Paths When Adding an Interpreter to + <literal>USES=shebangfix</literal> + + 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 + 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: + + 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: - - 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. - + USES= shebangfix +SHEBANG_FILES= scripts/foobar.pl scripts/*.sh +