
Hi, I would like to include a few source files as 'executable' sections in a .cabal package description. However, although I do want to use main=mainDefault features, I do not want those packages to be installed when I run 'Setup.hs install'. Is it possible to do that? I believe there's no flag that indicates install step, since (I guess) flags are checked only at configure time. Thanks for your help, Maurício

On Mon, Oct 20, 2008 at 3:04 PM, Mauricio
I would like to include a few source files as 'executable' sections in a .cabal package description. However, although I do want to use main=mainDefault features, I do not want those packages to be installed when I run 'Setup.hs install'.
Is it possible to do that? I believe there's no flag that indicates install step, since (I guess) flags are checked only at configure time.
I know this isn't what you asked, since you did explicitly mention Cabal, but Franchise (http://groups.google.com/group/franchise-haskell) has a function "privateExecutable" which is used for that very purpose. I don't know anything about .cabal packages, but maybe this will suit your needs? steve

I think, though I haven't tried this, that you can replace the
instHooks with one that:
1. filters out the private executables from the PackageDescription
2. Provides this new PackageDescription to the standard instHook.
Which I would think is the instHook of the UserHooks parameter passed
to your modifed instHook.
Something like (psuedo-code typed in email):
main = defaultMainWithHooks $ defaultUserHooks { instHook = filteredInstHook }
filteredInstHook :: PackageDescription -> LocalBuildInfo -> UserHooks
-> InstallFlags -> IO ()
filteredInstHook package lbi user_hooks install_flags = do
let package' = package { executables = filter_private_executable
(executables package) }
instHook user_hooks package' lbi user_hooks install_flags
Though that last line may need to read:
instHook defaultUserHooks package' lbi user_hooks install_flags
-Corey O'Connor
On Mon, Oct 20, 2008 at 12:04 PM, Mauricio
Hi,
I would like to include a few source files as 'executable' sections in a .cabal package description. However, although I do want to use main=mainDefault features, I do not want those packages to be installed when I run 'Setup.hs install'.
Is it possible to do that? I believe there's no flag that indicates install step, since (I guess) flags are checked only at configure time.
Thanks for your help, Maurício
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Mon, 2008-10-20 at 17:04 -0200, Mauricio wrote:
Hi,
I would like to include a few source files as 'executable' sections in a .cabal package description. However, although I do want to use main=mainDefault features, I do not want those packages to be installed when I run 'Setup.hs install'.
Is it possible to do that? I believe there's no flag that indicates install step, since (I guess) flags are checked only at configure time.
Yes, just use this in the executable section: buildable: False Duncan

I would like to include a few source files as 'executable' sections in a .cabal package description. However, although I do want to use main=mainDefault features, I do not want those packages to be installed when I run 'Setup.hs install'.
Yes, just use this in the executable section:
buildable: False
But I do want it to be built (so Setup will check dependencies, allow me to './Setup clean' etc.). However, I would like './Setup install' to install just the main library. Maurício

I would like to include a few source files
as 'executable' sections in a .cabal package description. However, although I do want to use main=mainDefault features, I do not want those packages to be installed when I run 'Setup.hs install'.
Yes, just use this in the executable section:
buildable: False
But I do want it to be built (so Setup will check dependencies, allow me to './Setup clean' etc.). However, I would like './Setup install' to install just the main library.
Just in case my response to you (in a previous thread that you started) wasn't clear, EMGM also provides an example of this feature. See the Cabal configuration file. http://hackage.haskell.org/packages/archive/emgm/0.1/emgm.cabal Follow the use of the 'test' flag in that file. By running "./Setup configure" with no flags, 'test' is False. When you run "./Setup configure -ftest", 'test' is true. Look for the use of 'buildable' w.r.t. 'test'. Regards, Sean

(...) But I do want it to be built (so Setup will check dependencies, allow me to './Setup clean' etc.). However, I would like './Setup install' to install just the main library.
Just in case my response to you (in a previous thread that you started) wasn't clear, EMGM also provides an example of this feature. See the Cabal configuration file. (...)
Sure, I read that. But my idea was to get something with build-time flags, not configure-time flags. But I think that was a begginer mistake. Your way seems to be the standard way of doing that. That's what I'm going to do. Thanks, Maurício
participants (5)
-
Corey O'Connor
-
Duncan Coutts
-
Mauricio
-
Sean Leather
-
Stephen Hicks