# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.

# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
# for more information on packaging from darcs sources.

# Maintainer: Your Name <youremail@domain.com>
pkgname=NAME-darcs
pkgver=VERSION
pkgrel=1
pkgdesc=""
arch=()
url=""
license=('GPL')
groups=()
depends=()
makedepends=('darcs')
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
source=()
noextract=()
md5sums=() #generate with 'makepkg -g'

_darcstrunk=DARCSURL
_darcsmod=MODNAME

build() {
  cd "$srcdir"
  msg "Checking for previous build...."

  if [[ -d "$_darcsmod/_darcs" ]]; then
    msg "Retrieving missing patches"
    cd "$_darcsmod"
    darcs pull -a "$_darcstrunk/$_darcsmod"
  else
    msg "Retrieving complete sources"
    darcs get --partial --set-scripts-executable "$_darcstrunk/$_darcsmod"
    cd "$_darcsmod"
  fi

  rm -rf "$srcdir/$_darcsmod-build"
  cp -r "$srcdir/$_darcsmod" "$srcdir/$_darcsmod-build"
  cd "$srcdir/$_darcsmod-build"

  msg "Starting build..."

  #
  # BUILD HERE
  #
  ./autogen.sh
  ./configure --prefix=/usr
  make
}

package() {
  cd "$srcdir/$_darcsmod-build"
  make DESTDIR="$pkgdir/" install
}

# vim:set ts=2 sw=2 et:
