RE: [Haskell-cafe] cabal under windows (was Re: Haskell-CafeDigest, Vol 51, Issue 180)

2007-11-29 Thread Bayley, Alistair
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Duncan Coutts
 On Thu, 2007-11-29 at 13:51 +1100, Tim Docker wrote:
  
  Is it actually reasonable to expect any cabal packages that 
 depend on
  external c libraries and headers to build out of the box on 
 windows? How
  can cabal find out where those files are, without requiring a config
  file to be edited?
 
 It's usually worse than that. The most likely situation is that the C
 library and header files are not even installed. This is a big problem
 for all packages that wrap C libs.

It can be done, with a bit of work, luck, and a brittle cabal Setup.hs
:-)

If you assume that the user has installed the 3rd party library
correctly, and you know it's layout and an executable it uses (which is
on the PATH), then you can do something like what HSQL does (and Takusen
now, which copied HSQL's approach). That is, you ask for the location of
the known executable in the PATH, and then build your header (include)
and library paths relative to the location of the executable. That's
what we've done in Takusen for the Oracle and Sqlite installations. For
PostgreSQL there is a program you can run which will emit the installed
locations of the include and library files, so that's slightly less
brittle.

Of course, if the particular libs are not on the PATH then this won't
work :-(

Alistair
*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] cabal under windows (was Re: Haskell-CafeDigest, Vol 51, Issue 180)

2007-11-29 Thread Tim Docker
Duncan Coutts wrote:

 Tim Docker wrote:
  Is it actually reasonable to expect any cabal packages that depend
on 
  external c libraries and headers to build out of the box on windows?

  How can cabal find out where those files are, without requiring a 
  config file to be edited?
 
 It's usually worse than that. The most likely situation is that the C
 library and header files are not even installed. This is a big problem
 for all packages that wrap C libs.

I wonder if this could be addressed by discarding the desire to
run magically out of the box, but make the requirements
clearer.

Currently the choices seem to be:

* Require the user to install these libs+headers 
just right (on the PATH or in certain MSYS
directories) so that they are found.

  * Edit the cabal package file to point to the
libs+headers

Perhaps a worthwhile addition to cabal would be for it to be able to
read a local config file, in which a user would specify where each
package should get the necessary headers and libs? You'd manually create
this file, maybe like:

package: SDL
include-dirs: c:\libs\SDL\include
lib-dirs: c:\libs\SDL\lib

package: curl
include-dirs: c:\dev\mycurl\include
lib-dirs: c:\dev\mycurl\lib


When building a package X, cabal would consult this file to work out
localised options for that package.

Tim

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