[Hackage] #223: allow per-package configuration options in config file

Hackage trac at galois.com
Fri Aug 22 08:24:44 EDT 2008


#223: allow per-package configuration options in config file
---------------------------------+------------------------------------------
  Reporter:  duncan              |        Owner:  mnislaih           
      Type:  enhancement         |       Status:  assigned           
  Priority:  normal              |    Milestone:  Cabal-1.4          
 Component:  cabal-install tool  |      Version:  1.2.3.0            
  Severity:  normal              |   Resolution:                     
  Keywords:                      |   Difficulty:  very easy (<1 hour)
Ghcversion:  6.8.2               |     Platform:                     
---------------------------------+------------------------------------------
Changes (by duncan):

  * difficulty:  normal => very easy (<1 hour)

Comment:

 The config file now holds the options for the global command (things like
 repos, cache dir etc), the install/upgrade command and the configure and
 upload commands.

 {{{
 Thu Aug 21 22:05:55 BST 2008  Duncan Coutts <duncan at haskell.org>
   * Rearrange config settings and global command line settings
   The intention here is to have the config file content and parser
   be derivied from the command line types and flags. Now instead
   of having a saved config type that contains additional
   information to that kept in command line parameters we now put
   all the information in the command line settings type and make
   the saved config just the aggregation of the settings for
   various key commands like configure, install, upload. There's
   also an extended GlobalFlags type with the things like repos,
   cache dir etc. When we generate the initial config file we put
   in commented out versions of all (non-deprecated) valid fields,
   along with their default values. The aim is to make the config
   file self-documenting.

 }}}

 As before it also has two sets of saved install dirs.

 {{{
 Fri Aug 22 02:57:02 BST 2008  Duncan Coutts <duncan at haskell.org>
   * Add back separate user and global sets of install dirs
   The user install setting selects between the two sets of dirs.
   At the moment it's just the "user-" and "global-" prefixed field
   names to support existing config files.

 Fri Aug 22 13:00:59 BST 2008  Duncan Coutts <duncan at haskell.org>
   * Add sections for user/global install-dirs to the config file
   So it looks like:
   install-dirs user
     prefix: /home/username/.cabal
     ...
   Rather than using user-prefix, global-prefix, etc etc for each
   field. The old field names are still recognised but not added
   into the initial config file.
 }}}


 The default config file now looks like:

 {{{
 -- version:
 -- numeric-version:
 -- config-file:
 remote-repo:
 hackage.haskell.org:http://hackage.haskell.org/packages/archive
 remote-repo-cache: /home/username/.cabal/packages
 -- local-repo:
 -- documentation: False
 -- dry-run:
 -- reinstall:
 -- root-cmd:
 -- cabal-lib-version:
 -- log-builds:
 -- build-reports:
 -- only:
 -- verbose: 1
 -- distpref: dist
 -- compiler: ghc
 -- with-compiler:
 -- with-hc-pkg:
 -- scratchdir:
 -- program-prefix:
 -- program-suffix:
 -- library-vanilla: True
 -- library-profiling: False
 -- shared: False
 -- executable-profiling: False
 -- optimization: True
 -- library-for-ghci: True
 -- split-objs: False
 -- executable-stripping: True
 -- configure-option:
 user-install: True
 -- package-db:
 -- flags:
 -- extra-include-dirs:
 -- extra-lib-dirs:
 -- constraint:
 -- verbose: 1
 -- check:
 -- username:
 -- password:

 install-dirs user
   prefix: /home/username/.cabal
   -- bindir: $prefix/bin
   -- libdir: $prefix/lib
   -- libsubdir: $pkgid/$compiler
   -- libexecdir: $prefix/libexec
   -- datadir: $prefix/share
   -- datasubdir: $pkgid
   -- docdir: $datadir/doc/$pkgid
   -- htmldir: $docdir/html
   -- haddockdir: $htmldir

 install-dirs global
   -- prefix: /usr/local
   -- bindir: $prefix/bin
   -- libdir: $prefix/lib
   -- libsubdir: $pkgid/$compiler
   -- libexecdir: $prefix/libexec
   -- datadir: $prefix/share
   -- datasubdir: $pkgid
   -- docdir: $datadir/doc/$pkgid
   -- htmldir: $docdir/html
   -- haddockdir: $htmldir
 }}}

 There are some fields there that come from command line flags that do not
 really apply to the config file and so should be filtered out.

 This syntax will allow us to to per-package config options, like:

 {{{
 package foo
   extra-lib-dirs: /some/thing
 }}}

 But actually adding that feature is not the top priority. Having a more
 self-documenting config file that contains all the options that can be
 specified on the command line is top priority.

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/223#comment:7>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects


More information about the cabal-devel mailing list