Building gtk2hs with Cabal still needs a lot of work, but just as quick
experiment to find out just how much work I had a go at the glib package
since it's the smallest.
I've pasted the glib.cabal file below. In addition to glib.cabal, I
needed these changes...
I hacked Cabal to pass the header files as command line parameters to
hsc2hs and c2hs. It's not clear if this is the best approach or if the
header files should be specified in the .hsc and .chs files themselves.
The mainline c2hs defines a withFoo function for each {# pointer #}.
This requires that we import withForeignPtr everywhere.
The bigger change though is that mainline c2hs requires that we use
withGObject everywhere where as our hacked c2hs adds this inline
everywhere. So it's this kind of thing:
- {# call g_object_set_property #}
- (toGObject obj)
+ withGObject (toGObject obj) $ \objPtr ->
+ {# call g_object_set_property #}
+ objPtr
In the glib package that only crops up in one place but in the gtk
package we'd have that kind of change on almost every function. We'd
have to use the code gen to make a change like that across the board.
Anyway, those are the only changes for glib. Of course with the glib
package there are not many inter-chs deps so we can get away with a
linear order. For the gtk package we'll need the proper support in
Cabal, especially for rebuilds.
Anyway, one thing it might be worth doing to make the transition to
using Cabal easier is if we do the change to use mainline c2hs. As I
say, that'd require updating the code gen and merging lots and lots of
trivial changes.
Duncan
Here's the glib.cabal file:
name: glib
version: 0.9.12.2
license: LGPL
license-file: COPYING.LIB
maintainer: [EMAIL PROTECTED]
stability: provisional
homepage: http://haskell.org/gtk2hs/
category: System
cabal-version: >=1.2
build-type: Simple
library
build-depends: base
pkgconfig-depends: glib-2.0 >= 2.0.0,
gobject-2.0 >= 2.0.0
build-tools: c2hs >= 0.15.1
includes: glib.h glib-object.h
extensions:
ForeignFunctionInterface, ExistentialQuantification,
FlexibleContexts, PatternSignatures,
ScopedTypeVariables, DeriveDataTypeable
exposed-modules:
System.Glib
System.Glib.FFI
System.Glib.UTFString
System.Glib.Types
System.Glib.GType
System.Glib.GTypeConstants
System.Glib.GValue
System.Glib.GValueTypes
System.Glib.GParameter
System.Glib.StoreValue
System.Glib.GObject
System.Glib.Properties
System.Glib.Attributes
System.Glib.GError
System.Glib.GList
System.Glib.Signals
System.Glib.Flags
System.Glib.MainLoop
System.Glib.GDateTime
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gtk2hs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel