Skip to content

Add program prefix and suffix to BuildOptions#11787

Open
sheaf wants to merge 1 commit intohaskell:masterfrom
sheaf:hooks-prefix
Open

Add program prefix and suffix to BuildOptions#11787
sheaf wants to merge 1 commit intohaskell:masterfrom
sheaf:hooks-prefix

Conversation

@sheaf
Copy link
Copy Markdown
Collaborator

@sheaf sheaf commented May 5, 2026

This commits adds two new fields of BuildOptions, namely programPrefix and programSuffix. This allows the installed executable program prefix and suffix to be set by SetupHooks for packages with build-type: Hooks.


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • Manual QA notes have been included.
  • Tests have been added. (Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!)

This commits adds two new fields of `BuildOptions`, namely `programPrefix`
and `programSuffix`. This allows the installed executable program prefix
and suffix to be set by `SetupHooks` for packages with `build-type: Hooks`.

Fixes haskell#11168
@sheaf sheaf marked this pull request as ready for review May 5, 2026 11:40
@ulysses4ever
Copy link
Copy Markdown
Collaborator

Should cabal-install be updated to use these fields to handle affixes (prefixes and suffixes)? It handles them today on the higher level, but now, if we can do it on the library level, we add redundancy?

@sheaf
Copy link
Copy Markdown
Collaborator Author

sheaf commented May 6, 2026

Should cabal-install be updated to use these fields to handle affixes (prefixes and suffixes)? It handles them today on the higher level, but now, if we can do it on the library level, we add redundancy?

Which part of the cabal-install codebase are you referring to specifically?

All I could find was this, in Distribution.Client.CmdInstall:

ignoreProgramAffixes :: ConfigFlags -> ConfigFlags
ignoreProgramAffixes configFlags =
  configFlags
    { configProgPrefix = NoFlag
    , configProgSuffix = NoFlag
    }

@ulysses4ever
Copy link
Copy Markdown
Collaborator

I'm talking about these configProgPrefix/configProgSuffix. Are setup hooks not able to leverage those? Or vise versa?

@sheaf
Copy link
Copy Markdown
Collaborator Author

sheaf commented May 6, 2026

I'm talking about these configProgPrefix/configProgSuffix. Are setup hooks not able to leverage those? Or vise versa?

SetupHooks don't use ConfigFlags; ConfigFlags is part of the command-line interface for ./Setup.

@ulysses4ever
Copy link
Copy Markdown
Collaborator

@sheaf my bad. I dived a little deeper to try to substantiate my hunch, and here is the place that bothers me:

progPrefix, progSuffix :: LocalBuildInfo -> PathTemplate
progPrefix (LocalBuildInfo{configFlags = cfg}) =
fromFlag $ configProgPrefix cfg
progSuffix (LocalBuildInfo{configFlags = cfg}) =
fromFlag $ configProgSuffix cfg

Shouldn't these read from the new build options instead? Something like:

progPrefix, progSuffix :: LocalBuildInfo -> PathTemplate
progPrefix lbi@(LocalBuildInfo{configFlags = cfg}) =
  fromMaybe
    (fromFlag $ configProgPrefix cfg)
    (programPrefix lbi)
progSuffix lbi@(LocalBuildInfo{configFlags = cfg}) =
  fromMaybe
    (fromFlag $ configProgSuffix cfg)
    (programSuffix lbi)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants