[Haskell-cafe] Stupid question about Cabal file

2008-06-26 Thread Fernand

Hi,

Excuse me in advance if this is a trivial question, but I have been 
unable to find (understand?) the answer in Cabal's documentation.
My issue is simple : I build a Cabal package named, let's say, foo. 
That package is a library (libHSfoo.a, something like that), which 
exposes its Foo.Bar and Foobar modules. I wrote the cabal file, register 
it, everything seems fine.
The issue comes when I try to use that package when compiling a main 
program, like this :


ghc -package foo MyMain.hs [other options]

I get an error about the compiler not finding the interface files 
Foobar.hi and Bar.hi, as I have import Bar and import Foo.Bar in my 
MyMain.hs file. Of course, I could add -l flags to point to the 
.hi files that I used to compile my package, but I get the well-known 
issue about the fact that the package's names of the interface files 
(which were compiled with the -package-name foo option) are not the 
correct ones (Bad interface file: ../foo/Foobar.hi, Something is amiss; 
requested module  main:Foobar differs from name found in the interface 
file foo:Foobar) ; and that solution is ugly anyway.


So far, I found some Cabal documentation talking about the import-dirs 
property, but I did not manage to make it work, I mean, my package 
does not seems to include the interface files. I am sure, on the other 
hand, that it is possible :)


Sincerely yours,

Fernand
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stupid question about Cabal file

2008-06-26 Thread Daniel Fischer
Am Donnerstag, 26. Juni 2008 14:01 schrieb Fernand:
 Hi,

 Excuse me in advance if this is a trivial question, but I have been
 unable to find (understand?) the answer in Cabal's documentation.
 My issue is simple : I build a Cabal package named, let's say, foo.
 That package is a library (libHSfoo.a, something like that), which
 exposes its Foo.Bar and Foobar modules. I wrote the cabal file, register
 it, everything seems fine.
 The issue comes when I try to use that package when compiling a main
 program, like this :

 ghc -package foo MyMain.hs [other options]

 I get an error about the compiler not finding the interface files
 Foobar.hi and Bar.hi, as I have import Bar and import Foo.Bar in my
 MyMain.hs file. Of course, I could add -l flags to point to the
 .hi files that I used to compile my package, but I get the well-known
 issue about the fact that the package's names of the interface files
 (which were compiled with the -package-name foo option) are not the
 correct ones (Bad interface file: ../foo/Foobar.hi, Something is amiss;
 requested module  main:Foobar differs from name found in the interface
 file foo:Foobar) ; and that solution is ugly anyway.

 So far, I found some Cabal documentation talking about the import-dirs
 property, but I did not manage to make it work, I mean, my package
 does not seems to include the interface files. I am sure, on the other
 hand, that it is possible :)

 Sincerely yours,

 Fernand

Did you create your package using Cabal, i.e. have a module Setup.(l)hs in the 
same directory as the .cabal file and then

runhaskell Setup.hs configure --prefix=WhereYouWantIt
runhaskell Setup.hs build
runhaskell Setup.hs haddock (optionally)
runhaskell Setup.hs install
?

Then you shouldn't even need the -package option to use it, ghc-pkg would know 
where to find the interface files.

Cheers,
Daniel
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stupid question about Cabal file

2008-06-26 Thread Fernand

Daniel Fischer пишет:
Did you create your package using Cabal, i.e. have a module Setup.(l)hs in the 
same directory as the .cabal file and then


runhaskell Setup.hs configure --prefix=WhereYouWantIt
runhaskell Setup.hs build
runhaskell Setup.hs haddock (optionally)
runhaskell Setup.hs install
?

Then you shouldn't even need the -package option to use it, ghc-pkg would know 
where to find the interface files.


Cheers,
Daniel
  
No, I did not, because I actually inherited a large Makefile with huge 
dependencies and twisted built options.
If using Setup is the right (and only) way to create the package, I will 
then try it.


thank you,

Fernand

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stupid question about Cabal file

2008-06-26 Thread Daniel Fischer
Am Donnerstag, 26. Juni 2008 14:56 schrieb Fernand:
 Daniel Fischer пишет:
  Did you create your package using Cabal, i.e. have a module Setup.(l)hs
  in the same directory as the .cabal file and then
 
  runhaskell Setup.hs configure --prefix=WhereYouWantIt
  runhaskell Setup.hs build
  runhaskell Setup.hs haddock (optionally)
  runhaskell Setup.hs install
  ?
 
  Then you shouldn't even need the -package option to use it, ghc-pkg would
  know where to find the interface files.
 
  Cheers,
  Daniel

 No, I did not, because I actually inherited a large Makefile with huge
 dependencies and twisted built options.
 If using Setup is the right (and only) way to create the package, I will
 then try it.

 thank you,

 Fernand

If it's a complicated build, you should certainly take a close look at the 
Cabal user guide, because then you will probably need more than 
main = defaultMain
in your Setup.hs. On the other hand, the GHC user's guide should also contain 
some sections on building and registering packages.

The Cabal / Setup way is intended to be the simplest and standard way to build 
packages, but it's not the only one and won't be for a long time.

Cheers,
Daniel

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stupid question about Cabal file

2008-06-26 Thread Fernand

I had a look at the Distribution.Make import, which may be the answer.
Thank you for pointing the GHC documentation : I found a way to have the 
build process work, but after having patched my local package.conf file 
by hand, and installed manually the interfaces files accordingly. I now 
just need to understand how to obtain the same result using make, I think.


Haskelly yours,

Fernand

Daniel Fischer пишет:



If it's a complicated build, you should certainly take a close look at the 
Cabal user guide, because then you will probably need more than 
main = defaultMain
in your Setup.hs. On the other hand, the GHC user's guide should also contain 
some sections on building and registering packages.


The Cabal / Setup way is intended to be the simplest and standard way to build 
packages, but it's not the only one and won't be for a long time.


Cheers,
Daniel


  


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe