| 1 | NOTE: on lion (and snow leopard i suppose), make sure you are using a 64 bit install of ghc. Also, unless you are suggesting an edit to these directions, please go ask people on the relevant mailing list or wiki for help :) |
|---|
| 2 | NOTE: gtk2hs 0.12.2 won't build with ghc 7.4.1, but the current darcs repo for gtk2hs does build |
|---|
| 3 | NOTE: on 7.4 there seems to be a problem when in ghci and drawing to a window, but not when rendering to pdf. I don't know why this is, but if you do, let me know. I'll update this as i have more info |
|---|
| 4 | |
|---|
| 5 | note that these directions probably can use some cleanup, but i'm choosing these steps so that rebuilding any haskell library doesn't require remembering ANYTHING :-) |
|---|
| 6 | (tested on ghc 7.2.2, assumes you have standard developer things installed on mac, like x11 and stuff) |
|---|
| 7 | |
|---|
| 8 | 1) cabal install gtk2hs-buildtools #(this should work with any haskell platform install) |
|---|
| 9 | |
|---|
| 10 | 2) brew install cairo gtk gettext fontconfig |
|---|
| 11 | |
|---|
| 12 | 3) brew link cairo gettext fontconfig and all the other dependencies listed for brew's gtk formula |
|---|
| 13 | this is best done with |
|---|
| 14 | by hand running brew link for each of the items in `brew deps gtk` along with fontconfig and gettext. |
|---|
| 15 | some of these will already linked, and some won't be, so this command makes it simpler |
|---|
| 16 | # brew will complain, who cares, this makes your life easier (at least if you're living in a haskell world :p ) |
|---|
| 17 | |
|---|
| 18 | NOTE: you will need to make sure that all these Brew libs are built, and linked in |
|---|
| 19 | |
|---|
| 20 | 4) download libfreetype, heres a URL you can use http://sourceforge.net/projects/freetype/files/freetype2/2.4.8/freetype-2.4.8.tar.bz2/download?use_mirror=iweb |
|---|
| 21 | 5) unpack libfreetype, and then run |
|---|
| 22 | ./configure ; make ; make install |
|---|
| 23 | this will install the static and dynamic library files for lib freetype in /usr/local/ (../include and ../lib) , which is what you'll want, though this will contribute to brew doctor complaining, but again, this is the easiest way |
|---|
| 24 | |
|---|
| 25 | 6) cabal install gtk |
|---|
| 26 | |
|---|
| 27 | this should work sans complaints! |
|---|
| 28 | |
|---|
| 29 | now you can eg |
|---|
| 30 | cabal install chart-gtk |
|---|
| 31 | and run |
|---|
| 32 | this https://gist.github.com/1655252 example chart code either by building with ghc and running the executable |
|---|
| 33 | or by running main in ghc, and |
|---|
| 34 | or |
|---|
| 35 | try out some other cool libraries like diagrams! |
|---|