diff --git a/documentation/content/en/books/porters-handbook/makefiles/_index.adoc b/documentation/content/en/books/porters-handbook/makefiles/_index.adoc --- a/documentation/content/en/books/porters-handbook/makefiles/_index.adoc +++ b/documentation/content/en/books/porters-handbook/makefiles/_index.adoc @@ -4100,6 +4100,34 @@ Build targets:: When an option need some extra processing, see <>. +[[flavors_sub]] +==== `FLAVORS_SUB\ + +If `FLAVORS_SUB` is set to `yes` then each of the flavors added to `FLAVORS` will be added to `PLIST_SUB` and `SUB_LIST`, for example: + +[.programlisting] +.... +FLAVORS= flav1 flav2 +FLAVORS_SUB= yes +.... + +is equivalent to: +[.programlisting] +.... +FLAVORS= flav1 flav2 + +.include +.if ${FLAVOR} == flav1 +PLIST_SUB= FLAV1="" NO_FLAV1="@comment " FLAV2="@comment " NO_FLAV2="" +SUB_LIST= FLAV1="" NO_FLAV1="@comment " FLAV2="@comment " NO_FLAV2="" +.fi +.if ${FLAVOR} == flav2 +PLIST_SUB= FLAV2="" NO_FLAV2="@comment " FLAV1="@comment " NO_FLAV1="" +SUB_LIST= FLAV2="" NO_FLAV2="@comment " FLAV1="@comment " NO_FLAV1="" +.fi +.include +.... + [[options_sub]] ==== `OPTIONS_SUB` diff --git a/documentation/content/en/books/porters-handbook/plist/_index.adoc b/documentation/content/en/books/porters-handbook/plist/_index.adoc --- a/documentation/content/en/books/porters-handbook/plist/_index.adoc +++ b/documentation/content/en/books/porters-handbook/plist/_index.adoc @@ -54,6 +54,24 @@ in the [.filename]#Makefile# and use `%%OCTAVE_VERSION%%` wherever the version shows up in [.filename]#pkg-plist#. When the port is upgraded, it will not be necessary to edit dozens (or in some cases, hundreds) of lines in [.filename]#pkg-plist#. +If files are installed conditionally on the flavors set in the port, the usual way of handling it is prefixing [.filename]#pkg-plist# lines with a `%%FLAV%%` for lines needed when the flavor is enabled, or `%%NO_FLAV%%` when the flavor is disabled, and adding `FLAVORS_SUB=yes` to the [.filename]#Makefile#. +See crossref:makefiles[flavors_sub,`FLAVORS_SUB`] for more information. + +For instance, if there arefiles that are only installed when the `X11` flavor is enabled, and [.filename]#Makefile has: + +[.programlisting] +.... +FLAVORS= X11 console +FLAVORS_SUB= yes +.... + +In [.filename]#pkg-plist#, `%%X11%%` in front of the lines only being installed when the flavor is enabled, like this: + +[.programlisting] +.... +%%X11%%bin/foo-gui +.... + If files are installed conditionally on the options set in the port, the usual way of handling it is prefixing [.filename]#pkg-plist# lines with a `%%OPT%%` for lines needed when the option is enabled, or `%%NO_OPT%%` when the option is disabled, and adding `OPTIONS_SUB=yes` to the [.filename]#Makefile#. See crossref:makefiles[options_sub,`OPTIONS_SUB`] for more information.