[Haskell-cafe] Using a library in a executable within same cabal package
Hello, Not sure this question is totally on-topic. Please point me in the right direction if it is not. I would like to make a cabal package containing both an executable and several libraries, and link the main executable to the libraries produced in the build. It is not clear how I can achieve that from the documentation. I tried Extra-libraries option but it does not work. Thanks for your help -- Arnaud Bailly ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using a library in a executable within same cabal package
On 24/04/10 11:01, Arnaud Bailly wrote: Hello, Not sure this question is totally on-topic. Please point me in the right direction if it is not. I would like to make a cabal package containing both an executable and several libraries, and link the main executable to the libraries produced in the build. It is not clear how I can achieve that from the documentation. I tried Extra-libraries option but it does not work. If I understand your goal correctly there are numerous examples of how to do that on Hackage already, e.g. tagsoup[1]. /M [1] http://hackage.haskell.org/packages/archive/tagsoup/0.8/tagsoup.cabal -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using a library in a executable within same cabal package
Arnaud Bailly abai...@oqube.com writes: Not sure this question is totally on-topic. Sure is. Please point me in the right direction if it is not. I would like to make a cabal package containing both an executable and several libraries, Each cabal package can contain only one library (which is why gtk2hs is only now starting to be cabalised). and link the main executable to the libraries produced in the build. It is not clear how I can achieve that from the documentation. I tried Extra-libraries option but it does not work. By default, you don't need to do anything extra to have executables using a library in the same package (assuming they have the same source directory) as GHC will find all the modules it needs. Cabal-1.8 has a new feature that lets executables explicitly depend upon the libraries, which means the library doesn't need to get rebuilt several times. However, this is causing problems with building haddock documentation: http://hackage.haskell.org/trac/hackage/ticket/656 -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using a library in a executable within same cabal package
You are right, I hit reply without checking the destination. Thanks for your answer. Arnaud On Sat, Apr 24, 2010 at 3:24 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: First of all, did you mean to reply back to -cafe as well? Arnaud Bailly arnaud.oq...@gmail.com writes: I was not precise enough: Yes, I found the examples to have both a library and an executable clear enough that I managed to have something workable. But I found somewhat surprisingly that the modules used in both the library and the executable were compiled twice. I was expecting the executable to link to the dynamic library produced. I understand from your answer this is a known issue. Right; with Cabal 1.8 this situation is solved, but at the expense of not being able to build documentation (I think I was the first person to fully try this, which is why the bug went unnoticed until recently; the darcs people are considering using it as well but they didn't test building haddock docs). So yeah, at the moment you're stuck with building the library multiple times :s On Sat, Apr 24, 2010 at 12:14 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Arnaud Bailly abai...@oqube.com writes: Not sure this question is totally on-topic. Sure is. Please point me in the right direction if it is not. I would like to make a cabal package containing both an executable and several libraries, Each cabal package can contain only one library (which is why gtk2hs is only now starting to be cabalised). and link the main executable to the libraries produced in the build. It is not clear how I can achieve that from the documentation. I tried Extra-libraries option but it does not work. By default, you don't need to do anything extra to have executables using a library in the same package (assuming they have the same source directory) as GHC will find all the modules it needs. Cabal-1.8 has a new feature that lets executables explicitly depend upon the libraries, which means the library doesn't need to get rebuilt several times. However, this is causing problems with building haddock documentation: http://hackage.haskell.org/trac/hackage/ticket/656 -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe