Personal tools

Gtk2Hs

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
m (install instructions for Mac)
Line 17: Line 17:
   
 
== Installation Notes ==
 
== Installation Notes ==
  +
=== Mac OS X ===
 
Installing Gtk2Hs on Mac requires some finesse, at least until Haskell Libary Platform is built or ghc-6.8.3 is
 
Installing Gtk2Hs on Mac requires some finesse, at least until Haskell Libary Platform is built or ghc-6.8.3 is
 
available in macports. (These are planned for late 2008.)
 
available in macports. (These are planned for late 2008.)
   
# Install [http://macports.org MacPorts]
+
* Install [http://macports.org MacPorts]
# Install dependencies:
+
* Install dependencies:
 
sudo port instll glade3 libglade2 gstreamer gst-plugins-base gtksourceview cairo librsvg gtkglext firefox
 
sudo port instll glade3 libglade2 gstreamer gst-plugins-base gtksourceview cairo librsvg gtkglext firefox
# Update PKG_CONFIG_PATH (for libraries)
+
* Update PKG_CONFIG_PATH (for libraries)
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig
+
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig
# Update ghc to use macports libs: Edit your main <tt>ghc</tt> driver program and change the last line to:
+
* Update ghc to use macports libs: Edit your main <tt>ghc</tt> driver program and change the last line to:
 
exec $GHCBIN $TOPDIROPT ${1+"$@"} -L/opt/local/lib -I/opt/local/include
 
exec $GHCBIN $TOPDIROPT ${1+"$@"} -L/opt/local/lib -I/opt/local/include
# Download Gtk2Hs following instructions at [http://www.haskell.org/gtk2hs/downloads/ Gtk2Hs Download page]
+
* Download Gtk2Hs following instructions at [http://www.haskell.org/gtk2hs/downloads/ Gtk2Hs Download page]
# Check configuration:
+
* Check configuration:
 
./configure --enable-docs --enable-profiling
 
./configure --enable-docs --enable-profiling
   
Line 54: Line 55:
 
* Now do "(g)make" followed by "(g)make install"
 
* Now do "(g)make" followed by "(g)make install"
 
**************************************************
 
**************************************************
# Build and Install:
+
* Build and Install:
 
make
 
make
 
sudo make install
 
sudo make install

Revision as of 04:19, 11 August 2008

Contents

1 What is it?

Gtk2Hs is a Haskell binding to Gtk+ 2.x. Using it, one can write Gtk+ based applications with GHC.

2 Homepage

http://haskell.org/gtk2hs/

3 Status

It currently works with Gtk+ 2.0 through to 2.8 on Unix, Win32 and MacOS X. The widget function coverage is almost complete, only a few minor bits and pieces are missing.

It currently builds with ghc 5.04.3 through to 6.8.2

4 Installation Notes

4.1 Mac OS X

Installing Gtk2Hs on Mac requires some finesse, at least until Haskell Libary Platform is built or ghc-6.8.3 is available in macports. (These are planned for late 2008.)

  • Install MacPorts
  • Install dependencies:
sudo port instll glade3 libglade2 gstreamer gst-plugins-base gtksourceview cairo librsvg gtkglext firefox
  • Update PKG_CONFIG_PATH (for libraries)
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig
  • Update ghc to use macports libs: Edit your main ghc driver program and change the last line to:
exec $GHCBIN $TOPDIROPT ${1+"$@"} -L/opt/local/lib -I/opt/local/include
./configure --enable-docs --enable-profiling

...

**************************************************
* Configuration completed successfully.           
*                                                 
* The following packages will be built:           
*                                                 
* glib          : yes                             
* gtk           : yes                             
* glade         : yes              
* cairo         : yes                 
* svgcairo      : yes              
* gtkglext      : yes              
* gconf         : yes                 
* sourceview    : yes            
* mozembed      : yes              
* soegtk        : yes                             
* gnomevfs      : yes              
* gstreamer     : yes             
* documentation : yes                    
*                                                 
* Now do "(g)make" followed by "(g)make install"
**************************************************
  • Build and Install:
make 
sudo make install

5 Demos

5.1 OpenGL and Gtk2Hs

Gtk2Hs/Demos/GtkGLext/hello.hs

Gtk2Hs/Demos/GtkGLext/terrain.hs requires Gtk2Hs/Demos/GtkGLext/terrain.xpm