New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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 meta: easy label Apr 25, 2015

@ttuegel

This comment has been minimized.

Show comment
Hide comment
@ttuegel

ttuegel May 14, 2015

Member

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).

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

This comment has been minimized.

Show comment
Hide comment
@mietek

mietek May 15, 2015

Contributor

👍

Contributor

mietek commented May 15, 2015

👍

@ttuegel

This comment has been minimized.

Show comment
Hide comment
@ttuegel

ttuegel May 15, 2015

Member

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.

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 added a commit to ttuegel/cabal that referenced this issue May 16, 2015

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
@psibi

This comment has been minimized.

Show comment
Hide comment
@psibi

psibi 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

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 added a commit to ttuegel/cabal that referenced this issue May 24, 2015

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
@ttuegel

This comment has been minimized.

Show comment
Hide comment
@ttuegel

ttuegel May 24, 2015

Member

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.

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 added a commit to ttuegel/cabal that referenced this issue May 25, 2015

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

ttuegel added a commit to ttuegel/cabal that referenced this issue Jun 21, 2015

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

ttuegel added a commit to ttuegel/cabal that referenced this issue Jun 27, 2015

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

@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