Flatten the Flavor chapter by removing the encapsulating "Flavors

Auto-Activation" section and moving php and Python one setup up.

The only change here is sect2 → sect1 and sect3 → sect2.

Sponsored by:	Absolight
This commit is contained in:
Mathieu Arnold 2018-04-30 15:12:54 +00:00
parent f48191c356
commit 20c25af508
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=51602

View file

@ -259,161 +259,157 @@ lite_PKGNAMESUFFIX= -lite</programlisting>
</sect2>
</sect1>
<sect1 xml:id="flavors-auto">
<title>Flavors Auto-Activation</title>
<sect1 xml:id="flavors-auto-php">
<title><literal>USES=php</literal> and Flavors</title>
<sect2 xml:id="flavors-auto-php">
<title><literal>USES=php</literal> and Flavors</title>
<para>When using <link linkend="uses-php">USES=php</link> with
one of these arguments, <literal>phpize</literal>,
<literal>ext</literal>, <literal>zend</literal>, or
<literal>pecl</literal>, the port will automatically have
<varname>FLAVORS</varname> filled in with the
<application>PHP</application> versions it supports.</para>
<para>When using <link linkend="uses-php">USES=php</link> with
one of these arguments, <literal>phpize</literal>,
<literal>ext</literal>, <literal>zend</literal>, or
<literal>pecl</literal>, the port will automatically have
<varname>FLAVORS</varname> filled in with the
<application>PHP</application> versions it supports.</para>
<note>
<para>All the examples assume the currently supported PHP
versions are 5.6, 7.0, 7.1, and 7.2.</para>
</note>
<note>
<para>All the examples assume the currently supported PHP
versions are 5.6, 7.0, 7.1, and 7.2.</para>
</note>
<example xml:id="flavors-auto-php-ex1">
<title>Simple <literal>USES=php</literal> Extension</title>
<example xml:id="flavors-auto-php-ex1">
<title>Simple <literal>USES=php</literal> Extension</title>
<para>This will generate package for all the supported
versions:</para>
<para>This will generate package for all the supported
versions:</para>
<programlisting>PORTNAME= some-ext
<programlisting>PORTNAME= some-ext
PORTVERSION= 0.0.1
PKGNAMEPREFIX= ${PHP_PKGNAMEPREFIX}
USES= php:ext</programlisting>
<para>This will generate package for all the supported
versions but 7.2:</para>
<para>This will generate package for all the supported
versions but 7.2:</para>
<programlisting>PORTNAME= some-ext
<programlisting>PORTNAME= some-ext
PORTVERSION= 0.0.1
PKGNAMEPREFIX= ${PHP_PKGNAMEPREFIX}
USES= php:ext
IGNORE_WITH_PHP= 72</programlisting>
</example>
</example>
<sect3 xml:id="flavors-auto-php-app">
<title>PHP Flavors with PHP Applications</title>
<sect2 xml:id="flavors-auto-php-app">
<title>PHP Flavors with PHP Applications</title>
<para>PHP applications can also be flavorized.</para>
<para>PHP applications can also be flavorized.</para>
<para>This allows generating packages for all PHP versions, so
that users can use them with whatever version they need on
their servers.</para>
<para>This allows generating packages for all PHP versions, so
that users can use them with whatever version they need on
their servers.</para>
<important>
<para>PHP applications that are flavorized
<emphasis>must</emphasis> append
<varname>PHP_PKGNAMESUFFIX</varname> to their package
names.</para>
</important>
<important>
<para>PHP applications that are flavorized
<emphasis>must</emphasis> append
<varname>PHP_PKGNAMESUFFIX</varname> to their package
names.</para>
</important>
<example xml:id="flavors-auto-php-app-ex1">
<title>Flavorizing a PHP Application</title>
<example xml:id="flavors-auto-php-app-ex1">
<title>Flavorizing a PHP Application</title>
<para>Adding Flavors support to a PHP application is
straightforward:</para>
<para>Adding Flavors support to a PHP application is
straightforward:</para>
<programlisting>PKGNAMESUFFIX= ${PHP_PKGNAMESUFFIX}
<programlisting>PKGNAMESUFFIX= ${PHP_PKGNAMESUFFIX}
USES= php:flavors</programlisting>
</example>
</sect3>
</sect2>
<sect2 xml:id="flavors-auto-python">
<title><literal>USES=python</literal> and Flavors</title>
<para>When using <link
linkend="uses-python"><literal>USES=python</literal></link>
and <literal>USE_PYTHON=distutils</literal>, the port will
automatically have <varname>FLAVORS</varname> filled in with
the <application>Python</application> versions it
supports.</para>
<example xml:id="flavors-auto-python-ex1">
<title>Simple <literal>USES=python</literal></title>
<para>Supposing the current <application>Python</application>
supported versions are 2.7, 3.4, 3.5, and 3.6, and the
default <application>Python</application> 2 and 3 versions
are 2.7 and 3.6, a port with:</para>
<programlisting>USES= python
USE_PYTHON= distutils</programlisting>
<para>Will get these flavors: <literal>py27</literal>, and
<literal>py36</literal>.</para>
<programlisting>USES= python
USE_PYTHON= distutils allflavors</programlisting>
<para>Will get these flavors: <literal>py27</literal>,
<literal>py34</literal>, <literal>py35</literal> and
<literal>py36</literal>.</para>
</example>
<example xml:id="flavors-auto-python-ex2">
<title><literal>USES=python</literal> with Version
Requirements</title>
<para>Supposing the current <application>Python</application>
supported versions are 2.7, 3.4, 3.5, and 3.6, and the
default <application>Python</application> 2 and 3 versions
are 2.7 and 3.6, a port with:</para>
<programlisting>USES= python:-3.5
USE_PYTHON= distutils</programlisting>
<para>Will get this flavor: <literal>py27</literal>.</para>
<programlisting>USES= python:-3.5
USE_PYTHON= distutils allflavors</programlisting>
<para>Will get these flavors: <literal>py27</literal>,
<literal>py34</literal>, and <literal>py35</literal>.</para>
<programlisting>USES= python:3.4+
USE_PYTHON= distutils</programlisting>
<para>Will get this flavor: <literal>py36</literal>.</para>
<programlisting>USES= python:3.4+
USE_PYTHON= distutils allflavors</programlisting>
<para>Will get these flavors: <literal>py34</literal>,
<literal>py35</literal>, and <literal>py36</literal>.</para>
</example>
<para><varname>PY_FLAVOR</varname> will be available to depend
on the correct version of <application>Python</application>
modules. This is most useful for ports that are not
<application>Python</application> modules and do not have
<application>Python</application> flavors but do use
<command>python</command> for some part of their
operations.</para>
<example xml:id="flavors-auto-python-ex3">
<title>For a Port Not Using
<literal>distutils</literal></title>
<para>If the default <application>Python</application> 3
version is 3.6, the following will set
<varname>PY_FLAVOR</varname> to
<literal>py36</literal>:</para>
<programlisting>RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mutagen>0:audio/py-mutagen@${PY_FLAVOR}
USES= python:3.5+</programlisting>
</example>
</sect2>
</sect1>
<sect1 xml:id="flavors-auto-python">
<title><literal>USES=python</literal> and Flavors</title>
<para>When using <link
linkend="uses-python"><literal>USES=python</literal></link>
and <literal>USE_PYTHON=distutils</literal>, the port will
automatically have <varname>FLAVORS</varname> filled in with
the <application>Python</application> versions it
supports.</para>
<example xml:id="flavors-auto-python-ex1">
<title>Simple <literal>USES=python</literal></title>
<para>Supposing the current <application>Python</application>
supported versions are 2.7, 3.4, 3.5, and 3.6, and the
default <application>Python</application> 2 and 3 versions
are 2.7 and 3.6, a port with:</para>
<programlisting>USES= python
USE_PYTHON= distutils</programlisting>
<para>Will get these flavors: <literal>py27</literal>, and
<literal>py36</literal>.</para>
<programlisting>USES= python
USE_PYTHON= distutils allflavors</programlisting>
<para>Will get these flavors: <literal>py27</literal>,
<literal>py34</literal>, <literal>py35</literal> and
<literal>py36</literal>.</para>
</example>
<example xml:id="flavors-auto-python-ex2">
<title><literal>USES=python</literal> with Version
Requirements</title>
<para>Supposing the current <application>Python</application>
supported versions are 2.7, 3.4, 3.5, and 3.6, and the
default <application>Python</application> 2 and 3 versions
are 2.7 and 3.6, a port with:</para>
<programlisting>USES= python:-3.5
USE_PYTHON= distutils</programlisting>
<para>Will get this flavor: <literal>py27</literal>.</para>
<programlisting>USES= python:-3.5
USE_PYTHON= distutils allflavors</programlisting>
<para>Will get these flavors: <literal>py27</literal>,
<literal>py34</literal>, and <literal>py35</literal>.</para>
<programlisting>USES= python:3.4+
USE_PYTHON= distutils</programlisting>
<para>Will get this flavor: <literal>py36</literal>.</para>
<programlisting>USES= python:3.4+
USE_PYTHON= distutils allflavors</programlisting>
<para>Will get these flavors: <literal>py34</literal>,
<literal>py35</literal>, and <literal>py36</literal>.</para>
</example>
<para><varname>PY_FLAVOR</varname> will be available to depend
on the correct version of <application>Python</application>
modules. This is most useful for ports that are not
<application>Python</application> modules and do not have
<application>Python</application> flavors but do use
<command>python</command> for some part of their
operations.</para>
<example xml:id="flavors-auto-python-ex3">
<title>For a Port Not Using
<literal>distutils</literal></title>
<para>If the default <application>Python</application> 3
version is 3.6, the following will set
<varname>PY_FLAVOR</varname> to
<literal>py36</literal>:</para>
<programlisting>RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mutagen>0:audio/py-mutagen@${PY_FLAVOR}
USES= python:3.5+</programlisting>
</example>
</sect1>
</chapter>