# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=ecb
pkgver=2.40.1pre
pkgrel=10
_commit=071706b22efcfeb65da8381e317220d7f9d8cb54
pkgdesc="Emacs Code Browser"
arch=('any')
url="http://ecb.sourceforge.net/"
depends=('emacs')
makedepends=('git')
license=('GPL')
install=ecb.install
#source=(http://downloads.sourceforge.net/ecb/$pkgname-$pkgver.tar.gz)
#source=(ecb-$pkgver.tar.gz::http://ecb.sourceforge.net/cvs_snapshots/ecb.tar.gz)
#source=(git://github.com/emacsmirror/ecb.git)
source=("git://github.com/alexott/ecb.git#commit=${_commit}")
md5sums=('SKIP')

build() {
  cd "$srcdir"/$pkgname
  sed -i 's|common/cedet.el|cedet.elc|' Makefile
}

package() {
  cd "$srcdir"/$pkgname
  _emacsver=`pacman -Q emacs | cut -f2 -d\ |cut -f1 -d-`
  mkdir -p "$pkgdir"/usr/share/emacs/site-lisp/ecb
  make CEDET=/usr/share/emacs/${_emacsver}/lisp/cedet ecb
  cp -R "$srcdir"/$pkgname/* "$pkgdir"/usr/share/emacs/site-lisp/ecb
  find "$pkgdir"/usr/share -type f -exec chmod 0644 {} \;
  find "$pkgdir"/usr/share -type d -exec chmod 0755 {} \;
}
