Should be possible to define builddir in `cabal.config` #2484

Closed
edsko opened this Issue Mar 20, 2015 · 5 comments

Projects

None yet

5 participants

@edsko
Contributor
edsko commented Mar 20, 2015

Currently the only way we can pass builddir is through a command line option. Since I use different build directories for dfiferent versions of GHC, it would be very convenient if I could specify

builddir: <something>

in my project-local cabal.config file, and then specify a different cabal.config file using the CABAL_CONFIG environment variable (cabal.config-7.8.4, say). Currently specifying builddir in config file is explicit disallowed (configFieldDescriptions in Config.hs); I tried removing this and that stopped cabal from complaining about an unrecognized builddir option, but it still didn't take it into account either. I don't know cabal's command line/config option system well enough to fix this.

@ttuegel ttuegel added this to the cabal-install-1.24 milestone Apr 25, 2015
@ttuegel ttuegel added the easy label Apr 25, 2015
@ttuegel
Member
ttuegel commented May 14, 2015

Another use case: I would like to put

builddir: /tmp/cabal-dist-$pkgid

into my $HOME/.cabal/config to keep in-tree builds off my SSD. Why? All my in-tree builds are for development purposes; I'm never actually interested in keeping the build artifacts across rebuilds. I have tmpfs mounted at /tmp, and it's faster to keep such things in RAM (less wear on my drive, too).

@mietek
Contributor
mietek commented May 15, 2015

👍

@ttuegel
Member
ttuegel commented May 15, 2015

Actually, it's impossible to implement my request because doing the PathTemplate substitution requires having the LocalBuildInfo available, but it won't be available until the builddir is known.

@ttuegel ttuegel pushed a commit to ttuegel/cabal that referenced this issue May 16, 2015
Thomas Tuegel Get 'builddir' from cabal.config or CABAL_BUILDDIR
Fixes #2484. The 'builddir' option may now be specified in cabal.config
as well. It will also be read from the CABAL_BUILDDIR environment
variable, if set. The order of precedence (highest to lowest) is:
1. --builddir command line option
2. CABAL_BUILDDIR environment variable
3. cabal.config setting
1bff553
@psibi
psibi commented May 24, 2015

@edsko I have a working version for this requirement. It reads the builddir attribute from project's cabal file and then builds them in that directory. These are the files which are under the directory as mentioned in builddir attribute:

$ ls
setup  setup-config

Note that it doesn't have the directory named dist which I guess is produced during cabal configure step. If you can confirm that this is the use-case you were looking for, I can submit a pull request.

CC: @23Skidoo @ttuegel

@ttuegel ttuegel pushed a commit to ttuegel/cabal that referenced this issue May 24, 2015
Thomas Tuegel Get 'builddir' from cabal.config or CABAL_BUILDDIR
Fixes #2484. The 'builddir' option may now be specified in cabal.config
as well. It will also be read from the CABAL_BUILDDIR environment
variable, if set. The order of precedence (highest to lowest) is:
1. --builddir command line option
2. CABAL_BUILDDIR environment variable
3. cabal.config setting
fce6c6b
@ttuegel
Member
ttuegel commented May 24, 2015

I just opened #2608 with the patch I've been using for this. It reads builddir either from the cabal.config or from the CABAL_BUILDDIR environment variable. (Or from the command-line, of course.) If that's not sufficient for anyone's needs, let me know.

@ttuegel ttuegel pushed a commit to ttuegel/cabal that referenced this issue May 25, 2015
Thomas Tuegel Get 'builddir' from cabal.config or CABAL_BUILDDIR
Fixes #2484. The 'builddir' option may now be specified in cabal.config
as well. It will also be read from the CABAL_BUILDDIR environment
variable, if set. The order of precedence (highest to lowest) is:
1. --builddir command line option
2. CABAL_BUILDDIR environment variable
3. cabal.config setting
2fd2a71
@ttuegel ttuegel pushed a commit to ttuegel/cabal that referenced this issue Jun 21, 2015
Thomas Tuegel Get 'builddir' from cabal.config or CABAL_BUILDDIR
Fixes #2484. The 'builddir' option may now be specified in cabal.config
as well. It will also be read from the CABAL_BUILDDIR environment
variable, if set. The order of precedence (highest to lowest) is:
1. --builddir command line option
2. CABAL_BUILDDIR environment variable
3. cabal.config setting
ac5e0d2
@ttuegel ttuegel pushed a commit to ttuegel/cabal that referenced this issue Jun 27, 2015
Thomas Tuegel Get 'builddir' from cabal.config or CABAL_BUILDDIR
Fixes #2484. The 'builddir' option may now be specified in cabal.config
as well. It will also be read from the CABAL_BUILDDIR environment
variable, if set. The order of precedence (highest to lowest) is:
1. --builddir command line option
2. CABAL_BUILDDIR environment variable
3. cabal.config setting
2b3282f
@ttuegel ttuegel closed this in #2608 Jun 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment