multiple cabal files in one directory?

Mario Blažević mblazevic at stilo.com
Mon Jan 10 18:46:10 CET 2011


On 11-01-07 10:41 PM, kahl at cas.mcmaster.ca wrote:
> On Sat, Jan 08, 2011 at 12:38:30AM +0100, Henning Thielemann wrote:
>>
>> On Fri, 7 Jan 2011, Kathleen Fisher wrote:
>>
>>> Is it possible to have a directory with multiple cabal files, telling
>>> cabal which file to use for a given install request by passing in a
>>> flag, say something like:
>>>
>>>> cabal install -f pads.cabal
>>> or
>>>> cabal install -f forest.cabal
>>>
>>> In other words, something like the -f option in make.
>>>
>>> I looked through the cabal documentation, but didn't see an option for
>>> specifying the cabal file to use.  Did I just fail to see the proper
>>> flag?  or does it not exist?
>>
>> I think it does not exist.
>>
>>>   If it doesn't, is that just because it
>>> hasn't been implemented, or is there a Good Reason?
>>
>> If you tell what you are intending, then we can certainly find a solution
>> using existing Cabal features.
>
> My use case would be the following: I have a large library,
> which I want to split into several cabal packages.
> However, I would like to keep the whole library in a single
> hierarchical module directory structure,
> so when I decide to move some module from one package to another,
> I only have to move a line from one .cabal file to another,
> and not move any files.


	I had the same problem. My solution is as follows: I have a single 
directory infrastructure, which is also my single Darcs repository. Each 
sub-project is represented by foo.cabal.package file.  During 
development I use a simple Makefile instead of Cabal, so I'm not sure if 
there would be any problem with it.

	When I want to release a sub-project, I create a symlink from 
foo.cabal.package to foo.cabal and execute

    cabal configure foo
    cabal build foo
    cabal sdist foo

	Before uploading to Hackage, I always unpack the foo.tar.gz in a 
different directory somewhere and install it using Cabal. This is 
necessary to test for any missing dependencies, because GHC will happily 
use a module file from the unified directory even if it's not specified 
in any package file. It also prevents me from releasing a package before 
releasing all its dependencies.

	The repository at http://code.haskell.org/SCC/, if something is not clear.


>
> That would allow me to focus on the hierarchical module collection,
> and keep that completely independent of the package hierarchy.
> It is no fun to have eight sparsely populated directory trees
> with closely related files spread all over the place,
> instead of side by side where they sit in the module hierarchy.
>
> (My concern is not with cabal-install, just with .cabal files for
>   package definition, and therefore also with Setup:
>   I'd probably need to say something like:
>
>    ./Setup -f forest.cabal configure -p --prefix=....
> )
>
>
>
> Wolfram
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list