darcs patch: Trac #221 part 1 (and 1 more)

Pepe Iborra "mnislaih#" at gmial.oail.com
Sun Mar 16 11:57:28 EDT 2008


Sun Mar  2 13:50:20 CET 2008  Pepe Iborra <mnislaih#@gmial.oail.com>
  * Trac #221 part 1
    
    This patch adds two missing cl flags to configure, --extra-include-dirs and extra-lib-dirs.
    These have effect over all the buildables in a project.
    
    The next step is to close #223  so that all the configure
     cl flags can be stored in the .cabal/config file. With this patch, that should close #221 too.
  

Sat Mar 15 20:12:52 CET 2008  Pepe Iborra <mnislaih#@gmial.oail.com>
  * Refactoring Distribution.Command.Simple.Option (see Ticket #223)
  so that it really represents an option and not just a flag.
  
    data Option a = Option {
      optionName        :: Name,
      optionDescr       :: [OptDescr a] }
  
    data OptDescr a  = ReqArg Description OptFlags ArgDescr (ReadE (a->a))         (a -> [String])
                     | OptArg Description OptFlags ArgDescr (ReadE (a->a)) (a->a)  (a -> [Maybe String])
                     | Choice [(Description, OptFlags, a->a, a -> Bool)]
  
  Now an option can expand to several flags, which are all defined together.
  For example, the compiler flag is defined as follows.
  
        option [] ["compiler"] "compiler"
           configHcFlavor (\v flags -> flags { configHcFlavor = v })
           (choiceOpt [ (Flag GHC, ("g", ["ghc"]), "compile with GHC")
                      , (Flag NHC, ([] , ["nhc98"]), "compile with NHC")
                      , (Flag JHC, ([] , ["jhc"]), "compile with JHC")
                      , (Flag Hugs,([] , ["hugs"]), "compile with Hugs")])
  
  We can need to use several kinds of OptDescr for the same option, as in the 
  optimization Option (really a extreme case):
  
        ,multiOption "optimization"
           configOptimization (\v flags -> flags { configOptimization = v })
           [optArg' "n" (Flag . flagToOptimisationLevel)
            ....
            ....
                    "Build with optimization (n is 0--2, default is 1)",
            noArg (Flag NoOptimisation) []
                  ("disable-optimization": case showOrParseArgs of
                        -- Allow British English spelling:
                        ShowArgs -> []; ParseArgs -> ["disable-optimisation"])
                  "Build without optimization"
           ]
  
  The benefit is that we can now derive a FieldDescr from an Option,
  
    viewAsFieldDescr :: Option a -> FieldDescr a
  
  and this allows for easy human readable serialization of Options to a config file,
  as it is needed for cabal-install.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 112598 bytes
Desc: A darcs patch for your repository!
Url : http://www.haskell.org/pipermail/cabal-devel/attachments/20080316/fcb3d375/attachment-0001.bin


More information about the cabal-devel mailing list