svn commit: r47681 - head/en_US.ISO8859-1/books/porters-handbook/uses

Mathieu Arnold mat at
Tue Oct 27 09:09:04 UTC 2015

Author: mat
Date: Tue Oct 27 09:09:02 2015
New Revision: 47681

  Enhance USES=shebangfix a bit more.
  Reviewed by:	wblock
  Sponsored by:	Absolight
  Differential Revision:


Modified: head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml
--- head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml	Tue Oct 27 09:06:56 2015	(r47680)
+++ head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml	Tue Oct 27 09:09:02 2015	(r47681)
@@ -1143,8 +1143,19 @@ GSSAPI_NONE_CONFIGURE_ON=	--without-gssa
     <para>A lot of software uses incorrect locations for script
       interpreters, most notably <filename>/usr/bin/perl</filename>
-      and <filename>/bin/bash</filename>.  This fixes shebang lines in
-      scripts listed in <varname>SHEBANG_FILES</varname>.  Currently
+      and <filename>/bin/bash</filename>.  The shebagngfix macro fixes
+      shebang lines in scripts listed in
+      <varname>SHEBANG_FILES</varname>.  The shebangfix macro is run
+      from <literal>${WRKSRC}</literal>, so it can contain paths that
+      are relative to <literal>${WRKSRC}</literal>.  It can also deal
+      with absolute paths if files outside of
+      <literal>${WRKSRC}</literal> require patching.  For
+      example:</para>
+    <programlisting>USES=	shebangfix
+SHEBANG_FILES=	scripts/ scripts/*.sh</programlisting>
+    <para>Currently
       <application>Java</application>, <application>Ksh</application>,
@@ -1154,23 +1165,43 @@ GSSAPI_NONE_CONFIGURE_ON=	--without-gssa
       and <application>Tk</application> are supported by default.  To
       support another interpreter, set
-      <varname><replaceable>foo</replaceable>_OLD_CMD</varname> and
-      <varname><replaceable>foo</replaceable>_CMD</varname>.  For
+      <varname><replaceable>interp</replaceable>_OLD_CMD</varname> and
+      <varname><replaceable>interp</replaceable>_CMD</varname>.  For
     <programlisting>SHEBANG_LANG=	lua
 lua_OLD_CMD=	/usr/bin/lua
 lua_CMD=	${LOCALBASE}/bin/lua</programlisting>
-    <para>As <literal><replaceable>foo</replaceable>_OLD_CMD</literal>
-      can contain multiple values, if an entry contains a space, it
-      needs to be quoted.  For example, if it was not already defined,
-      the <application>Ksh</application> entry could be defined
-      as:</para>
+    <para><literal><replaceable>interp</replaceable>_OLD_CMD</literal>
+      will contain multiple values.  Any entry with spaces must be
+      quoted.  For example, if it was not already defined, the
+      <application>Ksh</application> entry could be defined as:</para>
     <programlisting>SHEBANG_LANG=	ksh
 ksh_OLD_CMD=	"/usr/bin/env ksh" /bin/ksh /usr/bin/ksh
 ksh_CMD=	${LOCALBASE}/bin/ksh</programlisting>
+    <para>Some software uses strange locations for an interpreter.
+      For example, an application might expect
+      <application>Python</application> to be located in
+      <filename>/opt/bin/python2.7</filename>.  The strange path to be
+      replaced can be declared in the port
+      <filename>Makefile</filename>:</para>
+    <programlisting>python_OLD_CMD=	/opt/bin/python2.7</programlisting>
+    <note>
+      <para>The fixing of shebangs is done during the
+	<buildtarget>patch</buildtarget> phase.  If scripts are
+	created with incorrect shebangs during the
+	<buildtarget>build</buildtarget> phase, the build process (for
+	examples, the <filename>configure</filename> script, or the
+	<filename>Makefiles</filename>) must be patched to generate
+	the right shebangs.  Correct paths for supported interpreters
+	are available in
+	<literal><replaceable>interp</replaceable>_CMD</literal>.</para>
+    </note>
   <sect1 xml:id="uses-tar">

More information about the svn-doc-all mailing list