Porter's Handbook: Add Meson section

- Document new opt_MESON_{DIS,EN}ABLED helpers
- Fix existing examples

Approved by:	bcr
Differential Revision:	https://reviews.freebsd.org/D19554
This commit is contained in:
Tobias Kortkamp 2019-03-12 12:37:40 +00:00
parent 91e8c7b23e
commit faf365ddad
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=52860
3 changed files with 105 additions and 12 deletions

View file

@ -6389,6 +6389,10 @@ FOO_CONFIGURE_ENABLE= foo</programlisting>
<literal>no</literal>, use <xref
linkend="options-meson_yes"/>.</para>
<para>For arguments that take <literal>enabled</literal>
or <literal>disabled</literal>, see <xref
linkend="options-meson_enabled"/>.</para>
<para>For all other cases, use <xref
linkend="options-meson_on"/>.</para>
</listitem>
@ -6711,7 +6715,7 @@ CMAKE_ARGS+= -DOPTIMIZE:BOOL=true
<literal>-D<replaceable>entry</replaceable>:BOOL=false</literal>
is appended to <varname>CONFIGURE_ARGS</varname>.
<varname><replaceable>OPT</replaceable>_CMAKE_BOOL_OFF</varname>
is the oposite,
is the opposite,
<literal>-D<replaceable>entry</replaceable>:BOOL=false</literal>
is appended to <varname>CMAKE_ARGS</varname> when the
option is selected, and
@ -6782,15 +6786,15 @@ MESON_ARGS+= -Dopt=2
<varname><replaceable>OPT</replaceable>_MESON_TRUE</varname>
then
<literal>-D<replaceable>entry</replaceable>=true</literal>
is appended to <varname>CMAKE_ARGS</varname>. When option
is appended to <varname>MESON_ARGS</varname>. When option
<replaceable>OPT</replaceable> is <emphasis>not</emphasis>
selected,
<literal>-D<replaceable>entry</replaceable>=false</literal>
is appended to <varname>CONFIGURE_ARGS</varname>.
is appended to <varname>MESON_ARGS</varname>.
<varname><replaceable>OPT</replaceable>_MESON_FALSE</varname>
is the oposite,
is the opposite,
<literal>-D<replaceable>entry</replaceable>=false</literal>
is appended to <varname>CMAKE_ARGS</varname> when the
is appended to <varname>MESON_ARGS</varname> when the
option is selected, and
<literal>-D<replaceable>entry</replaceable>=true</literal>
when the option is <emphasis>not</emphasis> selected. For
@ -6825,15 +6829,15 @@ MESON_ARGS+= -Dtest=false -Ddebug=false \
<varname><replaceable>OPT</replaceable>_MESON_YES</varname>
then
<literal>-D<replaceable>entry</replaceable>=yes</literal>
is appended to <varname>CMAKE_ARGS</varname>. When option
is appended to <varname>MESON_ARGS</varname>. When option
<replaceable>OPT</replaceable> is <emphasis>not</emphasis>
selected,
<literal>-D<replaceable>entry</replaceable>=no</literal>
is appended to <varname>CONFIGURE_ARGS</varname>.
is appended to <varname>MESON_ARGS</varname>.
<varname><replaceable>OPT</replaceable>_MESON_NO</varname>
is the oposite,
is the opposite,
<literal>-D<replaceable>entry</replaceable>=no</literal>
is appended to <varname>CMAKE_ARGS</varname> when the
is appended to <varname>MESON_ARGS</varname> when the
option is selected, and
<literal>-D<replaceable>entry</replaceable>=yes</literal>
when the option is <emphasis>not</emphasis> selected. For
@ -6850,11 +6854,52 @@ OPT1_MESON_NO= optimize</programlisting>
.include &lt;bsd.port.options.mk&gt;
.if ${PORT_OPTIONS:MOPT1}
CMAKE_ARGS+= -Dtest=yes -Ddebug=yes \
MESON_ARGS+= -Dtest=yes -Ddebug=yes \
-Doptimize=no
.else
CMAKE_ARGS+= -Dtest=no -Ddebug=no \
MESON_ARGS+= -Dtest=no -Ddebug=no \
-Doptimize=yes
.endif</programlisting>
</sect4>
<sect4 xml:id="options-meson_enabled">
<title><varname><replaceable>OPT</replaceable>_MESON_ENABLED</varname>
and
<varname><replaceable>OPT</replaceable>_MESON_DISABLED</varname></title>
<para>When option <replaceable>OPT</replaceable> is
selected, for each <replaceable>entry</replaceable> in
<varname><replaceable>OPT</replaceable>_MESON_ENABLED</varname>
then
<literal>-D<replaceable>entry</replaceable>=enabled</literal>
is appended to <varname>MESON_ARGS</varname>. When option
<replaceable>OPT</replaceable> is <emphasis>not</emphasis>
selected,
<literal>-D<replaceable>entry</replaceable>=disabled</literal>
is appended to <varname>MESON_ARGS</varname>.
<varname><replaceable>OPT</replaceable>_MESON_DISABLED</varname>
is the opposite,
<literal>-D<replaceable>entry</replaceable>=disabled</literal>
is appended to <varname>MESON_ARGS</varname> when the
option is selected, and
<literal>-D<replaceable>entry</replaceable>=enabled</literal>
when the option is <emphasis>not</emphasis> selected. For
example:</para>
<programlisting>OPTIONS_DEFINE= OPT1
OPT1_MESON_ENABLED= test
OPT1_MESON_DISABLED= debug</programlisting>
<para>is equivalent to:</para>
<programlisting>OPTIONS_DEFINE= OPT1
.include &lt;bsd.port.options.mk&gt;
.if ${PORT_OPTIONS:MOPT1}
MESON_ARGS+= -Dtest=enabled -Ddebug=disabled
.else
MESON_ARGS+= -Dtest=disabled -Ddebug=enabled
.endif</programlisting>
</sect4>
</sect3>

View file

@ -1164,6 +1164,53 @@ byteorder-1.2.2 Unlicense/MIT
</note>
</example>
</sect2>
<sect2 xml:id="using-meson">
<title>Using <command>meson</command></title>
<para>For ports that use <application>Meson</application>,
define <literal>USES=meson</literal>.</para>
<table frame="none" xml:id="using-meson-variables">
<title>Variables for Ports That Use
<command>meson</command></title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><varname>MESON_ARGS</varname></entry>
<entry>Port specific <application>Meson</application>
flags to be passed to the <command>meson</command>
binary.</entry>
</row>
<row>
<entry><varname>MESON_BUILD_DIR</varname></entry>
<entry>Path to the build directory relative to
<varname>WRKSRC</varname>. Default is
<literal>_build</literal>.</entry>
</row>
</tbody>
</tgroup>
</table>
<example xml:id="using-meson-example">
<title><literal>USES=meson</literal> Example</title>
<para>This snippet demonstrates the use of
<application>Meson</application> for a port.</para>
<programlisting>USES= meson
MESON_ARGS= -Dfoo=enabled</programlisting>
</example>
</sect2>
</sect1>
<sect1 xml:id="using-autotools">

View file

@ -1965,7 +1965,8 @@ USE_MATE= menus:build intlhack</programlisting>
<para>Possible arguments: (none)</para>
<para>Provide support for Meson based projects.</para>
<para>Provide support for Meson based projects. For more
information see <xref linkend="using-meson" />.</para>
</sect1>
<sect1 xml:id="uses-metaport">