# $Id$
# Maintainer: Ionut Biru <ibiru@archlinux.org>

pkgbase=vte3
pkgname=(vte3 vte-common)
pkgver=0.42.1
pkgrel=2
pkgdesc="Virtual Terminal Emulator widget for use with GTK3"
arch=('i686' 'x86_64')
license=('LGPL')
options=('!emptydirs')
makedepends=('intltool' 'gobject-introspection' 'gtk3' 'vala' 'glade')
url="http://www.gnome.org"
source=(http://download.gnome.org/sources/vte/${pkgver::4}/vte-$pkgver.tar.xz)
sha256sums=('9e00e2e9e94f4202b979c871f407a8815890bc0f4a8448a08534f76ab0fc9d34')

build() {
  cd "vte-$pkgver"
  ./configure --prefix=/usr --sysconfdir=/etc \
      --libexecdir=/usr/lib/vte \
      --localstatedir=/var --disable-static \
      --enable-introspection --enable-glade-catalogue
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' -e 's/    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then/      func_append compile_command " -Wl,-O1,--as-needed"\n      func_append finalize_command " -Wl,-O1,--as-needed"\n\0/' libtool
  make
}

package_vte3(){
  depends=('gtk3' 'vte-common')
  cd "vte-$pkgver"
  make DESTDIR="$pkgdir" install

  rm "$pkgdir"/etc/profile.d/vte.sh
}

package_vte-common() {
  pkgdesc="Common files used by vte and vte3"
  cd "vte-$pkgver"

  install -Dm644 src/vte.sh "$pkgdir"/etc/profile.d/vte.sh
}