1 Project Description — cabal.project File
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 and
44 imports in ``cabal.project`` files.
48 While :ref:`conditional blocks<conditional-blocks>` can appear anywhere
49 within component or common sections of a package, their placement within a
50 project is restricted. Conditions may only be introduced at the top level
53 Of the :ref:`condition tests<conditions>`, only packages can test for
54 flags. Projects can test for operating system, architecture, compiler and
55 the boolean constants.
58 - :samp:`arch({name})`
59 - :samp:`impl({compiler})`
63 Imports may specify local filepaths or remote urls, and may reference either
64 cabal.project files or v1-style cabal.config freeze files. As a usage example:
71 packages: freebsd/*.cabal
75 import: https://some.remote.source/subdir/cabal.config
77 import: relativepath/extra-project.project
79 import: /absolutepath/some-project.project
81 Using conditionals will force cabal to find a ghc to derive
82 architecture and version information from, which will force some
83 commands (update, sdist) to require ghc present where otherwise it
84 would not be necessitated.
86 Specifying the local packages
87 -----------------------------
89 The following top-level options specify what the local packages of a
92 .. cfg-field:: packages: package location list (space or comma separated)
93 :synopsis: Project packages.
95 :default: ``./*.cabal``
99 The default value ``./*.cabal`` only takes effect if there is no explicit
100 ``cabal.project`` file.
101 If you use such explicit file you *must* fill the field.
103 Specifies the list of package locations which contain the local
104 packages to be built by this project. Package locations can take the
107 1. They can specify a Cabal file, or a directory containing a Cabal
108 file, e.g., ``packages: Cabal cabal-install/cabal-install.cabal``.
110 2. They can specify glob-style wildcards, which must match one or
111 more (a) directories containing a (single) Cabal file, (b) Cabal
112 files (extension ``.cabal``), or (c) tarballs which contain Cabal
113 packages (extension ``.tar.gz``).
114 For example, to match all Cabal files in all
115 subdirectories, as well as the Cabal projects in the parent
116 directories ``foo`` and ``bar``, use
117 ``packages: */*.cabal ../{foo,bar}/``
119 3. They can specify an ``http``, ``https`` or ``file``
120 URL, representing the path to a remote tarball to be downloaded
123 There is no command line variant of this field; see :issue:`3585`.
124 Note that the default value is only included if there is no
125 ``cabal.project`` file. The field is appendable which means there would be
126 no way to drop the default value if it was included.
128 .. cfg-field:: optional-packages: package location list (space or comma-separated)
129 :synopsis: Optional project packages.
133 Like :cfg-field:`packages`, specifies a list of package locations
134 containing local packages to be built. Unlike :cfg-field:`packages`,
135 if we glob for a package, it is permissible for the glob to match against
136 zero packages. The intended use-case for :cfg-field:`optional-packages`
137 is to make it so that vendored packages can be automatically picked up if
138 they are placed in a subdirectory, but not error if there aren't any.
140 There is no command line variant of this field.
142 .. cfg-field:: extra-packages: package list with version bounds (comma separated)
143 :synopsis: Adds external packages as local
145 Specifies a list of external packages from Hackage, which
146 should be considered local packages. The motivation for
147 :cfg-field:`extra-packages` is making libraries that are not
148 dependencies of any package in the project available for use in ghci.
150 There is no command line variant of this field.
154 All local packages are *vendored*, in the sense that if other packages
155 (including external ones from Hackage) depend on a package with the name
156 of a local package, the local package is preferentially used.
157 For subdirectories to be considered local packages, the following setting
161 optional-packages: ./*/*.cabal
163 ...then any package can be vendored simply by making a checkout in the
164 top-level project directory, as might be seen in this hypothetical
168 foo-helper/ # local package
169 unix/ # vendored external package
171 All of these options support globs. ``cabal build`` has its own glob
174 - Anywhere in a path, as many times as you like, you can specify an
175 asterisk ``*`` wildcard. E.g., ``*/*.cabal`` matches all ``.cabal``
176 files in all immediate subdirectories. Like in glob(7), asterisks do
177 not match hidden files unless there is an explicit period, e.g.,
178 ``.*/foo.cabal`` will match ``.private/foo.cabal`` (but
179 ``*/foo.cabal`` will not).
181 - You can use braces to specify specific directories; e.g.,
182 ``{vendor,pkgs}/*.cabal`` matches all Cabal files in the ``vendor``
183 and ``pkgs`` subdirectories.
185 Formally, the format is described by the following BNF:
188 convert globbing grammar to proper ABNF_ syntax
192 RootedGlob ::= FilePathRoot Glob
193 FilePathRoot ::= {- empty -} # relative to cabal.project
195 | [a-zA-Z] ":" [/\\] # Windows root
196 | "~" # home directory
197 Glob ::= GlobPieces [/\\] Glob # Unix or Windows directory
198 | "..[**/\\]" GlobPieces # Recursive directory glob
200 | [/\\] # trailing slash
201 GlobPieces ::= GlobPiece *
202 GlobPiece ::= "*" # wildcard
203 | [^*{},/\\] * # literal string
204 | "\\" [*{},] # escaped reserved character
205 | "{" Glob "," ... "," Glob "}" # union (match any of these)
208 Specifying Packages from Remote Version Control Locations
209 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211 Since version 2.4, the ``source-repository-package`` stanza allows for
212 specifying packages in a remote version control system that cabal should
213 consider during package retrieval. This allows use of a package from a
214 remote version control system, rather than looking for that package in
217 .. code-block:: cabal
221 source-repository-package
223 location: https://github.com/hvr/HsYAML.git
224 tag: e70cf0c171c9a586b62b3f75d72f1591e4e6aaa1
226 source-repository-package
228 location: https://github.com/well-typed/cborg
229 tag: 3d274c14ca3077c3a081ba7ad57c5182da65c8c1
232 source-repository-package
234 location: https://github.com/haskell/network.git
235 tag: e76fdc753e660dfa615af6c8b6a2ad9ddf6afe70
236 post-checkout-command: autoreconf -i
238 Since version 3.4, cabal-install creates tarballs for each package coming
239 from a ``source-repository-package`` stanza (effectively applying cabal
240 sdists to such packages). It gathers the names of the packages from the
241 appropriate .cabal file in the version control repository, and allows
242 their use just like Hackage or locally defined packages.
244 .. cfg-field:: type: VCS kind
246 .. cfg-field:: location: VCS location (usually URL)
248 .. cfg-field:: tag: VCS tag
250 .. cfg-field:: subdir: subdirectory list
252 Look in one or more subdirectories of the repository for cabal files, rather than the root.
254 .. cfg-field:: post-checkout-command: command
256 Run command in the checked out repository, prior sdisting.
258 Global configuration options
259 ----------------------------
261 The following top-level configuration options are not specific to any
262 package, and thus apply globally:
265 .. cfg-field:: verbose: nat
267 :synopsis: Build verbosity level.
271 Control the verbosity of ``cabal`` commands, valid values are from 0
274 The command line variant of this field is ``--verbose=2``; a short
275 form ``-v2`` is also supported.
277 .. cfg-field:: jobs: nat or $ncpus
278 -j[NUM], --jobs[=NUM], --jobs=$ncpus
279 :synopsis: Number of builds running in parallel.
283 Run *nat* jobs simultaneously when building. If ``$ncpus`` is
284 specified, run the number of jobs equal to the number of CPUs.
285 Package building is often quite parallel, so turning on parallelism
286 can speed up build times quite a bit!
288 The command line variant of this field is ``--jobs=2``; a short form
289 ``-j2`` is also supported; a bare ``--jobs`` or ``-j`` is equivalent
290 to ``--jobs=$ncpus``.
292 .. cfg-field:: semaphore: boolean
295 :synopsis: Use GHC's support for semaphore based parallelism.
299 This option instructs cabal to control parallelism by creating a new system semaphore,
300 whose number of tokens is specified by ``--jobs`` (or ``-j``).
301 This semaphore is passed to GHC, which allows it to use any leftover parallelism
302 that ``cabal-install`` is not using.
304 Requires ``ghc >= 9.8``.
306 The command line variant of this field is ``--semaphore``.
308 .. cfg-field:: keep-going: boolean
310 :synopsis: Try to continue building on failure.
314 If true, after a build failure, continue to build other unaffected
317 The command line variant of this field is ``--keep-going``.
319 .. option:: --builddir=DIR
321 Specifies the name of the directory where build products for
322 build will be stored; defaults to ``dist-newstyle``. If a
323 relative name is specified, this directory is resolved relative
324 to the root of the project (i.e., where the ``cabal.project``
327 This option can only be specified from the command line.
329 .. _cmdoption-project-dir:
330 .. option:: --project-dir=DIR
332 Specifies the path of the project directory. If a relative
333 :ref:`project-file<cmdoption-project-file>` path is also specified,
334 it will be resolved relative to this directory.
336 The project directory does not need to contain a ``cabal.project`` file.
338 This option can only be specified from the command line.
340 .. _cmdoption-project-file:
341 .. option:: --project-file=FILE
343 Specifies the path and name of the project file used to specify the
344 rest of the top-level configuration; defaults to ``cabal.project``.
345 This name not only specifies the name of the main project file,
346 but also the auxiliary project files ``cabal.project.freeze``
347 and ``cabal.project.local``; for example, if you specify
348 ``--project-file=my.project``, then the other files that will
349 be probed are ``my.project.freeze`` and ``my.project.local``.
351 If :ref:`project-dir<cmdoption-project-dir>` is not specified,
352 and the path is relative, we will
353 look for the file relative to the current working directory,
354 and then for the parent directory, until the project file is
355 found or we have hit the top of the user's home directory.
357 This option can only be specified from the command line.
359 .. option:: -z, --ignore-project
361 Ignores the local ``cabal.project`` file and uses the default
362 configuration with the local ``foo.cabal`` file. Note that
363 this flag will be ignored if either of the ``--project-dir`` or
364 ``--project-file`` flags are also set.
366 .. option:: --store-dir=DIR
368 Specifies the name of the directory of the global package store.
370 .. cfg-field:: package-dbs: package DB stack (comma separated)
371 --package-db=[clear, global, user, PATH]
372 :synopsis: PackageDB stack manipulation
375 By modifying ``package-dbs`` you can modify the default package environment
376 which ``cabal`` will see. The package databases you add using ``package-dbs``
377 will not be written into and only used as immutable package stores to initialise
378 the environment with additional packages that ``cabal`` can choose to use.
380 There are three package databases involved with most builds:
383 Compiler installation of rts, base, etc.
385 Nix-style local build cache
387 Project-specific build directory
389 By default, the initial package stack prefix you will have with v2 commands is:
395 So the initial set of packages which is used by cabal is just the packages
396 installed in the global package database which comes with ``ghc``.
398 When cabal builds a package it will start populating the ``store`` package database,
399 whose packages will then be subsequently be available to be used in future runs.
405 When cabal builds your local projects, packages are registered into the local
406 in-place package database.
410 -- prefix ++ [store, in-place]
412 This flag manipulates the default prefix: ``[global]`` and accepts
413 paths, the special value ``global`` referring to the global package db, and
414 ``clear`` which removes all prior entries. For example,
418 -- prefix = [global, foo]
422 package-dbs: clear, foo
424 -- prefix = [bar, baz]
425 package-dbs: clear, foo, clear, bar, baz
427 The command line variant of this flag is ``--package-db=DB`` which can be
428 specified multiple times.
433 The following settings apply to commands that result in build actions
434 (``build``, ``run``, ``repl``, ``test``...), and control which phases of the
437 .. option:: --dry-run
439 Do not download, build, or install anything, only print what would happen.
441 .. option:: --only-configure
443 Instead of performing a full build just run the configure step.
444 Only accepted by the ``build`` command.
446 .. option:: --only-download
448 Do not build anything, only fetch the packages.
450 .. option:: --only-dependencies
452 Install only the dependencies necessary to build the given packages.
453 Not accepted by the ``repl`` command.
455 Solver configuration options
456 ----------------------------
458 The following settings control the behavior of the dependency solver:
460 .. cfg-field:: constraints: CONSTRAINT (comma separated list)
461 -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT
462 --constraint="pkg >= 2.0", -c "pkg >= 2.0"
463 :synopsis: Extra dependencies constraints.
465 Add extra constraints to the version bounds, flag settings,
466 and other properties a solver can pick for a
467 package. For example:
471 constraints: bar == 2.1
473 A package can be specified multiple times in ``constraints``, in
474 which case the specified constraints are intersected. This is
475 useful, since the syntax does not allow you to specify multiple
476 constraints at once. For example, to specify both version bounds and
477 flag assignments, you would write:
485 This is equivalent to writing constraints and :cfg-field:`flags` separately:
489 constraints: bar == 2.1
493 Valid constraints take the same form as for the
494 :option:`runhaskell Setup.hs configure --constraint`
497 .. cfg-field:: preferences: CONSTRAINT (comma separated list)
498 --preference=CONSTRAINT
499 --preference="pkg >= 2.0"
500 :synopsis: Preferred dependency versions.
502 Like :cfg-field:`constraints`, but the solver will attempt to satisfy
503 these preferences on a best-effort basis. The resulting install is locally
504 optimal with respect to preferences; specifically, no single package
505 could be replaced with a more preferred version that still satisfies
506 the hard constraints.
508 Operationally, preferences can cause the solver to attempt certain
509 version choices of a package before others, which can improve
510 dependency solver runtime.
512 One way to use :cfg-field:`preferences` is to take a known working set of
513 constraints (e.g., via ``cabal freeze``) and record them as
514 preferences. In this case, the solver will first attempt to use this
515 configuration, and if this violates hard constraints, it will try to
516 find the minimal number of upgrades to satisfy the hard constraints
519 The command line variant of this field is
520 ``--preference="pkg >= 2.0"``; to specify multiple preferences, pass
521 the flag multiple times.
523 .. cfg-field:: allow-newer: none, all or list of scoped package names (space or comma separated)
524 --allow-newer, --allow-newer=[none,all,[scope:][^]pkg]
525 :synopsis: Lift dependencies upper bound constraints.
529 Allow the solver to pick more recent version of some packages than
530 would normally be permitted by the :pkg-field:`build-depends` bounds
531 of packages in the install plan. This option may be useful if the
532 dependency solver cannot otherwise find a valid install plan.
534 For example, to relax ``pkg``\ s :pkg-field:`build-depends` upper bound on
535 ``dep-pkg``, write a scoped package name of the form:
539 allow-newer: pkg:dep-pkg
541 If the scope shall be limited to specific releases of ``pkg``, the
546 allow-newer: pkg-1.2.3:dep-pkg, pkg-1.1.2:dep-pkg
548 can be used to limit the relaxation of dependencies on
549 ``dep-pkg`` by the ``pkg-1.2.3`` and ``pkg-1.1.2`` releases only.
551 The scoped syntax is recommended, as it is often only a single package
552 whose upper bound is misbehaving. In this case, the upper bounds of
553 other packages should still be respected; indeed, relaxing the bound
554 can break some packages which test the selected version of packages.
556 The syntax also allows to prefix the dependee package with a
557 modifier symbol to modify the scope/semantic of the relaxation
558 transformation in a additional ways. Currently only one modifier
559 symbol is defined, i.e. ``^`` (i.e. caret) which causes the
560 relaxation to be applied only to ``^>=`` operators and leave all other
561 version operators untouched.
563 However, in some situations (e.g., when attempting to build packages
564 on a new version of GHC), it is useful to disregard *all*
565 upper-bounds, with respect to a package or all packages. This can be
566 done by specifying just a package name, or using the keyword ``all``
567 to specify all packages:
571 -- Disregard upper bounds involving the dependencies on
572 -- packages bar, baz. For quux only, relax
573 -- 'quux ^>= ...'-style constraints only.
574 allow-newer: bar, baz, ^quux
576 -- Disregard all upper bounds when dependency solving
579 -- Disregard all `^>=`-style upper bounds when dependency solving
583 For consistency, there is also the explicit wildcard scope syntax
584 ``*`` (or its alphabetic synonym ``all``). Consequently, the
585 examples above are equivalent to the explicitly scoped variants:
589 allow-newer: all:bar, *:baz, *:^quux
595 allow-newer: all:^all
597 In order to ignore all bounds specified by a package ``pkg-1.2.3``
598 you can combine scoping with a right-hand-side wildcard like so
602 -- Disregard any upper bounds specified by pkg-1.2.3
603 allow-newer: pkg-1.2.3:*
605 -- Disregard only `^>=`-style upper bounds in pkg-1.2.3
606 allow-newer: pkg-1.2.3:^*
609 :cfg-field:`allow-newer` is often used in conjunction with a constraint
610 (in the :cfg-field:`constraints` field) forcing the usage of a specific,
611 newer version of a package.
613 The command line variant of this field is e.g. ``--allow-newer=bar``. A
614 bare ``--allow-newer`` is equivalent to ``--allow-newer=all``.
616 .. cfg-field:: allow-older: none, all, list of scoped package names (space or comma separated)
617 --allow-older, --allow-older=[none,all,[scope:][^]pkg]
618 :synopsis: Lift dependency lower bound constraints.
623 Like :cfg-field:`allow-newer`, but applied to lower bounds rather than
626 The command line variant of this field is ``--allow-older=all``. A
627 bare ``--allow-older`` is equivalent to ``--allow-older=all``.
630 .. cfg-field:: index-state: HEAD, unix-timestamp, ISO8601 UTC timestamp.
631 :synopsis: Use source package index state as it existed at a previous time.
636 This allows to change the source package index state the solver uses
637 to compute install-plans. This is particularly useful in
638 combination with freeze-files in order to also freeze the state the
639 package index was in at the time the install-plan was frozen.
643 -- UNIX timestamp format example
644 index-state: @1474739268
646 -- ISO8601 UTC timestamp format example
647 -- This format is used by 'cabal configure'
648 -- for storing `--index-state` values.
649 index-state: 2016-09-24T17:47:48Z
651 -- Specify different index-states per package repository
652 -- Supported since 3.4
654 , hackage.haskell.org 2020-05-06T22:33:27Z
655 , head.hackage 2020-04-29T04:11:05Z
657 .. cfg-field:: active-repositories: reponame1, reponame2
659 :synopsis: Specify active package repositories
664 Specifies which of the package repositories defined in the configuration
665 should be active. It's also useful for specifying the order and the way
666 active repositories are merged.
668 When searching for a certain version of a certain package name, the list of
669 active repositories is searched last-to-first.
671 For example, suppose hackage.haskell.org has versions 1.0 and 2.0 of
672 package X, and my-repository has version 2.0 of a similarly named package.
673 Then, with the following configuration:
677 -- Force my-repository to be the first repository considered
679 , hackage.haskell.org
682 version 2.0 of X will come from my-repository, and version 1.0 will come
683 from hackage.haskell.org.
685 If we want to make a repository the sole provider of certain packages, we
686 can put it last in the active repositories list, and add the :override
689 For example, if we modify the previous example like this:
694 , hackage.haskell.org
695 , my-repository:override
697 then version 1.0 of package X won't be found in any case, because X is
698 present in my-repository only in version 2.0, and the :override forbids
699 searching for other versions of X further up the list.
701 :override has no effect for package names that aren't present in the
702 overriding repository.
704 The special repository reference :rest stands for "all the other repositories"
705 and can be useful to avoid lengthy lists of repository names:
709 -- Force my-repository to be the first repository considered
710 active-repositories: :rest, my-repository
712 The special repository reference :none disables all repositories, effectively
713 putting cabal in "offline" mode:
717 active-repositories: :none
720 .. cfg-field:: reject-unconstrained-dependencies: all, none
721 --reject-unconstrained-dependencies=[all|none]
722 :synopsis: Restrict the solver to packages that have constraints on them.
727 By default, the dependency solver can include any package that it's
728 aware of in a build plan. If you wish to restrict the build plan to
729 a closed set of packages (e.g., from a freeze file), use this flag.
731 When set to `all`, all non-local packages that aren't goals must be
732 explicitly constrained. When set to `none`, the solver will
733 consider all packages.
736 Package configuration options
737 -----------------------------
739 Package options affect the building of specific packages. There are three
740 ways a package option can be specified:
742 - They can be specified at the top-level, in which case they apply only
743 to **local package**, or
745 - They can be specified inside a ``package`` stanza, in which case they
746 apply to the build of the package, whether or not it is local or
749 - They can be specified inside an ``package *`` stanza, in which case they
750 apply to all packages, local ones from the project and also external
754 For example, the following options specify that :cfg-field:`optimization`
755 should be turned off for all local packages, and that ``bytestring`` (possibly
756 an external dependency) should be built with ``-fno-state-hack``::
761 ghc-options: -fno-state-hack
763 ``ghc-options`` is not specifically described in this documentation, but is one
764 of many fields for configuring programs. They take the form
765 ``progname-options`` and ``progname-location``, and can be set for all local
766 packages in a ``program-options`` stanza or under a package stanza.
768 On the command line, these options are applied to all local packages.
769 There is no per-package command line interface.
771 Some flags were added by more recent versions of the Cabal library. This
772 means that they are NOT supported by packages which use Custom setup
773 scripts that require a version of the Cabal library older than when the
776 .. cfg-field:: flags: list of +flagname or -flagname (space separated)
777 -f FLAGS or -fFLAGS, --flags=FLAGS
778 --flags="+foo -bar", -ffoo, -f-bar
779 :synopsis: Enable or disable package flags.
781 Force all flags specified as ``+flagname`` to be true, and all flags
782 specified as ``-flagname`` to be false. For example, to enable the
783 flag ``foo`` and disable ``bar``, set:
789 Exactly one of + or - is required before each flag.
791 Flags are *per-package*, so it doesn't make much sense to specify
792 flags at the top-level, unless you happen to know that *all* of your
793 local packages support the same named flags. If a flag is not
794 supported by a package, it is ignored.
796 The command line variant of this flag is ``--flags``. There is also
797 a shortened form ``-ffoo -f-bar``.
799 A common mistake is to say ``cabal build -fhans``, where
800 ``hans`` is a flag for a transitive dependency that is not in the
801 local package; in this case, the flag will be silently ignored. If
802 ``haskell-tor`` is the package you want this flag to apply to, try
803 ``--constraint="haskell-tor +hans"`` instead. Flags can be specified as
804 package :cfg-field:`constraints`.
806 .. cfg-field:: with-compiler: PATH
807 -w PATH or -wPATH, --with-compiler=PATH
808 :synopsis: Path to compiler executable.
810 Specify the path to a particular compiler to be used. If not an
811 absolute path, it will be resolved according to the ``PATH``
812 environment. The type of the compiler (GHC, GHCJS, etc) must be
813 consistent with the setting of the :cfg-field:`compiler` field.
815 The most common use of this option is to specify a different version
816 of your compiler to be used; e.g., if you have ``ghc-7.8`` in your
817 path, you can specify ``with-compiler: ghc-7.8`` to use it.
819 This flag also sets the default value of :cfg-field:`with-hc-pkg`, using
820 the heuristic that it is named ``ghc-pkg-7.8`` (if your executable name
821 is suffixed with a version number), or is the executable named
822 ``ghc-pkg`` in the same directory as the ``ghc`` directory. If this
823 heuristic does not work, set :cfg-field:`with-hc-pkg` explicitly.
825 For inplace packages, ``cabal build`` maintains a separate build
826 directory for each version of GHC, so you can maintain multiple
827 build trees for different versions of GHC without clobbering each
830 It's not possible to set :cfg-field:`with-compiler` on a
833 The command line variant of this flag is
834 ``--with-compiler=ghc-7.8``; there is also a short version
837 .. cfg-field:: with-hc-pkg: PATH
839 :synopsis: Path to package tool.
841 Specify the path to the package tool, e.g., ``ghc-pkg``. This
842 package tool must be compatible with the compiler specified by
843 :cfg-field:`with-compiler` (generally speaking, it should be precisely
844 the tool that was distributed with the compiler). If this option is
845 omitted, the default value is determined from :cfg-field:`with-compiler`.
847 The command line variant of this flag is
848 ``--with-hc-pkg=ghc-pkg-7.8``.
850 .. cfg-field:: optimization: nat
851 -O[n], --enable-optimization[=n]
852 --disable-optimization
853 :synopsis: Build with optimization.
857 Build with optimization. This is appropriate for production use,
858 taking more time to build faster libraries and programs.
860 The optional *nat* value is the optimisation level. Some compilers
861 support multiple optimisation levels. The range is 0 to 2. Level 0
862 disables optimization, level 1 is the default. Level 2 is higher
863 optimisation if the compiler supports it. Level 2 is likely to lead
864 to longer compile times and bigger generated code. If you are not
865 planning to run code, turning off optimization will lead to better
866 build times and less code to be rebuilt when a module changes.
868 When optimizations are enabled, Cabal passes ``-O2`` to the C compiler.
870 We also accept ``True`` (equivalent to 1) and ``False`` (equivalent
873 Note that as of GHC 8.0, GHC does not recompile when optimization
874 levels change (see :ghc-ticket:`10923`), so if
875 you change the optimization level for a local package you may need
876 to blow away your old build products in order to rebuild with the
877 new optimization level.
879 The command line variant of this flag is ``-O2`` (with ``-O1``
880 equivalent to ``-O``). There are also long-form variants
881 ``--enable-optimization`` and ``--disable-optimization``.
883 .. cfg-field:: configure-options: OPT (space separated list)
884 --configure-option=OPT
885 :synopsis: Options to pass to configure script.
887 A list of extra arguments to pass to the external ``./configure``
888 script, if one is used. This is only useful for packages which have
889 the ``Configure`` build type. See also the section on
890 :ref:`system-dependent parameters`.
892 The command line variant of this flag is ``--configure-option=arg``,
893 which can be specified multiple times to pass multiple options.
895 .. cfg-field:: compiler: ghc, ghcjs, jhc, lhc, uhc or haskell-suite
897 :synopsis: Compiler to build with.
901 Specify the compiler toolchain to be used. This is independent of
902 ``with-compiler``, because the choice of toolchain affects Cabal's
905 The command line variant of this flag is ``--compiler=ghc``.
907 It's not possible to set :cfg-field:`compiler` on a
910 .. cfg-field:: tests: boolean
913 :synopsis: Build tests.
917 Force test suites to be enabled. For most users this should not be
918 needed, as we always attempt to solve for test suite dependencies,
919 even when this value is ``False``; furthermore, test suites are
920 automatically enabled if they are requested as a built target.
922 The command line variant of this flag is ``--enable-tests`` and
925 .. cfg-field:: benchmarks: boolean
928 :synopsis: Build benchmarks.
932 Force benchmarks to be enabled. For most users this should not be
933 needed, as we always attempt to solve for benchmark dependencies,
934 even when this value is ``False``; furthermore, benchmarks are
935 automatically enabled if they are requested as a built target.
937 The command line variant of this flag is ``--enable-benchmarks`` and
938 ``--disable-benchmarks``.
940 .. _cmdoption-extra-prog-path:
941 .. cfg-field:: extra-prog-path: PATH (newline or comma separated list)
942 --extra-prog-path=PATH
943 :synopsis: Add directories to program search path.
946 A list of directories to search for extra required programs. Most
947 users should not need this, as programs like ``happy`` and ``alex``
948 will automatically be installed and added to the path. This can be
949 useful if a ``Custom`` setup script relies on an exotic extra
952 The command line variant of this flag is ``--extra-prog-path=PATH``,
953 which can be specified multiple times.
955 When specifying :ref:`--http-transport<cmdoption-http-transport>` from the
956 command line, only extra-prog-path from the command line are added to the
959 .. cfg-field:: run-tests: boolean
961 :synopsis: Run package test suite during installation.
965 Run the package test suite during installation. This is useful for
966 saying "When this package is installed, check that the test suite
967 passes, terminating the rest of the build if it is broken."
971 One deficiency: the :cfg-field:`run-tests` setting of a package is NOT
972 recorded as part of the hash, so if you install something without
973 :cfg-field:`run-tests` and then turn on ``run-tests``, we won't
974 subsequently test the package. If this is causing you problems, give
977 The command line variant of this flag is ``--run-tests``.
982 .. cfg-field:: debug-info: integer
983 --enable-debug-info[=n]
985 :synopsis: Build with debug info enabled.
990 If the compiler (e.g., GHC 7.10 and later) supports outputting OS
991 native debug info (e.g., DWARF), setting ``debug-info: True`` will
992 instruct it to do so. See the GHC wiki page on :ghc-wiki:`DWARF`
993 for more information about this feature.
995 (This field also accepts numeric syntax, but until GHC 8.2 this didn't
998 The command line variant of this flag is ``--enable-debug-info`` and
999 ``--disable-debug-info``.
1001 .. cfg-field:: split-sections: boolean
1002 --enable-split-sections
1003 --disable-split-sections
1004 :synopsis: Use GHC's split sections feature.
1009 Use the GHC ``-split-sections`` feature when building the library. This
1010 reduces the final size of the executables that use the library by
1011 allowing them to link with only the bits that they use rather than
1012 the entire library. The downside is that building the library takes
1013 longer and uses a bit more memory.
1015 This feature is supported by GHC 8.0 and later.
1017 The command line variant of this flag is ``--enable-split-sections`` and
1018 ``--disable-split-sections``.
1020 .. cfg-field:: split-objs: boolean
1022 --disable-split-objs
1023 :synopsis: Use GHC's split objects feature.
1027 Use the GHC ``-split-objs`` feature when building the library. This
1028 reduces the final size of the executables that use the library by
1029 allowing them to link with only the bits that they use rather than
1030 the entire library. The downside is that building the library takes
1031 longer and uses considerably more memory.
1033 It is generally recommend that you use ``split-sections`` instead
1034 of ``split-objs`` where possible.
1036 The command line variant of this flag is ``--enable-split-objs`` and
1037 ``--disable-split-objs``.
1039 .. cfg-field:: executable-stripping: boolean
1040 --enable-executable-stripping
1041 --disable-executable-stripping
1042 :synopsis: Strip installed programs.
1046 When installing binary executable programs, run the ``strip``
1047 program on the binary. This can considerably reduce the size of the
1048 executable binary file. It does this by removing debugging
1049 information and symbols.
1051 Not all Haskell implementations generate native binaries. For such
1052 implementations this option has no effect.
1054 If ``debug-info`` is set explicitly then ``executable-stripping`` is set
1055 to ``False`` as otherwise all the debug symbols will be stripped.
1057 The command line variant of this flag is
1058 ``--enable-executable-stripping`` and
1059 ``--disable-executable-stripping``.
1061 .. cfg-field:: library-stripping: boolean
1062 --enable-library-stripping
1063 --disable-library-stripping
1064 :synopsis: Strip installed libraries.
1067 When installing binary libraries, run the ``strip`` program on the
1068 binary, saving space on the file system. See also
1069 ``executable-stripping``.
1071 If ``debug-info`` is set explicitly then ``library-stripping`` is set
1072 to ``False`` as otherwise all the debug symbols will be stripped.
1074 The command line variant of this flag is
1075 ``--enable-library-stripping`` and ``--disable-library-stripping``.
1080 .. cfg-field:: program-prefix: PREFIX
1081 --program-prefix=PREFIX
1082 :synopsis: Prepend prefix to program names.
1084 :strike:`Prepend *prefix* to installed program names.` (Currently
1085 implemented in a silly and not useful way. If you need this to work
1088 *prefix* may contain the following path variables: ``$pkgid``,
1089 ``$pkg``, ``$version``, ``$compiler``, ``$os``, ``$arch``, ``$abi``,
1092 The command line variant of this flag is ``--program-prefix=foo-``.
1094 .. cfg-field:: program-suffix: SUFFIX
1095 --program-suffix=SUFFIX
1096 :synopsis: Append refix to program names.
1098 :strike:`Append *suffix* to installed program names.` (Currently
1099 implemented in a silly and not useful way. If you need this to work
1102 The most obvious use for this is to append the program's version
1103 number to make it possible to install several versions of a program
1104 at once: ``program-suffix: $version``.
1106 *suffix* may contain the following path variables: ``$pkgid``,
1107 ``$pkg``, ``$version``, ``$compiler``, ``$os``, ``$arch``, ``$abi``,
1110 The command line variant of this flag is
1111 ``--program-suffix='$version'``.
1113 Dynamic linking options
1114 ^^^^^^^^^^^^^^^^^^^^^^^
1116 .. cfg-field:: shared: boolean
1119 :synopsis: Build shared library.
1123 Build shared library. This implies a separate compiler run to
1124 generate position independent code as required on most platforms.
1126 The command line variant of this flag is ``--enable-shared`` and
1127 ``--disable-shared``.
1129 .. cfg-field:: executable-dynamic: boolean
1130 --enable-executable-dynamic
1131 --disable-executable-dynamic
1132 :synopsis: Link executables dynamically.
1136 Link executables dynamically. The executable's library dependencies
1137 should be built as shared objects. This implies ``shared: True``
1138 unless ``shared: False`` is explicitly specified.
1140 The command line variant of this flag is
1141 ``--enable-executable-dynamic`` and
1142 ``--disable-executable-dynamic``.
1144 .. cfg-field:: library-for-ghci: boolean
1145 --enable-library-for-ghci
1146 --disable-library-for-ghci
1147 :synopsis: Build libraries suitable for use with GHCi.
1151 Build libraries suitable for use with GHCi. This involves an extra
1152 linking step after the build.
1154 Not all platforms support GHCi and indeed on some platforms, trying
1155 to build GHCi libs fails. In such cases, consider setting
1156 ``library-for-ghci: False``.
1158 The command line variant of this flag is
1159 ``--enable-library-for-ghci`` and ``--disable-library-for-ghci``.
1161 .. cfg-field:: relocatable:
1163 :synopsis: Build relocatable package.
1168 :strike:`Build a package which is relocatable.` (TODO: It is not
1169 clear what this actually does, or if it works at all.)
1171 The command line variant of this flag is ``--relocatable``.
1173 Static linking options
1174 ^^^^^^^^^^^^^^^^^^^^^^
1176 .. cfg-field:: static: boolean
1179 :synopsis: Build static library.
1184 Roll this and all dependent libraries into a combined ``.a`` archive.
1185 This uses GHCs ``-staticlib`` flag, which is available for iOS and with
1186 GHC 8.4 and later for other platforms as well.
1188 .. cfg-field:: executable-static: boolean
1189 --enable-executable-static
1190 --disable-executable-static
1191 :synopsis: Build fully static executables.
1196 Build fully static executables.
1197 This links all dependent libraries into executables statically,
1199 This passes ``-static`` and ``-optl=-static`` to GHC.
1201 Foreign function interface options
1202 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1204 .. cfg-field:: extra-include-dirs: directories (comma or newline separated list)
1205 --extra-include-dirs=DIR
1206 :synopsis: Adds C header search path.
1208 An extra directory to search for C header files. You can use this
1209 flag multiple times to get a list of directories.
1211 You might need to use this flag if you have standard system header
1212 files in a non-standard location that is not mentioned in the
1213 package's ``.cabal`` file. Using this option has the same affect as
1214 appending the directory *dir* to the :pkg-field:`include-dirs` field in each
1215 library and executable in the package's ``.cabal`` file. The
1216 advantage of course is that you do not have to modify the package at
1217 all. These extra directories will be used while building the package
1218 and for libraries it is also saved in the package registration
1219 information and used when compiling modules that use the library.
1221 The command line variant of this flag is
1222 ``--extra-include-dirs=DIR``, which can be specified multiple times.
1224 .. cfg-field:: extra-lib-dirs: directories (comma or newline separated list)
1225 --extra-lib-dirs=DIR
1226 :synopsis: Adds library search directory.
1228 An extra directory to search for system libraries files.
1230 The command line variant of this flag is ``--extra-lib-dirs=DIR``,
1231 which can be specified multiple times.
1233 .. cfg-field:: extra-framework-dirs: directories (comma or newline separated list)
1234 --extra-framework-dirs=DIR
1235 :synopsis: Adds framework search directory (OS X only).
1237 An extra directory to search for frameworks (OS X only).
1239 You might need to use this flag if you have standard system
1240 libraries in a non-standard location that is not mentioned in the
1241 package's ``.cabal`` file. Using this option has the same affect as
1242 appending the directory *dir* to the :cfg-field:`extra-lib-dirs` field in
1243 each library and executable in the package's ``.cabal`` file. The
1244 advantage of course is that you do not have to modify the package at
1245 all. These extra directories will be used while building the package
1246 and for libraries it is also saved in the package registration
1247 information and used when compiling modules that use the library.
1249 The command line variant of this flag is
1250 ``--extra-framework-dirs=DIR``, which can be specified multiple
1256 .. cfg-field:: profiling: boolean
1259 :synopsis: Enable profiling builds.
1264 Build libraries and executables with profiling enabled (for
1265 compilers that support profiling as a separate mode). It is only
1266 necessary to specify :cfg-field:`profiling` for the specific package you
1267 want to profile; ``cabal build`` will ensure that all of its
1268 transitive dependencies are built with profiling enabled.
1270 To enable profiling for only libraries or executables, see
1271 :cfg-field:`library-profiling` and :cfg-field:`executable-profiling`.
1273 For useful profiling, it can be important to control precisely what
1274 cost centers are allocated; see :cfg-field:`profiling-detail`.
1276 The command line variant of this flag is ``--enable-profiling`` and
1277 ``--disable-profiling``.
1279 .. cfg-field:: profiling-detail: level
1280 --profiling-detail=level
1281 :synopsis: Profiling detail level.
1284 Some compilers that support profiling, notably GHC, can allocate
1285 costs to different parts of the program and there are different
1286 levels of granularity or detail with which this can be done. In
1287 particular for GHC this concept is called "cost centers", and GHC
1288 can automatically add cost centers, and can do so in different ways.
1290 This flag covers both libraries and executables, but can be
1291 overridden by the ``library-profiling-detail`` field.
1293 Currently this setting is ignored for compilers other than GHC. The
1294 levels that cabal currently supports are:
1297 For GHC this uses ``exported-functions`` for libraries and
1298 ``toplevel-functions`` for executables.
1300 No costs will be assigned to any code within this component.
1302 Costs will be assigned at the granularity of all top level
1303 functions exported from each module. In GHC, this
1304 is for non-inline functions. Corresponds to ``-fprof-auto-exported``.
1306 Costs will be assigned at the granularity of all top level
1307 functions in each module, whether they are exported from the
1308 module or not. In GHC specifically, this is for non-inline
1309 functions. Corresponds to ``-fprof-auto-top``.
1311 Costs will be assigned at the granularity of all functions in
1312 each module, whether top level or local. In GHC specifically,
1313 this is for non-inline toplevel or where-bound functions or
1314 values. Corresponds to ``-fprof-auto``.
1316 Like top-level but costs will be assigned to top level definitions after
1317 optimization. This lowers profiling overhead massively while giving similar
1318 levels of detail as toplevle-functions. However it means functions introduced
1319 by GHC during optimization will show up in profiles as well.
1320 Corresponds to ``-fprof-late`` if supported and ``-fprof-auto-top`` otherwise.
1322 Currently an alias for late-toplevel
1324 The command line variant of this flag is
1325 ``--profiling-detail=none``.
1327 .. cfg-field:: library-profiling-detail: level
1328 --library-profiling-detail=level
1329 :synopsis: Libraries profiling detail level.
1332 Like :cfg-field:`profiling-detail`, but applied only to libraries
1334 The command line variant of this flag is
1335 ``--library-profiling-detail=none``.
1337 .. cfg-field:: library-vanilla: boolean
1338 --enable-library-vanilla
1339 --disable-library-vanilla
1340 :synopsis: Build libraries without profiling.
1344 Build ordinary libraries (as opposed to profiling libraries).
1345 Mostly, you can set this to False to avoid building ordinary
1346 libraries when you are profiling.
1348 The command line variant of this flag is
1349 ``--enable-library-vanilla`` and ``--disable-library-vanilla``.
1351 .. cfg-field:: library-profiling: boolean
1352 --enable-library-profiling
1353 --disable-library-profiling
1354 :synopsis: Build libraries with profiling enabled.
1359 Build libraries with profiling enabled. You probably want
1360 to use :cfg-field:`profiling` instead.
1362 The command line variant of this flag is
1363 ``--enable-library-profiling`` and ``--disable-library-profiling``.
1365 .. cfg-field:: executable-profiling: boolean
1366 --enable-executable-profiling
1367 --disable-executable-profiling
1368 :synopsis: Build executables with profiling enabled.
1373 Build executables with profiling enabled. You probably want
1374 to use :cfg-field:`profiling` instead.
1376 The command line variant of this flag is
1377 ``--enable-executable-profiling`` and
1378 ``--disable-executable-profiling``.
1383 .. cfg-field:: coverage: boolean
1386 :synopsis: Build with coverage enabled.
1391 Build libraries and executables (including test suites) with Haskell
1392 Program Coverage enabled. Running the test suites will automatically
1393 generate coverage reports with HPC.
1395 The command line variant of this flag is ``--enable-coverage`` and
1396 ``--disable-coverage``.
1398 .. cfg-field:: library-coverage: boolean
1399 --enable-library-coverage
1400 --disable-library-coverage
1406 Deprecated, use :cfg-field:`coverage`.
1408 The command line variant of this flag is
1409 ``--enable-library-coverage`` and ``--disable-library-coverage``.
1414 .. cfg-field:: documentation: boolean
1415 --enable-documentation
1416 --disable-documentation
1417 :synopsis: Enable building of documentation.
1421 Enables building of Haddock documentation.
1422 Implied when calling ``cabal haddock``.
1424 The command line variant of this flag is ``--enable-documentation``
1425 and ``--disable-documentation``.
1427 ``documentation: true`` does not imply
1428 :cfg-field:`haddock-all`,
1429 :cfg-field:`haddock-benchmarks`,
1430 :cfg-field:`haddock-executables`,
1431 :cfg-field:`haddock-internal` or
1432 :cfg-field:`haddock-tests`.
1433 These need to be enabled separately if desired.
1435 .. cfg-field:: doc-index-file: templated path
1436 --doc-index-file=TEMPLATE
1437 :synopsis: Path to haddock templates.
1439 A central index of Haddock API documentation (template cannot use
1440 ``$pkgid``), which should be updated as documentation is built.
1442 The following commands are equivalent to ones that would be passed when
1443 running ``setup haddock``.
1445 .. cfg-field:: haddock-hoogle: boolean
1447 :synopsis: Generate Hoogle file.
1451 Generate a text file which can be converted by Hoogle_
1452 into a database for searching.
1453 This is equivalent to running ``haddock`` with the ``--hoogle`` flag.
1455 .. cfg-field:: haddock-html: boolean
1457 :synopsis: Build HTML documentation.
1461 Build HTML documentation.
1463 .. cfg-field:: haddock-quickjump: boolean
1465 :synopsis: Generate Quickjump file.
1469 Generate an index for interactive documentation navigation.
1470 This is equivalent to running ``haddock`` with the ``--quickjump`` flag.
1472 .. cfg-field:: haddock-html-location: URL (templated path)
1473 --haddock-html-location=URL
1474 :synopsis: Location of HTML documentation for prerequisite packages.
1476 Specify a template for the location of HTML documentation for
1477 prerequisite packages. The substitutions are applied to the template
1478 to obtain a location for each package, which will be used by
1479 hyperlinks in the generated documentation. For example, the
1480 following command generates links pointing at Hackage pages:
1484 html-location: http://hackage.haskell.org/packages/archive/$pkg/latest/doc/html
1486 If passed on the command line,
1487 the argument may be quoted to prevent substitution by the shell.
1491 --html-location='http://hackage.haskell.org/packages/archive/$pkg/latest/doc/html'
1493 If this option is omitted, the location for each package is obtained
1494 using the package tool (e.g. ``ghc-pkg``).
1496 .. cfg-field:: haddock-executables: boolean
1497 --haddock-executables
1498 :synopsis: Generate documentation for executables.
1502 Run haddock on all executable programs.
1504 .. cfg-field:: haddock-tests: boolean
1506 :synopsis: Generate documentation for tests.
1510 Run haddock on all test suites.
1512 .. cfg-field:: haddock-benchmarks: boolean
1513 --haddock-benchmarks
1514 :synopsis: Generate documentation for benchmarks.
1518 Run haddock on all benchmarks.
1520 .. cfg-field:: haddock-internal: boolean
1522 :synopsis: Generate documentation for internal modules
1526 Build haddock documentation which includes unexposed modules and
1529 .. cfg-field:: haddock-all: boolean
1531 :synopsis: Generate documentation for everything
1535 Run haddock on all components.
1537 .. cfg-field:: haddock-css: PATH
1539 :synopsis: Location of Haddock CSS file.
1541 The CSS file that should be used to style the generated
1542 documentation (overriding haddock's default).
1544 .. cfg-field:: haddock-hyperlink-source: boolean
1545 --haddock-hyperlink-source
1546 :synopsis: Generate hyperlinked source code for documentation
1550 Generated hyperlinked source code using `HsColour`_, and have
1551 Haddock documentation link to it.
1552 This is equivalent to running ``haddock`` with the ``--hyperlinked-source`` flag.
1554 .. cfg-field:: haddock-hscolour-css: PATH
1555 --haddock-hscolour-css=PATH
1556 :synopsis: Location of CSS file for HsColour
1558 The CSS file that should be used to style the generated hyperlinked
1559 source code (from `HsColour`_).
1561 .. cfg-field:: haddock-contents-location: URL
1562 --haddock-contents-location=URL
1563 :synopsis: URL for contents page.
1565 A baked-in URL to be used as the location for the contents page.
1567 .. cfg-field:: haddock-keep-temp-files: boolean
1568 :synopsis: Keep temporary Haddock files.
1570 Keep temporary files.
1572 There is no command line variant of this flag.
1574 .. cfg-field:: haddock-output-dir: DIR
1575 --haddock-output-dir=DIR
1576 :synopsis: Generate haddock documentation into this directory.
1578 Generate haddock documentation into this directory instead of the default
1579 location next to other build products.
1581 This flag is provided as a technology preview and is subject to change in the
1584 .. cfg-field:: open: boolean
1586 :synopsis: Open generated documentation in-browser.
1588 When generating HTML documentation, attempt to open it in a browser
1589 when complete. This will use ``xdg-open`` on Linux and BSD systems,
1590 ``open`` on macOS, and ``start`` on Windows.
1592 Advanced global configuration options
1593 -------------------------------------
1595 .. cfg-field:: write-ghc-environment-files: always, never, or ghc8.4.4+
1596 --write-ghc-environment-files=always\|never\|ghc8.4.4+
1597 :synopsis: Whether a ``.ghc.environment`` should be created after a successful build.
1601 Whether a `GHC package environment file <https://downloads.haskell.org/~ghc/master/users-guide/packages.html#package-environments>`_
1602 should be created after a successful build.
1604 Since Cabal 3.0, defaults to ``never``. Before that, defaulted to
1605 creating them only when compiling with GHC 8.4.4 and older (GHC
1606 8.4.4 `is the first version
1607 <https://gitlab.haskell.org/ghc/ghc/-/issues/13753>`_ that supports
1608 the ``-package-env -`` option that allows ignoring the package
1611 .. cfg-field:: build-info: True, False
1613 --disable-build-info
1614 :synopsis: Whether build information for each individual component should be
1615 written in a machine readable format.
1619 Enable generation of build information for Cabal components. Contains very
1620 detailed information on how to build an individual component, such as
1621 compiler version, modules of a component and how to compile the component.
1623 The output format is in json, and the exact location can be discovered from
1624 ``plan.json``, where it is identified by ``build-info`` within the items in
1625 the ``install-plan``.
1626 Note, that this field in ``plan.json`` can be ``null``, if and only if
1627 ``build-type: Custom`` is set, and the ``Cabal`` version is too
1628 old (i.e. ``< 3.7``).
1629 If the field is missing entirely, the component is not a local one, thus,
1630 no ``build-info`` exists for that particular component within the
1634 The format and fields of the generated build information is currently experimental,
1635 in the future we might add or remove fields, depending on the needs of other tooling.
1637 .. _cmdoption-http-transport:
1638 .. cfg-field:: http-transport: curl, wget, powershell, or plain-http
1639 --http-transport=transport
1640 :synopsis: Transport to use with http(s) requests.
1644 Set a transport to be used when making http(s) requests.
1646 The command line variant of this field is ``--http-transport=curl``.
1648 If the project configuration imports remote urls, the user can only specify
1649 the http-transport option from the command line.
1651 When specifying the http-transport from the command line, the program
1652 search path can only be influenced using :ref:`--extra-prog-path<cmdoption-extra-prog-path>`.
1654 .. cfg-field:: ignore-expiry: boolean
1656 :synopsis: Ignore Hackage expiration dates.
1660 If ``True``, we will ignore expiry dates on metadata from Hackage.
1662 In general, you should not set this to ``True`` as it will leave you
1663 vulnerable to stale cache attacks. However, it may be temporarily
1664 useful if the main Hackage server is down, and we need to rely on
1665 mirrors which have not been updated for longer than the expiry
1666 period on the timestamp.
1668 The command line variant of this field is ``--ignore-expiry``.
1670 .. cfg-field:: remote-repo-cache: directory
1671 --remote-repo-cache=DIR
1672 :synopsis: Location of packages cache.
1674 :default: ``~/.cabal/packages``
1676 The location where packages downloaded from remote repositories will be
1679 The command line variant of this flag is
1680 ``--remote-repo-cache=DIR``.
1682 .. cfg-field:: logs-dir: directory
1684 :synopsis: Directory to store build logs.
1686 :default: ``~/.cabal/logs``
1688 :strike:`The location where build logs for packages are stored.`
1689 Not implemented yet.
1691 The command line variant of this flag is ``--logs-dir=DIR``.
1693 .. cfg-field:: build-summary: template filepath
1694 --build-summary=TEMPLATE
1695 :synopsis: Build summaries location.
1697 :default: ``~/.cabal/logs/build.log``
1699 :strike:`The file to save build summaries.` Not implemented yet.
1701 Valid variables which can be used in the path are ``$pkgid``,
1702 ``$compiler``, ``$os`` and ``$arch``.
1704 The command line variant of this flag is
1705 ``--build-summary=TEMPLATE``.
1707 Undocumented fields: ``root-cmd``, ``symlink-bindir``, ``build-log``,
1708 ``remote-build-reporting``, ``report-planned-failure``, ``offline``.
1710 Advanced solver options
1711 ^^^^^^^^^^^^^^^^^^^^^^^
1713 Most users generally won't need these.
1715 .. cfg-field:: solver: SOLVER
1717 :synopsis: Which solver to use.
1719 This field is reserved to allow the specification of alternative
1720 dependency solvers. At the moment, the only accepted option is
1723 The command line variant of this field is ``--solver=modular``.
1725 .. cfg-field:: max-backjumps: nat
1727 :synopsis: Maximum number of solver backjumps.
1731 Maximum number of backjumps (backtracking multiple steps) allowed
1732 while solving. Set -1 to allow unlimited backtracking, and 0 to
1733 disable backtracking completely.
1735 The command line variant of this field is ``--max-backjumps=4000``.
1737 .. cfg-field:: reorder-goals: boolean
1740 :synopsis: Allow solver to reorder goals.
1744 When enabled, the solver will reorder goals according to certain
1745 heuristics. Slows things down on average, but may make backtracking
1746 faster for some packages. It's unlikely to help for small projects,
1747 but for big install plans it may help you find a plan when otherwise
1748 this is not possible. See :issue:`1780` for more commentary.
1750 The command line variant of this field is ``--(no-)reorder-goals``.
1752 .. cfg-field:: count-conflicts: boolean
1754 --no-count-conflicts
1755 :synopsis: Solver prefers versions with less conflicts.
1759 Try to speed up solving by preferring goals that are involved in a
1762 The command line variant of this field is
1763 ``--(no-)count-conflicts``.
1765 .. cfg-field:: fine-grained-conflicts: boolean
1766 --fine-grained-conflicts
1767 --no-fine-grained-conflicts
1768 :synopsis: Skip a version of a package if it does not resolve any conflicts
1769 encountered in the last version (solver optimization).
1773 When enabled, the solver will skip a version of a package if it does not
1774 resolve any of the conflicts encountered in the last version of that
1775 package. For example, if ``foo-1.2`` depended on ``bar``, and the solver
1776 couldn't find consistent versions for ``bar``'s dependencies, then the
1777 solver would skip ``foo-1.1`` if it also depended on ``bar``.
1779 The command line variant of this field is
1780 ``--(no-)fine-grained-conflicts``.
1782 .. cfg-field:: minimize-conflict-set: boolean
1783 --minimize-conflict-set
1784 --no-minimize-conflict-set
1785 :synopsis: Try to improve the solver error message when there is no
1790 When there is no solution, try to improve the solver error message
1791 by finding a minimal conflict set. This option may increase run
1792 time significantly, so it is off by default.
1794 The command line variant of this field is
1795 ``--(no-)minimize-conflict-set``.
1797 .. cfg-field:: strong-flags: boolean
1800 :synopsis: Do not defer flag choices when solving.
1804 Do not defer flag choices. (TODO: Better documentation.)
1806 The command line variant of this field is ``--(no-)strong-flags``.
1808 .. cfg-field:: allow-boot-library-installs: boolean
1809 --allow-boot-library-installs
1810 --no-allow-boot-library-installs
1811 :synopsis: Allow cabal to install or upgrade any package.
1815 By default, the dependency solver doesn't allow ``base``,
1816 ``ghc-prim``, ``integer-simple``, ``integer-gmp``, and
1817 ``template-haskell`` to be installed or upgraded. This flag
1818 removes the restriction.
1820 The command line variant of this field is
1821 ``--(no-)allow-boot-library-installs``.
1823 .. cfg-field:: cabal-lib-version: VERSION
1824 --cabal-lib-version=VERSION
1825 :synopsis: Version of Cabal library used to build package.
1827 This field selects the version of the Cabal library which should be
1828 used to build packages. This option is intended primarily for
1829 internal development use (e.g., forcing a package to build with a
1830 newer version of Cabal, to test a new version of Cabal.) (TODO:
1831 Specify its semantics more clearly.)
1833 The command line variant of this field is
1834 ``--cabal-lib-version=1.24.0.1``.
1836 .. cfg-field:: prefer-oldest: boolean
1839 :synopsis: Prefer the oldest versions of packages available.
1844 By default, when solver has a choice of multiple versions of the same
1845 package, it will first try to derive a build plan with the latest
1846 version. This flag switches the behaviour, making the solver
1847 to prefer the oldest packages available.
1849 The primary use case is to help users in establishing lower bounds
1850 of upstream dependencies.
1852 The command line variant of this field is ``--(no-)prefer-oldest``.
1854 .. include:: references.inc