Extending Windows support
Esa Ilari Vuokko
eivuokko at gmail.com
Tue Aug 15 13:33:06 EDT 2006
There's few things Cabal could handle for Windows-based Cabal users.
I hope to implement them if there's agreement that they are sensible
additions into Cabal. All of them can of course be done in Setup.hs,
but that's just annoying.
This is rather ghc-specific, because that's what I use. And most of
this doesn't probably matter for compilers that aren't producing
Rationale: Building DLLs is fairly common in Windows, they are a
most common way to extend many appliations via COM or other
plugin-like systems. Note: this has nothing to do with producing
dynamically linked haskell packages/libs. Rather it almost
identically to producing .exe, except that main won't be called.
Todo: Easiest way seems to be to add new part to package config,
much like executables, extending executable-list to contain DLL
info might also be doable, but less clean. Important bits I can
* passing --mk-dll to ghc
* being able to specify .def file and passing it through ghc to
dlltool (--optdll--def --optdllPATH/TO/A.DEF)
* Possibly building import library by calling dlltool with .def
and right options (means we have to add new program: dlltool)
* Installing import lib...well dunno about this.
Example how it can be done right now:
(note that this script builds import lib for diffrent dll than it builds)
* Resource (scripts)
Rationale: Resources are embedded (binary) data sections in executables.
In Windows these can be (easily) edited after the exectuable has been
linked, and there's many APIs that can use them. Also some important
information can be encoded in them, like versioning, icons, manifest
files. I am not sure about already compiled resource files, I recall
some dialogeditors producing object files, but they are probably wrong
format object files as long as ghc works on top of gnu toolchain.
Todo: Mainly Cabal needs to know and invoke a tool very much like
c-compiler. For mingw (and probably cygwin) this would be windres.exe.
We probably also need to get the tool into ghc binary distribution.
Example: I don't know anyone doing this using Cabal.
--Esa Ilari Vuokko
More information about the cabal-devel