[Haskell-cafe] Cabal question

Rogan Creswick creswick at gmail.com
Mon Jul 21 14:49:25 UTC 2014


On Sun, Jul 20, 2014 at 11:33 PM, Jurriaan Hage <J.Hage at uu.nl> wrote:

> Hello Rogan,
>
> Thanks for the info.
> I was aware of this facility, and my mail was written in the hope that I
> could avoid it.
>

Ah, I misunderstood your email (I thought you were just trying to avoid
'Make'). I don't know of any other "clean" way to do what you're looking
for, but it shouldn't be too difficult to do with build-type: Custom.

When you talk of the problem of dependencies below, I suppose (and hope)
> you do NOT mean
> that the package I want to compile can only depend on the listed packages,
> just the Setup.hs code itself. Or am I naive here?
>

You are correct.  The package dependencies behave as normal, only the code
in Setup.hs is limited by the dependencies issue.

--Rogan



>
> best,
> Jur
>
> On 19Jul, 2014, at 17:49, Rogan Creswick <creswick at gmail.com> wrote:
>
> > On Sat, Jul 19, 2014 at 4:33 AM, Jurriaan Hage <J.Hage at uu.nl> wrote:
> > What I still need is a way to run some kind of postprocessing (like
> running
> > a Makefile) after installation (as it happens this is for compiling the
> > libraries that come with Helium).
> >
> > You can do this with a custom cabal build type, a non-trivial Setup.hs.
>  Cabal exposes a bunch of 'user hooks' that let you specify functions to be
> run at various stages of the compilation (such as pre-build, post-install,
> etc...).
> >
> > See the API here for the hooks available:
> >   -
> http://www.haskell.org/ghc/docs/7.6.3/html/libraries/Cabal/Distribution-Simple-UserHooks.html
> >
> > I use prebuild hooks quite a lot to pre-process GF files (for the
> grammatical framework); one relatively simple example is shown in my gfI8N
> package: https://github.com/creswick/gfI8N
> >
> > Note that the cabal file uses `build-type: Custom` (which causes cabal
> to actually use the Setup.hs).
> >
> > The relevant part of the Setup.hs is:
> >
> > import Distribution.Simple
> > import Distribution.Simple.Program.Types
> > import Distribution.Simple.Setup
> > import Distribution.Simple.UserHooks
> > import Distribution.Simple.Utils ( rawSystemExit, warn, debug
> >                                  , findProgramVersion, notice )
> > import Distribution.Verbosity ( Verbosity )
> >
> > main = do
> >   defaultMainWithHooks simpleUserHooks
> >        { preBuild = \a b -> generatePGF a b >> preBuild simpleUserHooks
> a b
> >        , preClean = \a b -> preClean simpleUserHooks a b
> >        }
> >
> > That should be enough to get you going -- now some cautions, and a minor
> rant ;)
> >
> > Working with these hooks has lead me to /really/ want a way to express
> dependencies for Setup.hs files.  You *can not* use any hackage libraries
> in the definitions of these hooks and retain a portable build, because
> there is no way to indicate that the Setup.hs depends on such things. It
> used to be the case that you could assume that the dependencies of your
> library / executable would be visible, but with sandboxed builds that
> assumption is no longer valid. There's a cabal ticket for this feature
> here: https://github.com/haskell/cabal/issues/948
> >
> > You should be able to rely on these packages (which shipped with ghc --
> the versions will depend on the ghc version installed):
> >    Cabal-1.16.0
> >    array-0.4.0.1
> >    base-4.6.0.1
> >    bin-package-db-0.0.0.0
> >    binary-0.5.1.1
> >    bytestring-0.10.0.2
> >    containers-0.5.0.0
> >    deepseq-1.3.0.1
> >    directory-1.2.0.1
> >    filepath-1.3.0.1
> >    ghc-7.6.3
> >    ghc-prim-0.3.0.0
> >    haskell2010-1.1.1.0
> >    haskell98-2.0.0.2
> >    hoopl-3.9.0.0
> >    hpc-0.6.0.0
> >    integer-gmp-0.5.0.0
> >    old-locale-1.0.0.5
> >    old-time-1.1.0.1
> >    pretty-1.1.1.0
> >    process-1.1.0.2
> >    rts-1.0
> >    template-haskell-2.8.0.0
> >    time-1.4.0.1
> >
> > --Rogan
> >
> > Does anyone know here whether that is supported
> > and how, without having to resort to build-types like Make that for I
> actually
> > want to avoid?
> >
> > best,
> > Jur
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140721/0b931867/attachment.html>


More information about the Haskell-Cafe mailing list