Page MenuHomeFreeBSD

D32552.1794532706.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D32552.1794532706.diff

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 <<options-targets>>.
+[[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 <bsd.port.pre.mk>
+.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 <bsd.port.post.mk>
+....
+
[[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.

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 13, 1:18 AM (15 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41687533
Default Alt Text
D32552.1794532706.diff (2 KB)

Event Timeline