[Hackage] #290: Cabal does some work behind the back of hooks

Hackage trac at galois.com
Sun Jun 8 07:06:56 EDT 2008


#290: Cabal does some work behind the back of hooks
----------------------------+-----------------------------------------------
  Reporter:  igloo          |        Owner:         
      Type:  defect         |       Status:  new    
  Priority:  normal         |    Milestone:         
 Component:  Cabal library  |      Version:  1.2.3.0
  Severity:  normal         |     Keywords:         
Difficulty:  normal         |   Ghcversion:  6.8.2  
  Platform:                 |  
----------------------------+-----------------------------------------------
 Cabal does some work behind the back of hooks, e.g. with `q.cabal`:
 {{{
 name: q
 version: 1
 exposed-modules: Bar
 build-type: Custom
 }}}
 and `Setup.hs`:
 {{{
 module Main (main) where

 import Distribution.Simple
 import Distribution.Simple.Setup
 import System.Cmd

 main :: IO ()
 main = defaultMainWithHooks myHooks

 myHooks :: UserHooks
 myHooks = simpleUserHooks {
               confHook = \x flags -> do
                          let flags' = flags { configDistPref = Flag "foo"
 }
                          lbi <- (confHook simpleUserHooks) x flags'
                          system "ls"
                          return lbi,
               postConf = \args flags pd lbi -> do
                          system "ls"
                          let flags' = flags { configDistPref = Flag "foo"
 }
                          (postConf simpleUserHooks) args flags' pd lbi
                          return ()
           }
 }}}
 a `dist` directory magically appears between the configure hook and the
 postconf hook:
 {{{
 $ ./Setup configure
 Configuring q-1...
 Setup  Setup.hi  Setup.hs  Setup.o  foo  q.cabal
 Setup  Setup.hi  Setup.hs  Setup.o  dist  foo  q.cabal
 $ ls -l dist
 -rw-r--r-- 1 ian ian 6411 Jun  8 12:02 setup-config
 }}}

 The reason I want to do this is so that `Setup.hs` can take care of
 building itself in multiple ways, using different dist directories.

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


More information about the cabal-devel mailing list