@@ -880,37 +880,29 @@ Miscellaneous options
880
880
.. option :: --constraint=constraint
881
881
882
882
Restrict solutions involving a package to given version
883
- bounds, flag settings, and other properties. For example, to
884
- consider only install plans that use version 2.1 of ``bar ``
885
- or do not use ``bar `` at all, write:
883
+ bounds, flag settings, and other properties.
884
+
885
+ The following considers only install plans where ``bar ``,
886
+ if used, is restricted to version 2.1:
886
887
887
888
::
888
889
889
890
$ cabal install --constraint="bar == 2.1"
890
891
891
- Version bounds have the same syntax as :pkg-field: `build-depends `.
892
- As a special case, the following prevents ``bar `` from being
893
- used at all:
892
+ The following prevents ``bar `` from being used at all:
894
893
895
894
::
896
895
897
- # Note: this is just syntax sugar for '> 1 && < 1', and is
898
- # supported by build-depends.
899
- $ cabal install --constraint="bar -none"
900
-
901
- You can also specify flag assignments:
896
+ $ cabal install --constraint="bar <0"
902
897
903
- ::
904
-
905
- # Require bar to be installed with the foo flag turned on and
906
- # the baz flag turned off.
907
- $ cabal install --constraint="bar +foo -baz"
898
+ Version bounds have the same syntax as :pkg-field: `build-depends `.
899
+ Yet extra pseudo version bounds are available here in addition:
908
900
909
- To specify multiple constraints, you may pass the
910
- ``constraint `` option multiple times.
901
+ - ``installed `` to fix a package to the already installed version.
902
+ Often useful for GHC-supplied packages in combination with :cfg-field: `allow-newer `,
903
+ e.g., ``--allow-newer='*:base' --constraint='base installed' ``.
911
904
912
- There are also some more specialized constraints, which most people
913
- don't generally need:
905
+ - ``source `` to fix a package to the local source copy.
914
906
915
907
::
916
908
@@ -924,18 +916,30 @@ Miscellaneous options
924
916
# specify this.)
925
917
$ cabal install --constraint="bar source"
926
918
919
+ Further, we can specify flag assignments with ``+FLAG `` and ``-FLAG ``
920
+ or enable test (``test ``) and benchmark (``bench ``) suites:
921
+
922
+ ::
923
+
924
+ # Require bar to be installed with the foo flag turned on and
925
+ # the baz flag turned off.
926
+ $ cabal install --constraint="bar +foo -baz"
927
+
927
928
# Require that bar have test suites and benchmarks enabled.
928
929
$ cabal install --constraint="bar test" --constraint="bar bench"
929
930
931
+ To specify multiple constraints, you may pass the
932
+ ``constraint `` option multiple times.
933
+
930
934
By default, constraints only apply to build dependencies
931
935
(:pkg-field: `build-depends `), build dependencies of build
932
936
dependencies, and so on. Constraints normally do not apply to
933
937
dependencies of the ``Setup.hs `` script of any package
934
938
(:pkg-field: `custom-setup:setup-depends `) nor do they apply to build tools
935
939
(:pkg-field: `build-tool-depends `) or the dependencies of build
936
940
tools. To explicitly apply a constraint to a setup or build
937
- tool dependency, you can add a qualifier to the constraint as
938
- follows:
941
+ tool dependency, you can add a qualifier `` setup `` or `` any ``
942
+ to the constraint as follows:
939
943
940
944
::
941
945
0 commit comments