Version 12 (modified by nominolo@…, 6 years ago)

typos

Cabal Configurations Progress

On this page I (Thomas Schilling) will document some of the design decisions and my progress on implementing Cabal configurations. If you have any questions ping me on #haskell or send a mail to me or, better, the cabal-devel mailing list. My nickname is "nominolo", my email is <my_nickname> at gmail.com.

I am working mostly based on the  latest proposal.

.cabal Syntax

Since configs require incompatible changes to the module syntax we now require [or not. There might be a simple way to keep backwards compatibility.]

Cabal-version: >= 1.1.7

[The following should probably be discussed]

Additionally, packages now require a block-structured syntax, e.g.,

Cabal-version:  >= 1.1.7
Name:           TestPackage
Version:        0.0
License:        BSD3
Author:         Angela Author
Synopsis:       Small package with two programs

-- flag names are case insensitive
Flag fps_in_base {
  description: Use a base library that contains fps
}

Flag debug {
  description: Show debugging information
  default: false
}

Library {
  if flag(fps_in_base) {
    build-depends: base >= 2
  } else {
    build-depends: base < 2, fps >= 0.8
  }

  if flag(debug) && os(windows) {
    cpp-options: -DDEBUG_WINDOWS_STUFF
  }
}

Executable: program1 {
  Main-Is:        Main.hs
  Hs-Source-Dirs: prog1
}

Executable: program2 {
  Main-Is:        Main.hs
  Hs-Source-Dirs: prog2
  Other-Modules:  Utils
}

Progress Log

2007-06-14:

Refactorings, also some pretty printing. Interface seems okay now; parseDescription now returns a PreparedPackageDescription? which, given some environmental parameters, can be resolved to an old PackageDescription? (or not, if the dependencies could not be resolved). We probably want a hook for this.

Compatibility mode working.

2007-06-12:

Prototypical implementation up and running. Next step is integrating it with the standart build process. Not sure what the best interface should be.

2007-05-30:

Started modifying the higher levels of the parsing code to incorporate support for conditions. Lot's of cleaning up required. This is when you learn the merits of XML.

2007-05-29:

Not much hacking today; had exam. Parsing and simplifying conditions works.

2007-05-28:

Low-level parsing works. We now have three syntactic categories:

  • Normal properties: fieldname: value
  • If-blocks: 'if' condition '{' ... '}' ['else' '{' ... '}']
  • Sections: sectionname sectionlabel '{' ... '}' where sectionname can currently be only library or executable. Whether or not a label is required is checked at a higher level.

This scheme is backwards compatible. I plan to add a warning when blocks are used but no Cabal-version: > 1.1.7 or equivalent is present.