Skip to content

RFC: post-2.4 redesign of v2 --bindir UI #5843

Closed

Description

@hvr

This is a bit of a follow-up to #5837 (which is intended to provide an incremental pain remedy for 2.4.x) which is expected to result in the following situation for v2-install:

We have two bindir "install" paths settings,

  • --symlink-bindir=DIR (used when --bindir-method=symlink)
  • --bindir=DIR (used when --bindir-method=copy)

This is mostly for historical reasons as cabal has had these two configuration properties for about a decade.

However, it doesn't seem to make much sense in the nix-style paradigm to have two separate folders; instead I suggest to redesign this for cabal 3.0 to

  1. deprecate --symlink-bindir=DIR
  2. Use a single --bindir=DIR configuration field
  3. Use --bindir-method={copy,symlink,auto} to control how executables are "installed" into the folder denoted by --bindir

This would IMO be a less confusing UI as you need to be careful which bindir field you set; there's now only one!


So e.g. if you're preparing some binary dist for an executable (for which you know it is relocatable as it doesn't have any ties to the nix-style store), you can just say

cabal install --bindir=./bindist/bin --bindir-method=copy  mypackage

and if you instead want to prepare some local bin-folder with symlinks to some build tools, you can instead say

cabal install --bindir=${HOME}/buildtools-bin --bindir-method=symlink alex happy

and if you use the auto method (i.e. try to use symlinks and fallback to copy if not possible), now you can say

cabal install --bindir=${HOME}/buildtools-bin --bindir-method=auto alex happy

With the UI as implemented for #5837 for cabal 2.4 however, you'd have to use the following incantations respectively:

cabal v2-install --bindir=./bindist/bin --bindir-method=copy  mypackage

cabal v2-install --symlink-bindir=${HOME}/buildtools-bin --bindir-method=symlink alex happy

# NB: we need to set both bindir locations!
cabal v2-install --bindir=${HOME}/buildtools-bin --symlink-bindir=${HOME}/buildtools-bin --bindir-method=auto alex happy

Activity

  1. added this to the 3.0 milestone on Jan 13, 2019
  2. bgamari commented on Jan 16, 2019

    @bgamari
    Contributor

    Sounds right to me.

  3. fgaz commented on Jan 16, 2019

    @fgaz
    Member

    +1.

    This requires:

    • a bindir in NewInstallFlags, the proper place to put it
    • NewInstallFlags in SavedConfig, so bindir remains configurable in ~/.cabal/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions