1 cabal.project Reference
2 =======================
4 ``cabal.project`` files support a variety of options which configure the
5 details of your build. The general syntax of a ``cabal.project`` file is
6 similar to that of a Cabal file: there are a number of fields, some of
7 which live inside stanzas (groups of fields that apply to only part of a
8 project or can be referenced as a unit):
13 with-compiler: /opt/ghc/8.0.1/bin/ghc
18 In general, the accepted field names coincide with the accepted command
19 line flags that ``cabal install`` and other commands take. For example,
20 ``cabal configure --enable-profiling`` will write out a project
21 file with ``profiling: True``.
23 The full configuration of a project is determined by combining the
24 following sources (later entries override earlier ones, except for appendable
27 1. :ref:`The user-wide global configuration <config-file-discovery>` (default: ``~/.config/cabal/config``)
29 2. ``cabal.project`` (the project configuration)
31 3. ``cabal.project.freeze`` (the output of ``cabal freeze``)
33 4. ``cabal.project.local`` (the output of ``cabal configure``)
35 Any call to ``cabal build`` will consider ``cabal.project*`` files from parent
36 directories when there is none in the current directory.
38 .. _conditionals and imports:
40 Conditionals and imports
41 ------------------------
43 As of ``cabal-install`` version 3.8, cabal supports conditional logic
44 and imports in ``cabal.project`` files. :ref:`conditions` in cabal
45 may case on operating system, architecture, and
46 compiler (i.e. there is no support for a notion of custom flags in
47 project files). Imports may specify local filepaths or remote urls,
48 and may reference either cabal.project files or v1-style cabal.config
49 freeze files. As a usage example:
56 packages: freebsd/*.cabal
60 import: https://some.remote.source/subdir/cabal.config
62 import: relativepath/extra-project.project
64 import: /absolutepath/some-project.project
66 Using conditionals will force cabal to find a ghc to derive
67 architecture and version information from, which will force some
68 commands (update, sdist) to require ghc present where otherwise it
69 would not be necessitated.
71 Specifying the local packages
72 -----------------------------
74 The following top-level options specify what the local packages of a
77 .. cfg-field:: packages: package location list (space or comma separated)
78 :synopsis: Project packages.
80 :default: ``./*.cabal``
84 The default value ``./*.cabal`` only takes effect if there is no explicit
85 ``cabal.project`` file.
86 If you use such explicit file you *must* fill the field.
88 Specifies the list of package locations which contain the local
89 packages to be built by this project. Package locations can take the
92 1. They can specify a Cabal file, or a directory containing a Cabal
93 file, e.g., ``packages: Cabal cabal-install/cabal-install.cabal``.
95 2. They can specify glob-style wildcards, which must match one or
96 more (a) directories containing a (single) Cabal file, (b) Cabal
97 files (extension ``.cabal``), or (c) tarballs which contain Cabal
98 packages (extension ``.tar.gz``).
99 For example, to match all Cabal files in all
100 subdirectories, as well as the Cabal projects in the parent
101 directories ``foo`` and ``bar``, use
102 ``packages: */*.cabal ../{foo,bar}/``
104 3. They can specify an ``http``, ``https`` or ``file``
105 URL, representing the path to a remote tarball to be downloaded
108 There is no command line variant of this field; see :issue:`3585`.
109 Note that the default value is only included if there is no
110 ``cabal.project`` file. The field is appendable which means there would be
111 no way to drop the default value if it was included.
113 .. cfg-field:: optional-packages: package location list (space or comma-separated)
114 :synopsis: Optional project packages.
118 Like :cfg-field:`packages`, specifies a list of package locations
119 containing local packages to be built. Unlike :cfg-field:`packages`,
120 if we glob for a package, it is permissible for the glob to match against
121 zero packages. The intended use-case for :cfg-field:`optional-packages`
122 is to make it so that vendored packages can be automatically picked up if
123 they are placed in a subdirectory, but not error if there aren't any.
125 There is no command line variant of this field.
127 .. cfg-field:: extra-packages: package list with version bounds (comma separated)
128 :synopsis: Adds external packages as local
130 Specifies a list of external packages from Hackage, which
131 should be considered local packages. The motivation for
132 :cfg-field:`extra-packages` is making libraries that are not
133 dependencies of any package in the project available for use in ghci.
135 There is no command line variant of this field.
139 All local packages are *vendored*, in the sense that if other packages
140 (including external ones from Hackage) depend on a package with the name
141 of a local package, the local package is preferentially used.
142 For subdirectories to be considered local packages, the following setting
146 optional-packages: ./*/*.cabal
148 ...then any package can be vendored simply by making a checkout in the
149 top-level project directory, as might be seen in this hypothetical
153 foo-helper/ # local package
154 unix/ # vendored external package
156 All of these options support globs. ``cabal build`` has its own glob
159 - Anywhere in a path, as many times as you like, you can specify an
160 asterisk ``*`` wildcard. E.g., ``*/*.cabal`` matches all ``.cabal``
161 files in all immediate subdirectories. Like in glob(7), asterisks do
162 not match hidden files unless there is an explicit period, e.g.,
163 ``.*/foo.cabal`` will match ``.private/foo.cabal`` (but
164 ``*/foo.cabal`` will not).
166 - You can use braces to specify specific directories; e.g.,
167 ``{vendor,pkgs}/*.cabal`` matches all Cabal files in the ``vendor``
168 and ``pkgs`` subdirectories.
170 Formally, the format is described by the following BNF:
173 convert globbing grammar to proper ABNF_ syntax
177 FilePathGlob ::= FilePathRoot FilePathGlobRel
178 FilePathRoot ::= {- empty -} # relative to cabal.project
180 | [a-zA-Z] ":" [/\\] # Windows root
181 | "~" # home directory
182 FilePathGlobRel ::= Glob "/" FilePathGlobRel # Unix directory
183 | Glob "\\" FilePathGlobRel # Windows directory
185 | {- empty -} # trailing slash
187 GlobPiece ::= "*" # wildcard
188 | [^*{},/\\] * # literal string
189 | "\\" [*{},] # escaped reserved character
190 | "{" Glob "," ... "," Glob "}" # union (match any of these)
193 Specifying Packages from Remote Version Control Locations
194 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 Starting with Cabal 2.4, there is now a stanza
197 ``source-repository-package`` for specifying packages from an external
200 .. code-block:: cabal
204 source-repository-package
206 location: https://github.com/hvr/HsYAML.git
207 tag: e70cf0c171c9a586b62b3f75d72f1591e4e6aaa1
209 source-repository-package
211 location: https://github.com/well-typed/cborg
212 tag: 3d274c14ca3077c3a081ba7ad57c5182da65c8c1
215 source-repository-package
217 location: https://github.com/haskell/network.git
218 tag: e76fdc753e660dfa615af6c8b6a2ad9ddf6afe70
219 post-checkout-command: autoreconf -i
221 cabal-install 3.4 sdists the ``source-repository-package`` repositories and uses resulting tarballs as project packages.
222 This allows sharing of packages across different projects.
224 .. cfg-field:: type: VCS kind
226 .. cfg-field:: location: VCS location (usually URL)
228 .. cfg-field:: tag: VCS tag
230 .. cfg-field:: subdir: subdirectory list
232 Use one or more subdirectories of the repository.
234 .. cfg-field:: post-checkout-command: command
236 Run command in the checked out repository, prior sdisting.
238 Global configuration options
239 ----------------------------
241 The following top-level configuration options are not specific to any
242 package, and thus apply globally:
245 .. cfg-field:: verbose: nat
247 :synopsis: Build verbosity level.
251 Control the verbosity of ``cabal`` commands, valid values are from 0
254 The command line variant of this field is ``--verbose=2``; a short
255 form ``-v2`` is also supported.
257 .. cfg-field:: jobs: nat or $ncpus
258 --jobs=n, -jn, --jobs=$ncpus
259 :synopsis: Number of builds running in parallel.
263 Run *nat* jobs simultaneously when building. If ``$ncpus`` is
264 specified, run the number of jobs equal to the number of CPUs.
265 Package building is often quite parallel, so turning on parallelism
266 can speed up build times quite a bit!
268 The command line variant of this field is ``--jobs=2``; a short form
269 ``-j2`` is also supported; a bare ``--jobs`` or ``-j`` is equivalent
270 to ``--jobs=$ncpus``.
272 .. cfg-field:: keep-going: boolean
274 :synopsis: Try to continue building on failure.
278 If true, after a build failure, continue to build other unaffected
281 The command line variant of this field is ``--keep-going``.
283 .. option:: --builddir=DIR
285 Specifies the name of the directory where build products for
286 build will be stored; defaults to ``dist-newstyle``. If a
287 relative name is specified, this directory is resolved relative
288 to the root of the project (i.e., where the ``cabal.project``
291 This option cannot be specified via a ``cabal.project`` file.
293 .. _cmdoption-project-dir:
294 .. option:: --project-dir=DIR
296 Specifies the path of the project directory. If a relative
297 :ref:`project-file<cmdoption-project-file>` path is also specified,
298 it will be resolved relative to this directory.
300 The project directory need not contain a ``cabal.project`` file.
302 This option cannot be specified via a ``cabal.project`` file.
304 .. _cmdoption-project-file:
305 .. option:: --project-file=FILE
307 Specifies the path and name of the project file used to specify the
308 rest of the top-level configuration; defaults to ``cabal.project``.
309 This name not only specifies the name of the main project file,
310 but also the auxiliary project files ``cabal.project.freeze``
311 and ``cabal.project.local``; for example, if you specify
312 ``--project-file=my.project``, then the other files that will
313 be probed are ``my.project.freeze`` and ``my.project.local``.
315 If :ref:`project-dir<cmdoption-project-dir>` is not specified,
316 and the path is relative, we will
317 look for the file relative to the current working directory,
318 and then for the parent directory, until the project file is
319 found or we have hit the top of the user's home directory.
321 This option cannot be specified via a ``cabal.project`` file.
323 .. option:: --ignore-project
325 Ignores the local ``cabal.project`` file and uses the default
326 configuration with the local ``foo.cabal`` file. Note that
327 this flag will be ignored if either of the ``--project-dir`` or
328 ``--project-file`` flags are also set.
330 .. option:: --store-dir=DIR
332 Specifies the name of the directory of the global package store.
334 .. cfg-field:: package-dbs: package DB stack (comma separated)
335 --package-db=[clear, global, user, PATH]
336 :synopsis: PackageDB stack manipulation
339 There are three package databases involved with most builds:
342 Compiler installation of rts, base, etc.
344 Nix-style local build cache
346 Project-specific build directory
348 By default, the package stack you will have with v2 commands is:
354 So all remote packages required by your project will be
355 registered in the store package db (because it is last).
357 When cabal starts building your local projects, it appends the in-place db
362 -- [global, store, in-place]
364 So your local packages get put in ``dist-newstyle`` instead of the store.
366 This flag manipulates the default prefix: ``[global, store]`` and accepts
367 paths, the special value ``global`` referring to the global package db, and
368 ``clear`` which removes all prior entries. For example,
372 -- [global, store, foo]
376 package-dbs: clear, foo
379 package-dbs: clear, foo, clear, bar, baz
381 The command line variant of this flag is ``--package-db=DB`` which can be
382 specified multiple times.
387 The following settings apply to commands that result in build actions
388 (``build``, ``run``, ``repl``, ``test``...), and control which phases of the
391 .. option:: --dry-run
393 Do not download, build, or install anything, only print what would happen.
395 .. option:: --only-configure
397 Instead of performing a full build just run the configure step.
398 Only accepted by the ``build`` command.
400 .. option:: --only-download
402 Do not build anything, only fetch the packages.
404 .. option:: --only-dependencies
406 Install only the dependencies necessary to build the given packages.
407 Not accepted by the ``repl`` command.
409 Solver configuration options
410 ----------------------------
412 The following settings control the behavior of the dependency solver:
414 .. cfg-field:: constraints: constraints list (comma separated)
415 --constraint="pkg >= 2.0", -c "pkg >= 2.0"
416 :synopsis: Extra dependencies constraints.
418 Add extra constraints to the version bounds, flag settings,
419 and other properties a solver can pick for a
420 package. For example:
424 constraints: bar == 2.1
426 A package can be specified multiple times in ``constraints``, in
427 which case the specified constraints are intersected. This is
428 useful, since the syntax does not allow you to specify multiple
429 constraints at once. For example, to specify both version bounds and
430 flag assignments, you would write:
434 constraints: bar == 2.1,
437 Valid constraints take the same form as for the
438 :option:`runhaskell Setup.hs configure --constraint`
441 .. cfg-field:: preferences: preference (comma separated)
442 --preference="pkg >= 2.0"
443 :synopsis: Preferred dependency versions.
445 Like :cfg-field:`constraints`, but the solver will attempt to satisfy
446 these preferences on a best-effort basis. The resulting install is locally
447 optimal with respect to preferences; specifically, no single package
448 could be replaced with a more preferred version that still satisfies
449 the hard constraints.
451 Operationally, preferences can cause the solver to attempt certain
452 version choices of a package before others, which can improve
453 dependency solver runtime.
455 One way to use :cfg-field:`preferences` is to take a known working set of
456 constraints (e.g., via ``cabal freeze``) and record them as
457 preferences. In this case, the solver will first attempt to use this
458 configuration, and if this violates hard constraints, it will try to
459 find the minimal number of upgrades to satisfy the hard constraints
462 The command line variant of this field is
463 ``--preference="pkg >= 2.0"``; to specify multiple preferences, pass
464 the flag multiple times.
466 .. cfg-field:: allow-newer: none, all or list of scoped package names (space or comma separated)
467 --allow-newer, --allow-newer=[none,all,[scope:][^]pkg]
468 :synopsis: Lift dependencies upper bound constraints.
472 Allow the solver to pick more recent version of some packages than
473 would normally be permitted by the :pkg-field:`build-depends` bounds
474 of packages in the install plan. This option may be useful if the
475 dependency solver cannot otherwise find a valid install plan.
477 For example, to relax ``pkg``\ s :pkg-field:`build-depends` upper bound on
478 ``dep-pkg``, write a scoped package name of the form:
482 allow-newer: pkg:dep-pkg
484 If the scope shall be limited to specific releases of ``pkg``, the
489 allow-newer: pkg-1.2.3:dep-pkg, pkg-1.1.2:dep-pkg
491 can be used to limit the relaxation of dependencies on
492 ``dep-pkg`` by the ``pkg-1.2.3`` and ``pkg-1.1.2`` releases only.
494 The scoped syntax is recommended, as it is often only a single package
495 whose upper bound is misbehaving. In this case, the upper bounds of
496 other packages should still be respected; indeed, relaxing the bound
497 can break some packages which test the selected version of packages.
499 The syntax also allows to prefix the dependee package with a
500 modifier symbol to modify the scope/semantic of the relaxation
501 transformation in a additional ways. Currently only one modifier
502 symbol is defined, i.e. ``^`` (i.e. caret) which causes the
503 relaxation to be applied only to ``^>=`` operators and leave all other
504 version operators untouched.
506 However, in some situations (e.g., when attempting to build packages
507 on a new version of GHC), it is useful to disregard *all*
508 upper-bounds, with respect to a package or all packages. This can be
509 done by specifying just a package name, or using the keyword ``all``
510 to specify all packages:
514 -- Disregard upper bounds involving the dependencies on
515 -- packages bar, baz. For quux only, relax
516 -- 'quux ^>= ...'-style constraints only.
517 allow-newer: bar, baz, ^quux
519 -- Disregard all upper bounds when dependency solving
522 -- Disregard all `^>=`-style upper bounds when dependency solving
526 For consistency, there is also the explicit wildcard scope syntax
527 ``*`` (or its alphabetic synonym ``all``). Consequently, the
528 examples above are equivalent to the explicitly scoped variants:
532 allow-newer: all:bar, *:baz, *:^quux
538 allow-newer: all:^all
540 In order to ignore all bounds specified by a package ``pkg-1.2.3``
541 you can combine scoping with a right-hand-side wildcard like so
545 -- Disregard any upper bounds specified by pkg-1.2.3
546 allow-newer: pkg-1.2.3:*
548 -- Disregard only `^>=`-style upper bounds in pkg-1.2.3
549 allow-newer: pkg-1.2.3:^*
552 :cfg-field:`allow-newer` is often used in conjunction with a constraint
553 (in the :cfg-field:`constraints` field) forcing the usage of a specific,
554 newer version of a package.
556 The command line variant of this field is e.g. ``--allow-newer=bar``. A
557 bare ``--allow-newer`` is equivalent to ``--allow-newer=all``.
559 .. cfg-field:: allow-older: none, all, list of scoped package names (space or comma separated)
560 --allow-older, --allow-older=[none,all,[scope:][^]pkg]
561 :synopsis: Lift dependency lower bound constraints.
566 Like :cfg-field:`allow-newer`, but applied to lower bounds rather than
569 The command line variant of this field is ``--allow-older=all``. A
570 bare ``--allow-older`` is equivalent to ``--allow-older=all``.
573 .. cfg-field:: index-state: HEAD, unix-timestamp, ISO8601 UTC timestamp.
574 :synopsis: Use source package index state as it existed at a previous time.
579 This allows to change the source package index state the solver uses
580 to compute install-plans. This is particularly useful in
581 combination with freeze-files in order to also freeze the state the
582 package index was in at the time the install-plan was frozen.
586 -- UNIX timestamp format example
587 index-state: @1474739268
589 -- ISO8601 UTC timestamp format example
590 -- This format is used by 'cabal configure'
591 -- for storing `--index-state` values.
592 index-state: 2016-09-24T17:47:48Z
594 -- Specify different index-states per package repository
595 -- Supported since 3.4
597 , hackage.haskell.org 2020-05-06T22:33:27Z
598 , head.hackage 2020-04-29T04:11:05Z
600 .. cfg-field:: active-repositories: reponame1, reponame2
602 :synopsis: Specify active package repositories
607 Specifies which of the package repositories defined in the configuration
608 should be active. It's also useful for specifying the order and the way
609 active repositories are merged.
611 When searching for a certain version of a certain package name, the list of
612 active repositories is searched last-to-first.
614 For example, suppose hackage.haskell.org has versions 1.0 and 2.0 of
615 package X, and my-repository has version 2.0 of a similarly named package.
616 Then, with the following configuration:
620 -- Force my-repository to be the first repository considered
622 , hackage.haskell.org
625 version 2.0 of X will come from my-repository, and version 1.0 will come
626 from hackage.haskell.org.
628 If we want to make a repository the sole provider of certain packages, we
629 can put it last in the active repositories list, and add the :override
632 For example, if we modify the previous example like this:
637 , hackage.haskell.org
638 , my-repository:override
640 then version 1.0 of package X won't be found in any case, because X is
641 present in my-repository only in version 2.0, and the :override forbids
642 searching for other versions of X further up the list.
644 :override has no effect for package names that aren't present in the
645 overriding repository.
647 The special repository reference :rest stands for "all the other repositories"
648 and can be useful to avoid lengthy lists of repository names:
652 -- Force my-repository to be the first repository considered
653 active-repositories: :rest, my-repository
655 The special repository reference :none disables all repositories, effectively
656 putting cabal in "offline" mode:
660 active-repositories: :none
663 .. cfg-field:: reject-unconstrained-dependencies: all, none
664 --reject-unconstrained-dependencies=[all|none]
665 :synopsis: Restrict the solver to packages that have constraints on them.
670 By default, the dependency solver can include any package that it's
671 aware of in a build plan. If you wish to restrict the build plan to
672 a closed set of packages (e.g., from a freeze file), use this flag.
674 When set to `all`, all non-local packages that aren't goals must be
675 explicitly constrained. When set to `none`, the solver will
676 consider all packages.
679 Package configuration options
680 -----------------------------
682 Package options affect the building of specific packages. There are three
683 ways a package option can be specified:
685 - They can be specified at the top-level, in which case they apply only
686 to **local package**, or
688 - They can be specified inside a ``package`` stanza, in which case they
689 apply to the build of the package, whether or not it is local or
692 - They can be specified inside an ``package *`` stanza, in which case they
693 apply to all packages, local ones from the project and also external
697 For example, the following options specify that :cfg-field:`optimization`
698 should be turned off for all local packages, and that ``bytestring`` (possibly
699 an external dependency) should be built with ``-fno-state-hack``::
704 ghc-options: -fno-state-hack
706 ``ghc-options`` is not specifically described in this documentation, but is one
707 of many fields for configuring programs. They take the form
708 ``progname-options`` and ``progname-location``, and can be set for all local
709 packages in a ``program-options`` stanza or under a package stanza.
711 On the command line, these options are applied to all local packages.
712 There is no per-package command line interface.
714 Some flags were added by more recent versions of the Cabal library. This
715 means that they are NOT supported by packages which use Custom setup
716 scripts that require a version of the Cabal library older than when the
719 .. cfg-field:: flags: list of +flagname or -flagname (space separated)
720 --flags="+foo -bar", -ffoo, -f-bar
721 :synopsis: Enable or disable package flags.
723 Force all flags specified as ``+flagname`` to be true, and all flags
724 specified as ``-flagname`` to be false. For example, to enable the
725 flag ``foo`` and disable ``bar``, set:
731 Exactly one of + or - is required before each flag.
733 Flags are *per-package*, so it doesn't make much sense to specify
734 flags at the top-level, unless you happen to know that *all* of your
735 local packages support the same named flags. If a flag is not
736 supported by a package, it is ignored.
738 See also the solver configuration field :cfg-field:`constraints`.
740 The command line variant of this flag is ``--flags``. There is also
741 a shortened form ``-ffoo -f-bar``.
743 A common mistake is to say ``cabal build -fhans``, where
744 ``hans`` is a flag for a transitive dependency that is not in the
745 local package; in this case, the flag will be silently ignored. If
746 ``haskell-tor`` is the package you want this flag to apply to, try
747 ``--constraint="haskell-tor +hans"`` instead.
749 .. cfg-field:: with-compiler: executable
750 --with-compiler=executable
751 :synopsis: Path to compiler executable.
753 Specify the path to a particular compiler to be used. If not an
754 absolute path, it will be resolved according to the ``PATH``
755 environment. The type of the compiler (GHC, GHCJS, etc) must be
756 consistent with the setting of the :cfg-field:`compiler` field.
758 The most common use of this option is to specify a different version
759 of your compiler to be used; e.g., if you have ``ghc-7.8`` in your
760 path, you can specify ``with-compiler: ghc-7.8`` to use it.
762 This flag also sets the default value of :cfg-field:`with-hc-pkg`, using
763 the heuristic that it is named ``ghc-pkg-7.8`` (if your executable name
764 is suffixed with a version number), or is the executable named
765 ``ghc-pkg`` in the same directory as the ``ghc`` directory. If this
766 heuristic does not work, set :cfg-field:`with-hc-pkg` explicitly.
768 For inplace packages, ``cabal build`` maintains a separate build
769 directory for each version of GHC, so you can maintain multiple
770 build trees for different versions of GHC without clobbering each
773 It's not possible to set :cfg-field:`with-compiler` on a
776 The command line variant of this flag is
777 ``--with-compiler=ghc-7.8``; there is also a short version
780 .. cfg-field:: with-hc-pkg: executable
781 --with-hc-pkg=executable
782 :synopsis: Specifies package tool.
784 Specify the path to the package tool, e.g., ``ghc-pkg``. This
785 package tool must be compatible with the compiler specified by
786 :cfg-field:`with-compiler` (generally speaking, it should be precisely
787 the tool that was distributed with the compiler). If this option is
788 omitted, the default value is determined from :cfg-field:`with-compiler`.
790 The command line variant of this flag is
791 ``--with-hc-pkg=ghc-pkg-7.8``.
793 .. cfg-field:: optimization: nat
794 --enable-optimization
795 --disable-optimization
796 :synopsis: Build with optimization.
800 Build with optimization. This is appropriate for production use,
801 taking more time to build faster libraries and programs.
803 The optional *nat* value is the optimisation level. Some compilers
804 support multiple optimisation levels. The range is 0 to 2. Level 0
805 disables optimization, level 1 is the default. Level 2 is higher
806 optimisation if the compiler supports it. Level 2 is likely to lead
807 to longer compile times and bigger generated code. If you are not
808 planning to run code, turning off optimization will lead to better
809 build times and less code to be rebuilt when a module changes.
811 When optimizations are enabled, Cabal passes ``-O2`` to the C compiler.
813 We also accept ``True`` (equivalent to 1) and ``False`` (equivalent
816 Note that as of GHC 8.0, GHC does not recompile when optimization
817 levels change (see :ghc-ticket:`10923`), so if
818 you change the optimization level for a local package you may need
819 to blow away your old build products in order to rebuild with the
820 new optimization level.
822 The command line variant of this flag is ``-O2`` (with ``-O1``
823 equivalent to ``-O``). There are also long-form variants
824 ``--enable-optimization`` and ``--disable-optimization``.
826 .. cfg-field:: configure-options: args (space separated)
827 --configure-option=arg
828 :synopsis: Options to pass to configure script.
830 A list of extra arguments to pass to the external ``./configure``
831 script, if one is used. This is only useful for packages which have
832 the ``Configure`` build type. See also the section on
833 :ref:`system-dependent parameters`.
835 The command line variant of this flag is ``--configure-option=arg``,
836 which can be specified multiple times to pass multiple options.
838 .. cfg-field:: compiler: ghc, ghcjs, jhc, lhc, uhc or haskell-suite
840 :synopsis: Compiler to build with.
844 Specify the compiler toolchain to be used. This is independent of
845 ``with-compiler``, because the choice of toolchain affects Cabal's
848 The command line variant of this flag is ``--compiler=ghc``.
850 It's not possible to set :cfg-field:`compiler` on a
853 .. cfg-field:: tests: boolean
856 :synopsis: Build tests.
860 Force test suites to be enabled. For most users this should not be
861 needed, as we always attempt to solve for test suite dependencies,
862 even when this value is ``False``; furthermore, test suites are
863 automatically enabled if they are requested as a built target.
865 The command line variant of this flag is ``--enable-tests`` and
868 .. cfg-field:: benchmarks: boolean
871 :synopsis: Build benchmarks.
875 Force benchmarks to be enabled. For most users this should not be
876 needed, as we always attempt to solve for benchmark dependencies,
877 even when this value is ``False``; furthermore, benchmarks are
878 automatically enabled if they are requested as a built target.
880 The command line variant of this flag is ``--enable-benchmarks`` and
881 ``--disable-benchmarks``.
883 .. cfg-field:: extra-prog-path: paths (newline or comma separated)
884 --extra-prog-path=PATH
885 :synopsis: Add directories to program search path.
888 A list of directories to search for extra required programs. Most
889 users should not need this, as programs like ``happy`` and ``alex``
890 will automatically be installed and added to the path. This can be
891 useful if a ``Custom`` setup script relies on an exotic extra
894 The command line variant of this flag is ``--extra-prog-path=PATH``,
895 which can be specified multiple times.
897 .. cfg-field:: run-tests: boolean
899 :synopsis: Run package test suite upon installation.
903 Run the package test suite upon installation. This is useful for
904 saying "When this package is installed, check that the test suite
905 passes, terminating the rest of the build if it is broken."
909 One deficiency: the :cfg-field:`run-tests` setting of a package is NOT
910 recorded as part of the hash, so if you install something without
911 :cfg-field:`run-tests` and then turn on ``run-tests``, we won't
912 subsequently test the package. If this is causing you problems, give
915 The command line variant of this flag is ``--run-tests``.
920 .. cfg-field:: debug-info: integer
921 --enable-debug-info=<n>
923 :synopsis: Build with debug info enabled.
928 If the compiler (e.g., GHC 7.10 and later) supports outputting OS
929 native debug info (e.g., DWARF), setting ``debug-info: True`` will
930 instruct it to do so. See the GHC wiki page on :ghc-wiki:`DWARF`
931 for more information about this feature.
933 (This field also accepts numeric syntax, but until GHC 8.2 this didn't
936 The command line variant of this flag is ``--enable-debug-info`` and
937 ``--disable-debug-info``.
939 .. cfg-field:: split-sections: boolean
940 --enable-split-sections
941 --disable-split-sections
942 :synopsis: Use GHC's split sections feature.
947 Use the GHC ``-split-sections`` feature when building the library. This
948 reduces the final size of the executables that use the library by
949 allowing them to link with only the bits that they use rather than
950 the entire library. The downside is that building the library takes
951 longer and uses a bit more memory.
953 This feature is supported by GHC 8.0 and later.
955 The command line variant of this flag is ``--enable-split-sections`` and
956 ``--disable-split-sections``.
958 .. cfg-field:: split-objs: boolean
961 :synopsis: Use GHC's split objects feature.
965 Use the GHC ``-split-objs`` feature when building the library. This
966 reduces the final size of the executables that use the library by
967 allowing them to link with only the bits that they use rather than
968 the entire library. The downside is that building the library takes
969 longer and uses considerably more memory.
971 It is generally recommend that you use ``split-sections`` instead
972 of ``split-objs`` where possible.
974 The command line variant of this flag is ``--enable-split-objs`` and
975 ``--disable-split-objs``.
977 .. cfg-field:: executable-stripping: boolean
978 --enable-executable-stripping
979 --disable-executable-stripping
980 :synopsis: Strip installed programs.
984 When installing binary executable programs, run the ``strip``
985 program on the binary. This can considerably reduce the size of the
986 executable binary file. It does this by removing debugging
987 information and symbols.
989 Not all Haskell implementations generate native binaries. For such
990 implementations this option has no effect.
992 If ``debug-info`` is set explicitly then ``executable-stripping`` is set
993 to ``False`` as otherwise all the debug symbols will be stripped.
995 The command line variant of this flag is
996 ``--enable-executable-stripping`` and
997 ``--disable-executable-stripping``.
999 .. cfg-field:: library-stripping: boolean
1000 --enable-library-stripping
1001 --disable-library-stripping
1002 :synopsis: Strip installed libraries.
1005 When installing binary libraries, run the ``strip`` program on the
1006 binary, saving space on the file system. See also
1007 ``executable-stripping``.
1009 If ``debug-info`` is set explicitly then ``library-stripping`` is set
1010 to ``False`` as otherwise all the debug symbols will be stripped.
1012 The command line variant of this flag is
1013 ``--enable-library-stripping`` and ``--disable-library-stripping``.
1018 .. cfg-field:: program-prefix: prefix
1019 --program-prefix=prefix
1020 :synopsis: Prepend prefix to program names.
1022 :strike:`Prepend *prefix* to installed program names.` (Currently
1023 implemented in a silly and not useful way. If you need this to work
1026 *prefix* may contain the following path variables: ``$pkgid``,
1027 ``$pkg``, ``$version``, ``$compiler``, ``$os``, ``$arch``, ``$abi``,
1030 The command line variant of this flag is ``--program-prefix=foo-``.
1032 .. cfg-field:: program-suffix: suffix
1033 --program-suffix=suffix
1034 :synopsis: Append refix to program names.
1036 :strike:`Append *suffix* to installed program names.` (Currently
1037 implemented in a silly and not useful way. If you need this to work
1040 The most obvious use for this is to append the program's version
1041 number to make it possible to install several versions of a program
1042 at once: ``program-suffix: $version``.
1044 *suffix* may contain the following path variables: ``$pkgid``,
1045 ``$pkg``, ``$version``, ``$compiler``, ``$os``, ``$arch``, ``$abi``,
1048 The command line variant of this flag is
1049 ``--program-suffix='$version'``.
1051 Dynamic linking options
1052 ^^^^^^^^^^^^^^^^^^^^^^^
1054 .. cfg-field:: shared: boolean
1057 :synopsis: Build shared library.
1061 Build shared library. This implies a separate compiler run to
1062 generate position independent code as required on most platforms.
1064 The command line variant of this flag is ``--enable-shared`` and
1065 ``--disable-shared``.
1067 .. cfg-field:: executable-dynamic: boolean
1068 --enable-executable-dynamic
1069 --disable-executable-dynamic
1070 :synopsis: Link executables dynamically.
1074 Link executables dynamically. The executable's library dependencies
1075 should be built as shared objects. This implies ``shared: True``
1076 unless ``shared: False`` is explicitly specified.
1078 The command line variant of this flag is
1079 ``--enable-executable-dynamic`` and
1080 ``--disable-executable-dynamic``.
1082 .. cfg-field:: library-for-ghci: boolean
1083 --enable-library-for-ghci
1084 --disable-library-for-ghci
1085 :synopsis: Build libraries suitable for use with GHCi.
1089 Build libraries suitable for use with GHCi. This involves an extra
1090 linking step after the build.
1092 Not all platforms support GHCi and indeed on some platforms, trying
1093 to build GHCi libs fails. In such cases, consider setting
1094 ``library-for-ghci: False``.
1096 The command line variant of this flag is
1097 ``--enable-library-for-ghci`` and ``--disable-library-for-ghci``.
1099 .. cfg-field:: relocatable:
1101 :synopsis: Build relocatable package.
1106 :strike:`Build a package which is relocatable.` (TODO: It is not
1107 clear what this actually does, or if it works at all.)
1109 The command line variant of this flag is ``--relocatable``.
1111 Static linking options
1112 ^^^^^^^^^^^^^^^^^^^^^^
1114 .. cfg-field:: static: boolean
1117 :synopsis: Build static library.
1122 Roll this and all dependent libraries into a combined ``.a`` archive.
1123 This uses GHCs ``-staticlib`` flag, which is available for iOS and with
1124 GHC 8.4 and later for other platforms as well.
1126 .. cfg-field:: executable-static: boolean
1127 --enable-executable-static
1128 --disable-executable-static
1129 :synopsis: Build fully static executables.
1134 Build fully static executables.
1135 This links all dependent libraries into executables statically,
1137 This passes ``-static`` and ``-optl=-static`` to GHC.
1139 Foreign function interface options
1140 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1142 .. cfg-field:: extra-include-dirs: directories (comma or newline separated list)
1143 --extra-include-dirs=DIR
1144 :synopsis: Adds C header search path.
1146 An extra directory to search for C header files. You can use this
1147 flag multiple times to get a list of directories.
1149 You might need to use this flag if you have standard system header
1150 files in a non-standard location that is not mentioned in the
1151 package's ``.cabal`` file. Using this option has the same affect as
1152 appending the directory *dir* to the :pkg-field:`include-dirs` field in each
1153 library and executable in the package's ``.cabal`` file. The
1154 advantage of course is that you do not have to modify the package at
1155 all. These extra directories will be used while building the package
1156 and for libraries it is also saved in the package registration
1157 information and used when compiling modules that use the library.
1159 The command line variant of this flag is
1160 ``--extra-include-dirs=DIR``, which can be specified multiple times.
1162 .. cfg-field:: extra-lib-dirs: directories (comma or newline separated list)
1163 --extra-lib-dirs=DIR
1164 :synopsis: Adds library search directory.
1166 An extra directory to search for system libraries files.
1168 The command line variant of this flag is ``--extra-lib-dirs=DIR``,
1169 which can be specified multiple times.
1171 .. cfg-field:: extra-framework-dirs: directories (comma or newline separated list)
1172 --extra-framework-dirs=DIR
1173 :synopsis: Adds framework search directory (OS X only).
1175 An extra directory to search for frameworks (OS X only).
1177 You might need to use this flag if you have standard system
1178 libraries in a non-standard location that is not mentioned in the
1179 package's ``.cabal`` file. Using this option has the same affect as
1180 appending the directory *dir* to the :cfg-field:`extra-lib-dirs` field in
1181 each library and executable in the package's ``.cabal`` file. The
1182 advantage of course is that you do not have to modify the package at
1183 all. These extra directories will be used while building the package
1184 and for libraries it is also saved in the package registration
1185 information and used when compiling modules that use the library.
1187 The command line variant of this flag is
1188 ``--extra-framework-dirs=DIR``, which can be specified multiple
1194 .. cfg-field:: profiling: boolean
1197 :synopsis: Enable profiling builds.
1202 Build libraries and executables with profiling enabled (for
1203 compilers that support profiling as a separate mode). It is only
1204 necessary to specify :cfg-field:`profiling` for the specific package you
1205 want to profile; ``cabal build`` will ensure that all of its
1206 transitive dependencies are built with profiling enabled.
1208 To enable profiling for only libraries or executables, see
1209 :cfg-field:`library-profiling` and :cfg-field:`executable-profiling`.
1211 For useful profiling, it can be important to control precisely what
1212 cost centers are allocated; see :cfg-field:`profiling-detail`.
1214 The command line variant of this flag is ``--enable-profiling`` and
1215 ``--disable-profiling``.
1217 .. cfg-field:: profiling-detail: level
1218 --profiling-detail=level
1219 :synopsis: Profiling detail level.
1222 Some compilers that support profiling, notably GHC, can allocate
1223 costs to different parts of the program and there are different
1224 levels of granularity or detail with which this can be done. In
1225 particular for GHC this concept is called "cost centers", and GHC
1226 can automatically add cost centers, and can do so in different ways.
1228 This flag covers both libraries and executables, but can be
1229 overridden by the ``library-profiling-detail`` field.
1231 Currently this setting is ignored for compilers other than GHC. The
1232 levels that cabal currently supports are:
1235 For GHC this uses ``exported-functions`` for libraries and
1236 ``toplevel-functions`` for executables.
1238 No costs will be assigned to any code within this component.
1240 Costs will be assigned at the granularity of all top level
1241 functions exported from each module. In GHC, this
1242 is for non-inline functions. Corresponds to ``-fprof-auto-exported``.
1244 Costs will be assigned at the granularity of all top level
1245 functions in each module, whether they are exported from the
1246 module or not. In GHC specifically, this is for non-inline
1247 functions. Corresponds to ``-fprof-auto-top``.
1249 Costs will be assigned at the granularity of all functions in
1250 each module, whether top level or local. In GHC specifically,
1251 this is for non-inline toplevel or where-bound functions or
1252 values. Corresponds to ``-fprof-auto``.
1254 Like top-level but costs will be assigned to top level definitions after
1255 optimization. This lowers profiling overhead massively while giving similar
1256 levels of detail as toplevle-functions. However it means functions introduced
1257 by GHC during optimization will show up in profiles as well.
1258 Corresponds to ``-fprof-late`` if supported and ``-fprof-auto-top`` otherwise.
1260 Currently an alias for late-toplevel
1262 The command line variant of this flag is
1263 ``--profiling-detail=none``.
1265 .. cfg-field:: library-profiling-detail: level
1266 --library-profiling-detail=level
1267 :synopsis: Libraries profiling detail level.
1270 Like :cfg-field:`profiling-detail`, but applied only to libraries
1272 The command line variant of this flag is
1273 ``--library-profiling-detail=none``.
1275 .. cfg-field:: library-vanilla: boolean
1276 --enable-library-vanilla
1277 --disable-library-vanilla
1278 :synopsis: Build libraries without profiling.
1282 Build ordinary libraries (as opposed to profiling libraries).
1283 Mostly, you can set this to False to avoid building ordinary
1284 libraries when you are profiling.
1286 The command line variant of this flag is
1287 ``--enable-library-vanilla`` and ``--disable-library-vanilla``.
1289 .. cfg-field:: library-profiling: boolean
1290 --enable-library-profiling
1291 --disable-library-profiling
1292 :synopsis: Build libraries with profiling enabled.
1297 Build libraries with profiling enabled. You probably want
1298 to use :cfg-field:`profiling` instead.
1300 The command line variant of this flag is
1301 ``--enable-library-profiling`` and ``--disable-library-profiling``.
1303 .. cfg-field:: executable-profiling: boolean
1304 --enable-executable-profiling
1305 --disable-executable-profiling
1306 :synopsis: Build executables with profiling enabled.
1311 Build executables with profiling enabled. You probably want
1312 to use :cfg-field:`profiling` instead.
1314 The command line variant of this flag is
1315 ``--enable-executable-profiling`` and
1316 ``--disable-executable-profiling``.
1321 .. cfg-field:: coverage: boolean
1324 :synopsis: Build with coverage enabled.
1329 Build libraries and executables (including test suites) with Haskell
1330 Program Coverage enabled. Running the test suites will automatically
1331 generate coverage reports with HPC.
1333 The command line variant of this flag is ``--enable-coverage`` and
1334 ``--disable-coverage``.
1336 .. cfg-field:: library-coverage: boolean
1337 --enable-library-coverage
1338 --disable-library-coverage
1344 Deprecated, use :cfg-field:`coverage`.
1346 The command line variant of this flag is
1347 ``--enable-library-coverage`` and ``--disable-library-coverage``.
1352 .. cfg-field:: documentation: boolean
1353 --enable-documentation
1354 --disable-documentation
1355 :synopsis: Enable building of documentation.
1359 Enables building of Haddock documentation.
1360 Implied when calling ``cabal haddock``.
1362 The command line variant of this flag is ``--enable-documentation``
1363 and ``--disable-documentation``.
1365 ``documentation: true`` does not imply
1366 :cfg-field:`haddock-all`,
1367 :cfg-field:`haddock-benchmarks`,
1368 :cfg-field:`haddock-executables`,
1369 :cfg-field:`haddock-internal` or
1370 :cfg-field:`haddock-tests`.
1371 These need to be enabled separately if desired.
1373 .. cfg-field:: doc-index-file: templated path
1374 --doc-index-file=TEMPLATE
1375 :synopsis: Path to haddock templates.
1377 A central index of Haddock API documentation (template cannot use
1378 ``$pkgid``), which should be updated as documentation is built.
1380 The following commands are equivalent to ones that would be passed when
1381 running ``setup haddock``.
1383 .. cfg-field:: haddock-hoogle: boolean
1385 :synopsis: Generate Hoogle file.
1389 Generate a text file which can be converted by Hoogle_
1390 into a database for searching.
1391 This is equivalent to running ``haddock`` with the ``--hoogle`` flag.
1393 .. cfg-field:: haddock-html: boolean
1395 :synopsis: Build HTML documentation.
1399 Build HTML documentation.
1401 .. cfg-field:: haddock-quickjump: boolean
1403 :synopsis: Generate Quickjump file.
1407 Generate an index for interactive documentation navigation.
1408 This is equivalent to running ``haddock`` with the ``--quickjump`` flag.
1410 .. cfg-field:: haddock-html-location: templated path
1411 --haddock-html-location=TEMPLATE
1412 :synopsis: Haddock HTML templates location.
1414 Specify a template for the location of HTML documentation for
1415 prerequisite packages. The substitutions are applied to the template
1416 to obtain a location for each package, which will be used by
1417 hyperlinks in the generated documentation. For example, the
1418 following command generates links pointing at Hackage pages:
1422 html-location: http://hackage.haskell.org/packages/archive/$pkg/latest/doc/html
1424 If passed on the command line,
1425 the argument may be quoted to prevent substitution by the shell.
1429 --html-location='http://hackage.haskell.org/packages/archive/$pkg/latest/doc/html'
1431 If this option is omitted, the location for each package is obtained
1432 using the package tool (e.g. ``ghc-pkg``).
1434 .. cfg-field:: haddock-executables: boolean
1435 --haddock-executables
1436 :synopsis: Generate documentation for executables.
1440 Run haddock on all executable programs.
1442 .. cfg-field:: haddock-tests: boolean
1444 :synopsis: Generate documentation for tests.
1448 Run haddock on all test suites.
1450 .. cfg-field:: haddock-benchmarks: boolean
1451 --haddock-benchmarks
1452 :synopsis: Generate documentation for benchmarks.
1456 Run haddock on all benchmarks.
1458 .. cfg-field:: haddock-internal: boolean
1460 :synopsis: Generate documentation for internal modules
1464 Build haddock documentation which includes unexposed modules and
1467 .. cfg-field:: haddock-all: boolean
1469 :synopsis: Generate documentation for everything
1473 Run haddock on all components.
1475 .. cfg-field:: haddock-css: path
1477 :synopsis: Location of Haddock CSS file.
1479 The CSS file that should be used to style the generated
1480 documentation (overriding haddock's default).
1482 .. cfg-field:: haddock-hyperlink-source: boolean
1483 --haddock-hyperlink-source
1484 :synopsis: Generate hyperlinked source code for documentation
1488 Generated hyperlinked source code using `HsColour`_, and have
1489 Haddock documentation link to it.
1490 This is equivalent to running ``haddock`` with the ``--hyperlinked-source`` flag.
1492 .. cfg-field:: haddock-hscolour-css: path
1493 --haddock-hscolour-css=PATH
1494 :synopsis: Location of CSS file for HsColour
1496 The CSS file that should be used to style the generated hyperlinked
1497 source code (from `HsColour`_).
1499 .. cfg-field:: haddock-contents-location: URL
1500 --haddock-contents-location=URL
1501 :synopsis: URL for contents page.
1503 A baked-in URL to be used as the location for the contents page.
1505 .. cfg-field:: haddock-keep-temp-files: boolean
1506 :synopsis: Keep temporary Haddock files.
1508 Keep temporary files.
1510 There is no command line variant of this flag.
1512 .. cfg-field:: open: boolean
1514 :synopsis: Open generated documentation in-browser.
1516 When generating HTML documentation, attempt to open it in a browser
1517 when complete. This will use ``xdg-open`` on Linux and BSD systems,
1518 ``open`` on macOS, and ``start`` on Windows.
1520 Advanced global configuration options
1521 -------------------------------------
1523 .. cfg-field:: write-ghc-environment-files: always, never, or ghc8.4.4+
1524 --write-ghc-environment-files=policy
1525 :synopsis: Whether a ``.ghc.environment`` should be created after a successful build.
1529 Whether a `GHC package environment file <https://downloads.haskell.org/~ghc/master/users-guide/packages.html#package-environments>`_
1530 should be created after a successful build.
1532 Since Cabal 3.0, defaults to ``never``. Before that, defaulted to
1533 creating them only when compiling with GHC 8.4.4 and older (GHC
1534 8.4.4 `is the first version
1535 <https://gitlab.haskell.org/ghc/ghc/-/issues/13753>`_ that supports
1536 the ``-package-env -`` option that allows ignoring the package
1539 .. cfg-field:: build-info: True, False
1541 --disable-build-info
1542 :synopsis: Whether build information for each individual component should be
1543 written in a machine readable format.
1547 Enable generation of build information for Cabal components. Contains very
1548 detailed information on how to build an individual component, such as
1549 compiler version, modules of a component and how to compile the component.
1551 The output format is in json, and the exact location can be discovered from
1552 ``plan.json``, where it is identified by ``build-info`` within the items in
1553 the ``install-plan``.
1554 Note, that this field in ``plan.json`` can be ``null``, if and only if
1555 ``build-type: Custom`` is set, and the ``Cabal`` version is too
1556 old (i.e. ``< 3.7``).
1557 If the field is missing entirely, the component is not a local one, thus,
1558 no ``build-info`` exists for that particular component within the
1562 The format and fields of the generated build information is currently experimental,
1563 in the future we might add or remove fields, depending on the needs of other tooling.
1566 .. cfg-field:: http-transport: curl, wget, powershell, or plain-http
1567 --http-transport=transport
1568 :synopsis: Transport to use with http(s) requests.
1572 Set a transport to be used when making http(s) requests.
1574 The command line variant of this field is ``--http-transport=curl``.
1576 .. cfg-field:: ignore-expiry: boolean
1578 :synopsis: Ignore Hackage expiration dates.
1582 If ``True``, we will ignore expiry dates on metadata from Hackage.
1584 In general, you should not set this to ``True`` as it will leave you
1585 vulnerable to stale cache attacks. However, it may be temporarily
1586 useful if the main Hackage server is down, and we need to rely on
1587 mirrors which have not been updated for longer than the expiry
1588 period on the timestamp.
1590 The command line variant of this field is ``--ignore-expiry``.
1592 .. cfg-field:: remote-repo-cache: directory
1593 --remote-repo-cache=DIR
1594 :synopsis: Location of packages cache.
1596 :default: ``~/.cabal/packages``
1598 The location where packages downloaded from remote repositories will be
1601 The command line variant of this flag is
1602 ``--remote-repo-cache=DIR``.
1604 .. cfg-field:: logs-dir: directory
1606 :synopsis: Directory to store build logs.
1608 :default: ``~/.cabal/logs``
1610 :strike:`The location where build logs for packages are stored.`
1611 Not implemented yet.
1613 The command line variant of this flag is ``--logs-dir=DIR``.
1615 .. cfg-field:: build-summary: template filepath
1616 --build-summary=TEMPLATE
1617 :synopsis: Build summaries location.
1619 :default: ``~/.cabal/logs/build.log``
1621 :strike:`The file to save build summaries.` Not implemented yet.
1623 Valid variables which can be used in the path are ``$pkgid``,
1624 ``$compiler``, ``$os`` and ``$arch``.
1626 The command line variant of this flag is
1627 ``--build-summary=TEMPLATE``.
1629 Undocumented fields: ``root-cmd``, ``symlink-bindir``, ``build-log``,
1630 ``remote-build-reporting``, ``report-planned-failure``, ``offline``.
1632 Advanced solver options
1633 ^^^^^^^^^^^^^^^^^^^^^^^
1635 Most users generally won't need these.
1637 .. cfg-field:: solver: modular
1639 :synopsis: Which solver to use.
1641 This field is reserved to allow the specification of alternative
1642 dependency solvers. At the moment, the only accepted option is
1645 The command line variant of this field is ``--solver=modular``.
1647 .. cfg-field:: max-backjumps: nat
1649 :synopsis: Maximum number of solver backjumps.
1653 Maximum number of backjumps (backtracking multiple steps) allowed
1654 while solving. Set -1 to allow unlimited backtracking, and 0 to
1655 disable backtracking completely.
1657 The command line variant of this field is ``--max-backjumps=4000``.
1659 .. cfg-field:: reorder-goals: boolean
1662 :synopsis: Allow solver to reorder goals.
1666 When enabled, the solver will reorder goals according to certain
1667 heuristics. Slows things down on average, but may make backtracking
1668 faster for some packages. It's unlikely to help for small projects,
1669 but for big install plans it may help you find a plan when otherwise
1670 this is not possible. See :issue:`1780` for more commentary.
1672 The command line variant of this field is ``--(no-)reorder-goals``.
1674 .. cfg-field:: count-conflicts: boolean
1676 --no-count-conflicts
1677 :synopsis: Solver prefers versions with less conflicts.
1681 Try to speed up solving by preferring goals that are involved in a
1684 The command line variant of this field is
1685 ``--(no-)count-conflicts``.
1687 .. cfg-field:: fine-grained-conflicts: boolean
1688 --fine-grained-conflicts
1689 --no-fine-grained-conflicts
1690 :synopsis: Skip a version of a package if it does not resolve any conflicts
1691 encountered in the last version (solver optimization).
1695 When enabled, the solver will skip a version of a package if it does not
1696 resolve any of the conflicts encountered in the last version of that
1697 package. For example, if ``foo-1.2`` depended on ``bar``, and the solver
1698 couldn't find consistent versions for ``bar``'s dependencies, then the
1699 solver would skip ``foo-1.1`` if it also depended on ``bar``.
1701 The command line variant of this field is
1702 ``--(no-)fine-grained-conflicts``.
1704 .. cfg-field:: minimize-conflict-set: boolean
1705 --minimize-conflict-set
1706 --no-minimize-conflict-set
1707 :synopsis: Try to improve the solver error message when there is no
1712 When there is no solution, try to improve the solver error message
1713 by finding a minimal conflict set. This option may increase run
1714 time significantly, so it is off by default.
1716 The command line variant of this field is
1717 ``--(no-)minimize-conflict-set``.
1719 .. cfg-field:: strong-flags: boolean
1722 :synopsis: Do not defer flag choices when solving.
1726 Do not defer flag choices. (TODO: Better documentation.)
1728 The command line variant of this field is ``--(no-)strong-flags``.
1730 .. cfg-field:: allow-boot-library-installs: boolean
1731 --allow-boot-library-installs
1732 --no-allow-boot-library-installs
1733 :synopsis: Allow cabal to install or upgrade any package.
1737 By default, the dependency solver doesn't allow ``base``,
1738 ``ghc-prim``, ``integer-simple``, ``integer-gmp``, and
1739 ``template-haskell`` to be installed or upgraded. This flag
1740 removes the restriction.
1742 The command line variant of this field is
1743 ``--(no-)allow-boot-library-installs``.
1745 .. cfg-field:: cabal-lib-version: version
1746 --cabal-lib-version=version
1747 :synopsis: Version of Cabal library used to build package.
1749 This field selects the version of the Cabal library which should be
1750 used to build packages. This option is intended primarily for
1751 internal development use (e.g., forcing a package to build with a
1752 newer version of Cabal, to test a new version of Cabal.) (TODO:
1753 Specify its semantics more clearly.)
1755 The command line variant of this field is
1756 ``--cabal-lib-version=1.24.0.1``.
1758 .. cfg-field:: prefer-oldest: boolean
1761 :synopsis: Prefer the oldest versions of packages available.
1766 By default, when solver has a choice of multiple versions of the same
1767 package, it will first try to derive a build plan with the latest
1768 version. This flag switches the behaviour, making the solver
1769 to prefer the oldest packages available.
1771 The primary use case is to help users in establishing lower bounds
1772 of upstream dependencies.
1774 The command line variant of this field is ``--(no-)prefer-oldest``.
1776 .. include:: references.inc