Building on Mac OS X

Hamish Mackenzie hamish.k.mackenzie at googlemail.com
Sun Dec 6 22:37:42 EST 2009


Hi Mark,

On 7 Dec 2009, at 07:53, Mark Lentczner wrote:

> I'm having some trouble building on Mac OS X. I have installed the GTK+ frameworks, and gtk2hs. However, the standard binary build of GTK+ doesn't seem to include gtsourceview2... so gtk2hs complains if I enable that, and then, of course, I can't build Leksah.
> 
> So - it looks like I'll have to configure and build GTK+ myself from source. The available instructions for that for the Mac look daunting as in filled with lots of additional software and libraries to pull and build and many options at every turn. Before I embark on that odyssey, is there perhaps a script for this used by the folks that build the binary distribution of Leksah?

Gtk2Hs on OSX is a challenge.  First I should say that I have not tried using a prebuilt binary build of GTK.  Also I have not tried the X11 version of GTK lately.

There are two ways to build Gtk and Gtk2Hs on OSX.
Mac Ports http://www.macports.org/
jhbuild http://gtk-osx.sourceforge.net/

Building with Mac Ports is normally fairly easy and is described in the Leksah Manual (I would recommend trying this first).  I have not tried this on Snow Leopard yet though (it should probably work though).

When making the Leksah OSX installer though I went the jhbuild route, because making a application bundle was better documented for that.  I have been ably to build everything ok on Snow Leopard using this method.

I used the Haskell Platform binary install 2009.2.0.2 to do the build (ghc 6.10.4).

You will need to follow the instructions here http://sourceforge.net/apps/trac/gtk-osx/wiki/Build (keep mac ports out of your PATH when doing this).  Once you have built the gtk2hs module (I have attached ~/Source/jhbuild/modulesets/gtk2hs.modules file I used) you should be able to make a Leksah bundle by running the following in the leksah source directory.

cd osx
./makedmg.sh 0.7.0.0



If all goes well this will leave you with a Leksah-0.7.0.0.dmg file in your home directory.

> On another tangent: GTK+ and Mac OS X don't seem to have that clear of a future. The information on the web is pretty grim. I see that there is work on a Cocoa bindings for Haskell. Is the Leksah code base such that it could be spilt to support two UI subsystems? If so, I'd love to put it on Cocoa - since gtsourceview2 has many bugs on Mac, making Leksah somewhat annoying to edit in.

I know what you mean about gtksourceview2 on the Mac, I have taken to using Leksah in my linux VM on the mac partly because I don't have to scroll up and down every now and then to make the redraw work again.  I have started working on integrating Yi into Leksah, which I hope will proved a much nicer experience (though I fear the redraw bug is actually in the GTK scroll window code as I have seen it in list views too).

I think it would be a great project to write a low level abstract GUI library (something like wxWidgets) in Haskell.  I know you can just use wxHaskell directly, but I think doing the abstraction in Haskell would be a nice alternative.  In some cases it might just be a matter of writing a few type classes then instantiating them for the different UI libraries (though I imagine that subtle differences will soon make it more difficult than that).  Support for Gtk2Hs, wxHaskell and HOC would be a good start.  I don't have time myself, but if you feel up to the challenge I would be happy to help out when I can.  I am sure other Haskell GUI library users would be happy to help out too (Andy Stewart for instance would probably be interested).

We could probably upgrade the Leksah code as the abstract UI library progressed until no direct dependancy on Gtk2Hs remained.

One of the cool things about doing the abstraction in Haskell (rather than using wxHaskell directly) is the possibility of using one of the Haskell to Javascript projects to make it wrap things like http://cappuccino.org/ as well.

Hamish

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.haskell.org/pipermail/leksah/attachments/20091207/426f92b3/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk2hs.modules
Type: application/octet-stream
Size: 922 bytes
Desc: not available
Url : http://projects.haskell.org/pipermail/leksah/attachments/20091207/426f92b3/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.haskell.org/pipermail/leksah/attachments/20091207/426f92b3/attachment-0001.htm 


More information about the Leksah mailing list