# $Id: PKGBUILD 36430 2009-04-22 12:03:12Z pierre $
# Maintainer: Alexander Baldeck <alexander@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
pkgname=xulrunner
pkgver=1.9.1.1
_ffoxver=3.5.1
pkgrel=2
pkgdesc="Mozilla Runtime Environment"
arch=(i686 x86_64)
license=('MPL' 'GPL' 'LGPL')
depends=('gtk2>=2.16.0' 'gcc-libs>=4.3.3' 'libidl2>=0.8.13' 'mozilla-common' 'nss>=3.12.3' 'libxt' 'lcms' 
         'hunspell>=1.2.8' 'startup-notification>=0.9')
makedepends=('zip' 'pkgconfig' 'diffutils' 'libgnomeui>=2.24.1')
provides=(gecko-sdk)
replaces=(gecko-sdk)
url="http://wiki.mozilla.org/XUL:Xul_Runner"
source=(http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${_ffoxver}/source/firefox-${_ffoxver}-source.tar.bz2
        mozconfig)
md5sums=('18169e189785d680827d4fce94524449'
         '6509d12e6b17bfc51c09e1dc35259035')

build() {
  cd ${startdir}/src/mozilla-1.9.1
  cp ${startdir}/src/mozconfig .mozconfig

  unset CFLAGS
  unset CXXFLAGS
  export LDFLAGS="-Wl,-rpath,/usr/lib/xulrunner-1.9"

  make -j1 -f client.mk build MOZ_MAKE_FLAGS="$MAKEFLAGS" || return 1
  make -j1 DESTDIR=${startdir}/pkg install || return 1

  ln -sf xulrunner-${pkgver} ${pkgdir}/usr/lib/xulrunner-1.9
  ln -sf xulrunner-devel-${pkgver} ${pkgdir}/usr/lib/xulrunner-devel-1.9
  ln -sf xulrunner-${pkgver} ${pkgdir}/usr/include/xulrunner-1.9
  ln -sf xulrunner-${pkgver} ${pkgdir}/usr/share/idl/xulrunner-1.9

  # The ubuntu patch adds these... get rid of it, NSS/NSPR has it.
  rm -f ${startdir}/pkg/usr/lib/pkgconfig/mozilla-ns{s,pr}.pc || return 1

  sed -i -e "s/xulrunner-${pkgver}/xulrunner-1.9/g" -e "s/xulrunner-devel-${pkgver}/xulrunner-devel-1.9/g" ${pkgdir}/usr/lib/pkgconfig/*.pc || return 1
}