Monday, August 20, 2007

gtk2hs compiled!!

I tried to install gtk2hs for a couple of days. And finally, it succeeds! Somehow, I had to turn off compiler optimization (-O0). Here is PKGBUILD for Archlinux:

pkgname=gtk2hs
pkgver=0.9.12
pkgrel=1
pkgdesc="A GUI Library for Haskell based on Gtk"
url="http://haskell.org/gtk2hs/"
license=('GPL')
depends=('ghc' 'gtk2' 'libglade' 'librsvg' 'gtkglext' 'cairo' 'gtksourceview')
arch=('i686')
source=($pkgname-$pkgver.tar.gz)
install=gtk2hs.install
md5sums=('32752a42c225f55b0280151f8e19a3ed')
build() {
    cd $startdir/src/$pkgname-$pkgver
    ./configure --prefix=/usr --without-pkgreg --disable-split-objs --with-hcflags=-O0
    make || return 1
    make DESTDIR=$startdir/pkg install
}

This is gtk2hs.install file. Without --force, it fails somehow.

post_install() {
    for pkg in /usr/lib/gtk2hs/*.package.conf; do
        ghc-pkg register "$pkg" -g --force
    done
}

post_upgrade() {
    for pkg in /usr/lib/gtk2hs/*.package.conf; do
        #basename $pkg .package.conf
        tmp="${pkg##*/}"
        ghc-pkg unregister "${tmp%%.*}" && ghc-pkg register "$pkg" -g --force
    done
}

pre_remove() {
    for pkg in /usr/lib/gtk2hs/*.package.conf; do
        tmp="${pkg##*/}"
        ghc-pkg unregister "${tmp%%.*}" -g #2>/dev/null
    done
    rm /usr/lib/gtk2hs/*.o
}

op=$1
shift
$op $*

Now, haskell with gui goodness.

No comments:

Post a Comment