@@ -64,12 +64,6 @@ Various environment variables affect ``cabal-install``.
64
64
Note, the nix-style builds build directory (``dist-newstyle ``)
65
65
is not affected by this environment variable.
66
66
67
- ``CABAL_SANDBOX_PACKAGE_PATH ``
68
- Variable related to deprecated sandbox functionality.
69
-
70
- ``CABAL_SANDBOX_CONFIG ``
71
- Variable related to deprecated sandbox functionality.
72
-
73
67
Configuration file discovery
74
68
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75
69
@@ -309,171 +303,6 @@ dependencies in a single step. To do this, run:
309
303
To browse the list of available packages, visit the
310
304
Hackage _ web site.
311
305
312
- Developing with sandboxes
313
- -------------------------
314
-
315
- .. warning ::
316
-
317
- This functionality is deprecated.
318
- Please migrate to use nix-style builds.
319
-
320
- By default, any dependencies of the package are installed into the
321
- global or user package databases (e.g. using
322
- ``cabal install --only-dependencies ``). If you're building several
323
- different packages that have incompatible dependencies, this can cause
324
- the build to fail. One way to avoid this problem is to build each
325
- package in an isolated environment ("sandbox"), with a sandbox-local
326
- package database. Because sandboxes are per-project, inconsistent
327
- dependencies can be simply disallowed.
328
-
329
- For more on sandboxes, see also `this
330
- article <http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html> `__.
331
-
332
- Sandboxes: basic usage
333
- ^^^^^^^^^^^^^^^^^^^^^^
334
-
335
- To initialise a fresh sandbox in the current directory, run
336
- ``cabal sandbox init ``. All subsequent commands (such as ``build `` and
337
- ``install ``) from this point will use the sandbox.
338
-
339
- ::
340
-
341
- $ cd /path/to/my/haskell/library
342
- $ cabal sandbox init # Initialise the sandbox
343
- $ cabal install --only-dependencies # Install dependencies into the sandbox
344
- $ cabal build # Build your package inside the sandbox
345
-
346
- It can be useful to make a source package available for installation in
347
- the sandbox - for example, if your package depends on a patched or an
348
- unreleased version of a library. This can be done with the
349
- ``cabal sandbox add-source `` command - think of it as "local Hackage _".
350
- If an add-source dependency is later modified, it is reinstalled automatically.
351
-
352
- ::
353
-
354
- $ cabal sandbox add-source /my/patched/library # Add a new add-source dependency
355
- $ cabal install --dependencies-only # Install it into the sandbox
356
- $ cabal build # Build the local package
357
- $ $EDITOR /my/patched/library/Source.hs # Modify the add-source dependency
358
- $ cabal build # Modified dependency is automatically reinstalled
359
-
360
- Normally, the sandbox settings (such as optimisation level) are
361
- inherited from the main Cabal config file (``$HOME/cabal/config ``).
362
- Sometimes, though, you need to change some settings specifically for a
363
- single sandbox. You can do this by creating a ``cabal.config `` file in
364
- the same directory with your ``cabal.sandbox.config `` (which was created
365
- by ``sandbox init ``). This file has the same syntax as the main Cabal
366
- config file.
367
-
368
- ::
369
-
370
- $ cat cabal.config
371
- documentation: True
372
- constraints: foo == 1.0, bar >= 2.0, baz
373
- $ cabal build # Uses settings from the cabal.config file
374
-
375
- When you have decided that you no longer want to build your package
376
- inside a sandbox, just delete it:
377
-
378
- ::
379
-
380
- $ cabal sandbox delete # Built-in command
381
- $ rm -rf .cabal-sandbox cabal.sandbox.config # Alternative manual method
382
-
383
- Sandboxes: advanced usage
384
- ^^^^^^^^^^^^^^^^^^^^^^^^^
385
-
386
- The default behaviour of the ``add-source `` command is to track
387
- modifications done to the added dependency and reinstall the sandbox
388
- copy of the package when needed. Sometimes this is not desirable: in
389
- these cases you can use ``add-source --snapshot ``, which disables the
390
- change tracking. In addition to ``add-source ``, there are also
391
- ``list-sources `` and ``delete-source `` commands.
392
-
393
- Sometimes one wants to share a single sandbox between multiple packages.
394
- This can be easily done with the ``--sandbox `` option:
395
-
396
- ::
397
-
398
- $ mkdir -p /path/to/shared-sandbox
399
- $ cd /path/to/shared-sandbox
400
- $ cabal sandbox init --sandbox .
401
- $ cd /path/to/package-a
402
- $ cabal sandbox init --sandbox /path/to/shared-sandbox
403
- $ cd /path/to/package-b
404
- $ cabal sandbox init --sandbox /path/to/shared-sandbox
405
-
406
- Note that ``cabal sandbox init --sandbox . `` puts all sandbox files into
407
- the current directory. By default, ``cabal sandbox init `` initialises a
408
- new sandbox in a newly-created subdirectory of the current working
409
- directory (``./.cabal-sandbox ``).
410
-
411
- Using multiple different compiler versions simultaneously is also
412
- supported, via the ``-w `` option:
413
-
414
- ::
415
-
416
- $ cabal sandbox init
417
- $ cabal install --only-dependencies -w /path/to/ghc-1 # Install dependencies for both compilers
418
- $ cabal install --only-dependencies -w /path/to/ghc-2
419
- $ cabal configure -w /path/to/ghc-1 # Build with the first compiler
420
- $ cabal build
421
- $ cabal configure -w /path/to/ghc-2 # Build with the second compiler
422
- $ cabal build
423
-
424
- It can be occasionally useful to run the compiler-specific package
425
- manager tool (e.g. ``ghc-pkg ``) on the sandbox package DB directly
426
- (for example, you may need to unregister some packages). The
427
- ``cabal sandbox hc-pkg `` command is a convenient wrapper that runs the
428
- compiler-specific package manager tool with the arguments:
429
-
430
- ::
431
-
432
- $ cabal -v sandbox hc-pkg list
433
- Using a sandbox located at /path/to/.cabal-sandbox
434
- 'ghc-pkg' '--global' '--no-user-package-conf'
435
- '--package-conf=/path/to/.cabal-sandbox/i386-linux-ghc-7.4.2-packages.conf.d'
436
- 'list'
437
- [...]
438
-
439
- The ``--require-sandbox `` option makes all sandbox-aware commands
440
- (``install ``/``build ``/etc.) exit with error if there is no sandbox
441
- present. This makes it harder to accidentally modify the user package
442
- database. The option can be also turned on via the per-user
443
- configuration file (``~/.cabal/config ``) or the per-project one
444
- (``$PROJECT_DIR/cabal.config ``). The error can be squelched with
445
- ``--no-require-sandbox ``.
446
-
447
- The option ``--sandbox-config-file `` allows to specify the location of
448
- the ``cabal.sandbox.config `` file (by default, ``cabal `` searches for it
449
- in the current directory). This provides the same functionality as
450
- shared sandboxes, but sometimes can be more convenient. Example:
451
-
452
- ::
453
-
454
- $ mkdir my/sandbox
455
- $ cd my/sandbox
456
- $ cabal sandbox init
457
- $ cd /path/to/my/project
458
- $ cabal --sandbox-config-file=/path/to/my/sandbox/cabal.sandbox.config install
459
- # Uses the sandbox located at /path/to/my/sandbox/.cabal-sandbox
460
- $ cd ~
461
- $ cabal --sandbox-config-file=/path/to/my/sandbox/cabal.sandbox.config install
462
- # Still uses the same sandbox
463
-
464
- The sandbox config file can be also specified via the
465
- ``CABAL_SANDBOX_CONFIG `` environment variable.
466
-
467
- Finally, the flag ``--ignore-sandbox `` lets you temporarily ignore an
468
- existing sandbox:
469
-
470
- ::
471
-
472
- $ mkdir my/sandbox
473
- $ cd my/sandbox
474
- $ cabal sandbox init
475
- $ cabal --ignore-sandbox install text
476
- # Installs 'text' in the user package database ('~/.cabal').
477
306
478
307
Creating a binary package
479
308
-------------------------
0 commit comments