@@ -173,8 +173,8 @@ A major deficiency in the current implementation of new-build is that
173
173
there is no programmatic way to access the location of build products.
174
174
The location of the build products is intended to be an internal
175
175
implementation detail of new-build, but we also understand that many
176
- unimplemented features (e.g., `` new-install ``) can only be reasonably
177
- worked around by accessing build products directly.
176
+ unimplemented features can only be reasonably worked around by
177
+ accessing build products directly.
178
178
179
179
The location where build products can be found varies depending on the
180
180
version of cabal-install:
@@ -461,9 +461,8 @@ invocations and bringing the project's executables into scope.
461
461
cabal new-install
462
462
-----------------
463
463
464
- ``cabal new-install [FLAGS] PACKAGES `` builds the specified packages, adds their
465
- libraries into the default environment and symlinks their executables in
466
- ``symlink-bindir `` (usually ``~/.cabal/bin ``).
464
+ ``cabal new-install [FLAGS] PACKAGES `` builds the specified packages and
465
+ symlinks their executables in ``symlink-bindir `` (usually ``~/.cabal/bin ``).
467
466
468
467
For example this command will build the latest ``cabal-install `` and symlink
469
468
its ``cabal `` executable:
@@ -472,8 +471,61 @@ its ``cabal`` executable:
472
471
473
472
$ cabal new-install cabal-install
474
473
475
- For libraries and local packages see
476
- `Unsupported commands <#unsupported-commands >`__
474
+ In addition, it's possible to use ``cabal new-install `` to install components
475
+ of a local project. For example, with an up-to-date Git clone of the Cabal
476
+ repository, this command will build cabal-install HEAD and symlink the
477
+ ``cabal `` executable:
478
+
479
+ ::
480
+
481
+ $ cabal new-install exe:cabal
482
+
483
+ It is also possible to "install" libraries using the ``--lib `` flag. For
484
+ example, this command will build the latest Cabal library and install it:
485
+
486
+ ::
487
+
488
+ $ cabal new-install --lib Cabal
489
+
490
+ This works by managing GHC environments. By default, it is writing to the
491
+ global environment in ``~/.ghc/$ARCH-$OS-$GHCVER/environments/default ``.
492
+ ``new-install `` provides the ``--package-env `` flag to control which of
493
+ these environments is modified.
494
+
495
+ This command will modify the environment file in the current directory:
496
+
497
+ ::
498
+
499
+ $ cabal new-install --lib Cabal --package-env .
500
+
501
+ This command will modify the enviroment file in the ``~/foo `` directory:
502
+
503
+ ::
504
+
505
+ $ cabal new-install --lib Cabal --package-env foo/
506
+
507
+ Do note that the results of the previous two commands will be overwritten by
508
+ the use of other new-style commands, so it is not reccomended to use them inside
509
+ a project directory.
510
+
511
+ This command will modify the environment in the "local.env" file in the
512
+ current directory:
513
+
514
+ ::
515
+
516
+ $ cabal new-install --lib Cabal --package-env local.env
517
+
518
+ This command will modify the ``myenv `` named global environment:
519
+
520
+ ::
521
+
522
+ $ cabal new-install --lib Cabal --package-env myenv
523
+
524
+ If you wish to create a named environment file in the current directory where
525
+ the name does not contain an extension, you must reference it as ``./myenv ``.
526
+
527
+ You can learn more about how to use these environments in `this section of the
528
+ GHC manual <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-environments> `_.
477
529
478
530
cabal new-clean
479
531
---------------
0 commit comments