Suppose I write some code that can work with Gtk2hs or wxHaskell.
How do I go about making that into a package?

You just need to add a flag 'gtk2hs' and then construct the
Build-Depends depending on the value of the flag.  However, if
e.g. that flag is by default True, then users of wxHaskell will
have to manually change its value.  I.e. it is not automatic
based on what the user has on his system.

Not true. The value of the flag *is* determined automatically based on what packages you already have on your system. For instance, if your cabal file says

  Flag hasGTK
    Default: True
  Library
    if hasGTK
      Build-Depends: gtk2hs
    else
      Build-Depends: wxHaskell

and your installed system has wx but not gtk, then it will still select the wx branch, regardless of the value of the flag default. The only meaning of the default value is, if *both* possible solutions could potentially build successfully, then which one will be preferred.

Regards,
    Malcolm

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

Reply via email to