summaryrefslogtreecommitdiff
path: root/lib/spack/docs
diff options
context:
space:
mode:
authorKayla Butler <butler59@llnl.gov>2022-03-28 14:18:00 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2022-11-02 09:43:57 -0700
commitbc209c470d07621ba9af277dab71d048d11f2844 (patch)
tree8f48e8785c9462d97046f5bb67ddd30ab4e6ab1f /lib/spack/docs
parentae99829af4393295953afa0f08394bdcd2b58b75 (diff)
downloadspack-bc209c470d07621ba9af277dab71d048d11f2844.tar.gz
spack-bc209c470d07621ba9af277dab71d048d11f2844.tar.bz2
spack-bc209c470d07621ba9af277dab71d048d11f2844.tar.xz
spack-bc209c470d07621ba9af277dab71d048d11f2844.zip
flags/variants: Add ++/~~/== syntax for propagation to dependencies
Currently, compiler flags and variants are inconsistent: compiler flags set for a package are inherited by its dependencies, while variants are not. We should have these be consistent by allowing for inheritance to be enabled or disabled for both variants and compiler flags. - [x] Make new (spec language) operators - [x] Apply operators to variants and compiler flags - [x] Conflicts currently result in an unsatisfiable spec (i.e., you can't propagate two conflicting values) What I propose is using two of the currently used sigils to symbolized that the variant or compiler flag will be inherited: Example syntax: - `package ++variant` enabled variant that will be propagated to dependencies - `package +variant` enabled variant that will NOT be propagated to dependencies - `package ~~variant` disabled variant that will be propagated to dependencies - `package ~variant` disabled variant that will NOT be propagated to dependencies - `package cflags==True` `cflags` will be propagated to dependencies - `package cflags=True` `cflags` will NOT be propagated to dependencies Syntax for string-valued variants is similar to compiler flags.
Diffstat (limited to 'lib/spack/docs')
-rw-r--r--lib/spack/docs/basic_usage.rst38
1 files changed, 32 insertions, 6 deletions
diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst
index 95c37dd8bf..73895449b0 100644
--- a/lib/spack/docs/basic_usage.rst
+++ b/lib/spack/docs/basic_usage.rst
@@ -998,11 +998,15 @@ More formally, a spec consists of the following pieces:
* ``%`` Optional compiler specifier, with an optional compiler version
(``gcc`` or ``gcc@4.7.3``)
* ``+`` or ``-`` or ``~`` Optional variant specifiers (``+debug``,
- ``-qt``, or ``~qt``) for boolean variants
+ ``-qt``, or ``~qt``) for boolean variants. Use ``++`` or ``--`` or
+ ``~~`` to propagate variants through the dependencies (``++debug``,
+ ``--qt``, or ``~~qt``).
* ``name=<value>`` Optional variant specifiers that are not restricted to
- boolean variants
+ boolean variants. Use ``name==<value>`` to propagate variant through the
+ dependencies.
* ``name=<value>`` Optional compiler flag specifiers. Valid flag names are
``cflags``, ``cxxflags``, ``fflags``, ``cppflags``, ``ldflags``, and ``ldlibs``.
+ Use ``name==<value>`` to propagate compiler flags through the dependencies.
* ``target=<value> os=<value>`` Optional architecture specifier
(``target=haswell os=CNL10``)
* ``^`` Dependency specs (``^callpath@1.1``)
@@ -1226,6 +1230,23 @@ variants using the backwards compatibility syntax and uses only ``~``
for disabled boolean variants. The ``-`` and spaces on the command
line are provided for convenience and legibility.
+Spack allows variants to propagate their value to the package's
+dependency by using ``++``, ``--``, and ``~~`` for boolean variants.
+For example, for a ``debug`` variant:
+
+.. code-block:: sh
+
+ mpileaks ++debug # enabled debug will be propagated to dependencies
+ mpileaks +debug # only mpileaks will have debug enabled
+
+To propagate the value of non-boolean variants Spack uses ``name==value``.
+For example, for the ``stackstart`` variant:
+
+.. code-block:: sh
+
+ mpileaks stackstart=4 # variant will be propagated to dependencies
+ mpileaks stackstart==4 # only mpileaks will have this variant value
+
^^^^^^^^^^^^^^
Compiler Flags
^^^^^^^^^^^^^^
@@ -1233,10 +1254,15 @@ Compiler Flags
Compiler flags are specified using the same syntax as non-boolean variants,
but fulfill a different purpose. While the function of a variant is set by
the package, compiler flags are used by the compiler wrappers to inject
-flags into the compile line of the build. Additionally, compiler flags are
-inherited by dependencies. ``spack install libdwarf cppflags="-g"`` will
-install both libdwarf and libelf with the ``-g`` flag injected into their
-compile line.
+flags into the compile line of the build. Additionally, compiler flags can
+be inherited by dependencies by using ``==``.
+``spack install libdwarf cppflags=="-g"`` will install both libdwarf and
+libelf with the ``-g`` flag injected into their compile line.
+
+.. note::
+
+ versions of spack prior to 0.19.0 will propagate compiler flags using
+ the ``=`` syntax.
Notice that the value of the compiler flags must be quoted if it
contains any spaces. Any of ``cppflags=-O3``, ``cppflags="-O3"``,