Skip to content

Help text wrongly states that the default --builddir is dist #7924

Open

Description

@andreasabel

Help text for cabal install still claims that the default --builddir is dist (rather than dist-newstyle).

$ cabal install --help | grep -B1 dist
 --builddir=DIR                 The directory where Cabal puts generated build
                                files (default dist)

Activity

  1. added
    re: help-text
    on Jan 22, 2022
  2. phadej commented on Jan 22, 2022

    @phadej
    Collaborator

    This is indeed embarrassing. If you grep the code, you will notice that the help message comes from Cabal, not cabal-install:

    optionDistPref :: (flags -> Flag FilePath)
    -> (Flag FilePath -> flags -> flags)
    -> ShowOrParseArgs
    -> OptionField flags
    optionDistPref get set = \showOrParseArgs ->
    option "" (distPrefFlagName showOrParseArgs)
    ( "The directory where Cabal puts generated build files "
    ++ "(default " ++ defaultDistPref ++ ")")
    get set
    (reqArgFlag "DIR")
    where
    distPrefFlagName ShowArgs = ["builddir"]
    distPrefFlagName ParseArgs = ["builddir", "distdir", "distpref"]
    (defaultDistPref is defined in the same file).

    I think that the underlying reason is the same as why there is

    % cabal build --help|grep libdir 
     --libdir=DIR                   installation directory for libraries
     --libsubdir=DIR                subdirectory of libdir in which libs are
     --dynlibdir=DIR                installation directory for dynamic libraries
    

    etc parameters in cabal v2-build which shouldn't be there, as they don't have any effect. However Cabal's builddir is repurposed to do reasonable thing for cabal-install. It's somewhat hard to trace where from exactly builddir configuration param is

    TL;DR, this is IMO a symptom of v2 commands not having sane, independent cli-argument implementation. There are plenty of such small annoyances. I guess the symptoms could be fixed one-by-one: in this case parameterize optionDistPref by default location and use dist-newstyle in cabal-install); however fixing the underlying cause needs a very determined person.

  3. phadej commented on Jan 22, 2022

    @phadej
    Collaborator

    This is not oneline change, multiple files, in separate packages have to be changed. (This shouldn't be that hard, but that is a consequence of a hard underlying problem I mention: there is a sizable technical debt).

  4. mpickering commented on Sep 4, 2023

    @mpickering
    Collaborator

    @phadej is correct about how to fix this issue, the change in #8833 seems the wrong way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions