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

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

Arnaud Bailly
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.Miljenovic@gmail.com IvanMiljenovic.wordpress.com
participants (3)
-
Arnaud Bailly
-
Ivan Lazar Miljenovic
-
Magnus Therning