cabal design

Isaac Jones ijones at
Fri Aug 19 13:11:52 EDT 2005

Frederik Eaton <frederik at> writes:

> On Mon, Aug 15, 2005 at 08:52:18AM -0700, Isaac Jones wrote:
>> Frederik Eaton <frederik at> writes:
>> > 1) Cabal files can have different names, yet only one can exist in a
>> > directory. I've been told that the reason for the former is that Isaac
>> > wants to support building multiple packages in a directory, but
>> > currently the feature isn't implemented, so only one cabal file is
>> > allowed.
>> >
>> > Certainly, it would be a nice feature, but more importantly it seems
>> > that it would require some API changes or additions which should be
>> > made sooner rather than later. Is there a document describing how it
>> > would work? Is there a roadmap, a schedule for implementation?
>> I'm not so sure that the change is very big at all... it should just
>> be a matter of adding a feature to allow libraries to register
>> themselves "in-place" or something... then compute the dependencies
>> between the packages, build them in order, install the libraries
>> you'll need in-place, then compile the programs.
>> The problems come up where a package might need to actually be in the
>> install location in order to work.  Hopefully that's not too common.
> This sounds rather vague. For instance, how does it interact with
> configure/make based packages?

If they conform to the cabal standard, providing configure, build, and
install steps, then they are built exactly the same.  Can you be more
specific about your question?

> What do you think about putting a TODO list linking to designish
> documents on the wiki, so that people can flesh these plans out and
> comment on them there?

Sure.  Feel free to add a wiki page for this.  There's a TODO list in
the darcs repository, but it may not be understandable by anyone but
me; it still might be a good place to start.

I caution you, though, on spending too much time making plans and
designs and not much time writing code; the problem is usually that we
have plenty of ideas about what needs to get done and not enough
coders.  The code base is pretty manageable, so if you want to help
out, just pick something you think needs to get done, or ask me what
is most important and start working on it :) I usually ask for help on
this list when something comes up.

Something that you could spend a few hours on is getting the test
suite to run conveniently on other people's computers, and figuring
out how to get Hugs to pick up changes directly from the current
directory during testing.

>> > 3) The way that a 'cabal' package with a 'configure' script should be
>> > built is not easy to determine. There are some very useful programs
>> > ( which build and manage packages of all
>> > kinds automatically, by running 'configure' with a local prefix, etc.
>> > How should these tools be extended to work with 'cabal' packages? With
>> > some 'cabal' packages, the user is supposed to run 'configure' first,
>> > and then 'runhaskell Setup.hs'. With other 'cabal' packages, the user
>> > is supposed to just run 'runhaskell Setup.hs', and this will run
>> > 'configure' automatically. Is there a right way? Is there a way to
>> > distinguish the two types of packages automatically?
>> What packages require you to run configure by hand? 
> I don't know of any packages off-hand. 


> I think my friend who wrote "toast" may have found one, but he may
> also have just liked 'configure' better. Anyway, it's good to know
> that there is a standard. It might be good for the manual to mention
> explicitly that configure/make are always run by Setup.hs and not
> vice-versa.

Here's a good example; the manual is in the darcs repository,
doc/cabal.xml, I think.  Just go ahead and add that and send me a
darcs patch :)

>> > 4) Cabal's inability to let users specify package.conf-s other than
>> > the user or global package.conf
>> I think the gentoo guys were going to implement this for us; in any
>> case, it's a subset of 1).  This should be pretty easy; the only
>> question is whether we should have a --in-place or a
>> --package-conf=... Where in-place would choose a "standard" one
>> (./packages.conf or something).  The reason I'd prefer the former is
>> that not all systems _have_ an idea of a package.conf file, so
>> --package-conf= would make no sense for most compilers.  I try to
>> avoid that.  The reason for the later would be if there's some
>> use-case that --in-place does not work for.
> Is it really a subset of (1)? I don't think it is.
> I think a --package-conf= would be very nice. If it is not supported
> by the compiler, then an error should be generated.

In a way, the problem isn't "lack of support" but a different model of
finding packages... It's not like a compiler extension that one system
supports and one doesn't; this flag breaks abstraction between
compilers in a way that --in-place does not.  I haven't heard any use
cases where --in-place won't work.

>> > 5) It seems that there should be a way to build multiple packages
>> > which depend on each other, in such a way as that the first package
>> > doesn't have to be installed for the second package to be built. In
>> > other words, perhaps something like a dummy installation as in #4 is
>> > called for. I have seen mention that support for building multiple
>> > packages is planned, but how? When? 
>> This is the same as 1.
> Well, not if they aren't in the same directory. Again, we need to have
> more explicit details about how things are planned to work.

Hackage is the tool here; it's still almost ready.  It has 19 module
dependencies and is a pain to bootstrap.  We've written about it here
& there, but if you can't dig up concrete information, come onto
#haskell and ask Lemmih what's up.

> OK, correct me if I'm wrong but I think we need to tell people what
> kind of patches to write, and ask them to write them, to get things
> moving.

If volunteers appear, they usually just start working on what's
important to them.  Occasionally someone will do something that I ask
them to, but not that often ;)

>> > 6) I think it should be easy to use 'cabal' for development; however,
>> > when I am building a package with multiple executables, every 'build'
>> > seems to re-link each executable, regardless of whether it needs
>> > re-linking or not, which is quite slow. 
>> I'm not sure why ghc --make re-links executables every time.
>> For libraries, I think we could use support from ghc to tell whether
>> we need to re-link the library; ghc goes through and skips stuff that
>> doesn't need to get built, and then we link everything in the library;
>> if ghc could somehow let us know that nothing needed to get built,
>> that would be very helpful; otherwise, someone has to write the logic
>> to go through and check it all just like ghc does.  This code should
>> be out there somewhere.
> Isn't there a way to get ghc to emit Makefile fragments which solves
> this problem? Not that solving it in ghc wouldn't be good as well.

Relying on Make isn't any good for us for the simple build
infrastructure; it needs to be more portable than that.



More information about the Libraries mailing list