@@ -4,24 +4,24 @@ cabal-install Commands
4
4
We now give an in-depth description of all the commands, describing the
5
5
arguments and flags they accept.
6
6
7
- cabal v2- configure
7
+ cabal configure
8
8
-------------------
9
9
10
- ``cabal v2- configure `` takes a set of arguments and writes a
10
+ ``cabal configure `` takes a set of arguments and writes a
11
11
``cabal.project.local `` file based on the flags passed to this command.
12
- ``cabal v2- configure FLAGS; cabal new- build `` is roughly equivalent to
13
- ``cabal v2- build FLAGS ``, except that with ``new- configure `` the flags
14
- are persisted to all subsequent calls to ``v2- build ``.
12
+ ``cabal configure FLAGS; cabal build `` is roughly equivalent to
13
+ ``cabal build FLAGS ``, except that with ``configure `` the flags
14
+ are persisted to all subsequent calls to ``build ``.
15
15
16
- ``cabal v2- configure `` is intended to be a convenient way to write out
16
+ ``cabal configure `` is intended to be a convenient way to write out
17
17
a ``cabal.project.local `` for simple configurations; e.g.,
18
- ``cabal v2- configure -w ghc-7.8 `` would ensure that all subsequent
19
- builds with ``cabal v2- build `` are performed with the compiler
18
+ ``cabal configure -w ghc-7.8 `` would ensure that all subsequent
19
+ builds with ``cabal build `` are performed with the compiler
20
20
``ghc-7.8 ``. For more complex configuration, we recommend writing the
21
21
``cabal.project.local `` file directly (or placing it in
22
22
``cabal.project ``!)
23
23
24
- ``cabal v2- configure `` inherits options from ``Cabal ``. semantics:
24
+ ``cabal configure `` inherits options from ``Cabal ``. semantics:
25
25
26
26
- Any flag accepted by ``./Setup configure ``.
27
27
@@ -42,24 +42,24 @@ to happen if a flag actually applied to every transitive dependency). To
42
42
apply options to an external package, use a ``package `` stanza in a
43
43
``cabal.project `` file.
44
44
45
- cabal v2- update
45
+ cabal update
46
46
----------------
47
47
48
- ``cabal v2- update `` updates the state of the package index. If the
48
+ ``cabal update `` updates the state of the package index. If the
49
49
project contains multiple remote package repositories it will update
50
50
the index of all of them (e.g. when using overlays).
51
51
52
52
Some examples:
53
53
54
54
::
55
55
56
- $ cabal v2- update # update all remote repos
57
- $ cabal v2- update head.hackage # update only head.hackage
56
+ $ cabal update # update all remote repos
57
+ $ cabal update head.hackage # update only head.hackage
58
58
59
- cabal v2- build
59
+ cabal build
60
60
---------------
61
61
62
- ``cabal v2- build `` takes a set of targets and builds them. It
62
+ ``cabal build `` takes a set of targets and builds them. It
63
63
automatically handles building and installing any dependencies of these
64
64
targets.
65
65
@@ -97,30 +97,30 @@ Some example targets:
97
97
98
98
::
99
99
100
- $ cabal v2- build lib:foo-pkg # build the library named foo-pkg
101
- $ cabal v2- build foo-pkg:foo-tests # build foo-tests in foo-pkg
100
+ $ cabal build lib:foo-pkg # build the library named foo-pkg
101
+ $ cabal build foo-pkg:foo-tests # build foo-tests in foo-pkg
102
102
103
103
(There is also syntax for specifying module and file targets, but it
104
104
doesn't currently do anything.)
105
105
106
- Beyond a list of targets, ``cabal v2- build `` accepts all the flags that
107
- ``cabal v2- configure `` takes. Most of these flags are only taken into
106
+ Beyond a list of targets, ``cabal build `` accepts all the flags that
107
+ ``cabal configure `` takes. Most of these flags are only taken into
108
108
consideration when building local packages; however, some flags may
109
109
cause extra store packages to be built (for example,
110
110
``--enable-profiling `` will automatically make sure profiling libraries
111
111
for all transitive dependencies are built and installed.)
112
112
113
- In addition ``cabal v2- build `` accepts these flags:
113
+ In addition ``cabal build `` accepts these flags:
114
114
115
115
- ``--only-configure ``: When given we will forgoe performing a full build and
116
116
abort after running the configure phase of each target package.
117
117
118
118
119
- cabal v2- repl
119
+ cabal repl
120
120
--------------
121
121
122
- ``cabal v2- repl TARGET `` loads all of the modules of the target into
123
- GHCi as interpreted bytecode. In addition to ``cabal v2- build ``'s flags,
122
+ ``cabal repl TARGET `` loads all of the modules of the target into
123
+ GHCi as interpreted bytecode. In addition to ``cabal build ``'s flags,
124
124
it takes an additional ``--repl-options `` flag.
125
125
126
126
To avoid ``ghci `` specific flags from triggering unneeded global rebuilds these
@@ -130,8 +130,8 @@ other repls). Instead, you should use the new ``--repl-options`` flag to
130
130
specify these options to the invoked repl. (This flag also works on ``cabal
131
131
repl `` and ``Setup repl `` on sufficiently new versions of Cabal.)
132
132
133
- Currently, it is not supported to pass multiple targets to ``v2- repl ``
134
- (``v2- repl `` will just successively open a separate GHCi session for
133
+ Currently, it is not supported to pass multiple targets to ``repl ``
134
+ (``repl `` will just successively open a separate GHCi session for
135
135
each target.)
136
136
137
137
It also provides a way to experiment with libraries without needing to download
@@ -142,34 +142,34 @@ of the ``vector`` package matching that specification exposed.
142
142
143
143
::
144
144
145
- $ cabal v2- repl --build-depends "vector >= 0.12 && < 0.13"
145
+ $ cabal repl --build-depends "vector >= 0.12 && < 0.13"
146
146
147
147
Both of these commands do the same thing as the above, but only exposes ``base ``,
148
148
``vector ``, and the ``vector `` package's transitive dependencies even if the user
149
149
is in a project context.
150
150
151
151
::
152
152
153
- $ cabal v2- repl --ignore-project --build-depends "vector >= 0.12 && < 0.13"
154
- $ cabal v2- repl --project='' --build-depends "vector >= 0.12 && < 0.13"
153
+ $ cabal repl --ignore-project --build-depends "vector >= 0.12 && < 0.13"
154
+ $ cabal repl --project='' --build-depends "vector >= 0.12 && < 0.13"
155
155
156
156
This command would add ``vector ``, but not (for example) ``primitive ``, because
157
157
it only includes the packages specified on the command line (and ``base ``, which
158
158
cannot be excluded for technical reasons).
159
159
160
160
::
161
161
162
- $ cabal v2- repl --build-depends vector --no-transitive-deps
162
+ $ cabal repl --build-depends vector --no-transitive-deps
163
163
164
- cabal v2- run
164
+ cabal run
165
165
-------------
166
166
167
- ``cabal v2- run [TARGET [ARGS] ] `` runs the executable specified by the
167
+ ``cabal run [TARGET [ARGS] `` runs the executable specified by the
168
168
target, which can be a component, a package or can be left blank, as
169
169
long as it can uniquely identify an executable within the project.
170
170
Tests and benchmarks are also treated as executables.
171
171
172
- See `the v2- build section <#cabal-new-build >`__ for the target syntax.
172
+ See `the build section <#cabal-new-build >`__ for the target syntax.
173
173
174
174
Except in the case of the empty target, the strings after it will be
175
175
passed to the executable as arguments.
@@ -180,17 +180,17 @@ have to separate them with ``--``.
180
180
181
181
::
182
182
183
- $ cabal v2- run target -- -a -bcd --argument
183
+ $ cabal run target -- -a -bcd --argument
184
184
185
- 'v2- run' also supports running script files that use a certain format. With
185
+ 'run' also supports running script files that use a certain format. With
186
186
a script that looks like:
187
187
188
188
::
189
189
190
190
#!/usr/bin/env cabal
191
191
{- cabal:
192
192
build-depends: base ^>= 4.11
193
- , shelly ^>= 1.8.1
193
+ , shelly ^>= 1.8.1
194
194
-}
195
195
196
196
main :: IO ()
@@ -202,13 +202,13 @@ interpreter, or through this command:
202
202
203
203
::
204
204
205
- $ cabal v2- run script.hs
206
- $ cabal v2- run script.hs -- --arg1 # args are passed like this
205
+ $ cabal run script.hs
206
+ $ cabal run script.hs -- --arg1 # args are passed like this
207
207
208
- cabal v2- freeze
208
+ cabal freeze
209
209
----------------
210
210
211
- ``cabal v2- freeze `` writes out a **freeze file ** which records all of
211
+ ``cabal freeze `` writes out a **freeze file ** which records all of
212
212
the versions and flags which that are picked by the solver under the
213
213
current index and flags. Default name of this file is
214
214
``cabal.project.freeze `` but in combination with a
@@ -235,66 +235,66 @@ users see a consistent set of dependencies. For libraries, this is not
235
235
recommended: users often need to build against different versions of
236
236
libraries than what you developed against.
237
237
238
- cabal v2- bench
238
+ cabal bench
239
239
---------------
240
240
241
- ``cabal v2- bench [TARGETS] [OPTIONS] `` runs the specified benchmarks
241
+ ``cabal bench [TARGETS] [OPTIONS] `` runs the specified benchmarks
242
242
(all the benchmarks in the current package by default), first ensuring
243
243
they are up to date.
244
244
245
- cabal v2- test
245
+ cabal test
246
246
--------------
247
247
248
- ``cabal v2- test [TARGETS] [OPTIONS] `` runs the specified test suites
248
+ ``cabal test [TARGETS] [OPTIONS] `` runs the specified test suites
249
249
(all the test suites in the current package by default), first ensuring
250
250
they are up to date.
251
251
252
- cabal v2- haddock
252
+ cabal haddock
253
253
-----------------
254
254
255
- ``cabal v2- haddock [FLAGS] [TARGET] `` builds Haddock documentation for
255
+ ``cabal haddock [FLAGS] [TARGET] `` builds Haddock documentation for
256
256
the specified packages within the project.
257
257
258
258
If a target is not a library :cfg-field: `haddock-benchmarks `,
259
259
:cfg-field: `haddock-executables `, :cfg-field: `haddock-internal `,
260
260
:cfg-field: `haddock-tests ` will be implied as necessary.
261
261
262
- cabal v2- exec
262
+ cabal exec
263
263
---------------
264
264
265
- ``cabal v2- exec [FLAGS] [--] COMMAND [--] [ARGS] `` runs the specified command
265
+ ``cabal exec [FLAGS] [--] COMMAND [--] [ARGS] `` runs the specified command
266
266
using the project's environment. That is, passing the right flags to compiler
267
267
invocations and bringing the project's executables into scope.
268
268
269
- cabal v2- install
269
+ cabal install
270
270
-----------------
271
271
272
- ``cabal v2- install [FLAGS] PACKAGES `` builds the specified packages and
272
+ ``cabal install [FLAGS] PACKAGES `` builds the specified packages and
273
273
symlinks/copies their executables in ``installdir `` (usually ``~/.cabal/bin ``).
274
274
275
275
For example this command will build the latest ``cabal-install `` and symlink
276
276
its ``cabal `` executable:
277
277
278
278
::
279
279
280
- $ cabal v2- install cabal-install
280
+ $ cabal install cabal-install
281
281
282
- In addition, it's possible to use ``cabal v2- install `` to install components
282
+ In addition, it's possible to use ``cabal install `` to install components
283
283
of a local project. For example, with an up-to-date Git clone of the Cabal
284
284
repository, this command will build cabal-install HEAD and symlink the
285
285
``cabal `` executable:
286
286
287
287
::
288
288
289
- $ cabal v2- install exe:cabal
289
+ $ cabal install exe:cabal
290
290
291
291
Where symlinking is not possible (eg. on some Windows versions) the ``copy ``
292
292
method is used by default. You can specify the install method
293
293
by using ``--install-method `` flag:
294
294
295
295
::
296
296
297
- $ cabal v2- install exe:cabal --install-method=copy --installdir=$HOME/bin
297
+ $ cabal install exe:cabal --install-method=copy --installdir=$HOME/bin
298
298
299
299
Note that copied executables are not self-contained, since they might use
300
300
data-files from the store.
@@ -304,67 +304,67 @@ example, this command will build the latest Cabal library and install it:
304
304
305
305
::
306
306
307
- $ cabal v2- install --lib Cabal
307
+ $ cabal install --lib Cabal
308
308
309
309
This works by managing GHC environments. By default, it is writing to the
310
310
global environment in ``~/.ghc/$ARCH-$OS-$GHCVER/environments/default ``.
311
- ``v2- install `` provides the ``--package-env `` flag to control which of
311
+ ``install `` provides the ``--package-env `` flag to control which of
312
312
these environments is modified.
313
313
314
314
This command will modify the environment file in the current directory:
315
315
316
316
::
317
317
318
- $ cabal v2- install --lib Cabal --package-env .
318
+ $ cabal install --lib Cabal --package-env .
319
319
320
320
This command will modify the environment file in the ``~/foo `` directory:
321
321
322
322
::
323
323
324
- $ cabal v2- install --lib Cabal --package-env foo/
324
+ $ cabal install --lib Cabal --package-env foo/
325
325
326
- Do note that the results of the previous two commands will be overwritten by
327
- the use of other v2-style commands, so it is not recommended to use them inside
328
- a project directory.
326
+ Do note that the results of the previous two commands will be overwritten by the
327
+ use of other commands, so it is not recommended to use them inside a project
328
+ directory.
329
329
330
330
This command will modify the environment in the "local.env" file in the
331
331
current directory:
332
332
333
333
::
334
334
335
- $ cabal v2- install --lib Cabal --package-env local.env
335
+ $ cabal install --lib Cabal --package-env local.env
336
336
337
337
This command will modify the ``myenv `` named global environment:
338
338
339
339
::
340
340
341
- $ cabal v2- install --lib Cabal --package-env myenv
341
+ $ cabal install --lib Cabal --package-env myenv
342
342
343
343
If you wish to create a named environment file in the current directory where
344
344
the name does not contain an extension, you must reference it as ``./myenv ``.
345
345
346
346
You can learn more about how to use these environments in `this section of the
347
347
GHC manual <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-environments> `_.
348
348
349
- cabal v2- clean
349
+ cabal clean
350
350
---------------
351
351
352
- ``cabal v2- clean [FLAGS] `` cleans up the temporary files and build artifacts
352
+ ``cabal clean [FLAGS] `` cleans up the temporary files and build artifacts
353
353
stored in the ``dist-newstyle `` folder.
354
354
355
355
By default, it removes the entire folder, but it can also spare the configuration
356
356
and caches if the ``--save-config `` option is given, in which case it only removes
357
357
the build artefacts (``.hi ``, ``.o `` along with any other temporary files generated
358
358
by the compiler, along with the build output).
359
359
360
- cabal v2- sdist
360
+ cabal sdist
361
361
---------------
362
362
363
- ``cabal v2- sdist [FLAGS] [TARGETS] `` takes the crucial files needed to build ``TARGETS ``
363
+ ``cabal sdist [FLAGS] [TARGETS] `` takes the crucial files needed to build ``TARGETS ``
364
364
and puts them into an archive format ready for upload to Hackage. These archives are stable
365
365
and two archives of the same format built from the same source will hash to the same value.
366
366
367
- ``cabal v2- sdist `` takes the following flags:
367
+ ``cabal sdist `` takes the following flags:
368
368
369
369
- ``-l ``, ``--list-only ``: Rather than creating an archive, lists files that would be included.
370
370
Output is to ``stdout `` by default. The file paths are relative to the project's root
@@ -377,10 +377,10 @@ and two archives of the same format built from the same source will hash to the
377
377
- ``--null-sep ``: Only used with ``--list-only ``. Separates filenames with a NUL
378
378
byte instead of newlines.
379
379
380
- ``v2- sdist `` is inherently incompatible with sdist hooks (which were removed in `Cabal-3.0 `),
380
+ ``sdist `` is inherently incompatible with sdist hooks (which were removed in `Cabal-3.0 `),
381
381
not due to implementation but due to fundamental core invariants
382
382
(same source code should result in the same tarball, byte for byte)
383
- that must be satisfied for it to function correctly in the larger v2- build ecosystem.
383
+ that must be satisfied for it to function correctly in the larger build ecosystem.
384
384
``autogen-modules `` is able to replace uses of the hooks to add generated modules, along with
385
385
the custom publishing of Haddock documentation to Hackage.
386
386
0 commit comments