# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Pierre Chapuis <catwell at archlinux dot us>
# Contributor: Ray Kohler <ataraxia937 at gmail dot com>
# Contributor: Michael Witten <mfwitten>
# Contributor: Raphael Proust <raphlalou at gmail dot com>

pkgname=surf
pkgver=0.7+199+gda5290a
pkgrel=1
pkgdesc='A simple web browser based on WebKit/GTK+.'
arch=('i686' 'x86_64')
url='http://surf.suckless.org/'
license=('MIT')
depends=('webkit2gtk' 'xorg-xprop')
optdepends=('dmenu: URL-bar'
            'ca-certificates: SSL verification'
            'xterm: default download handler'
            'curl: default download handler')
makedepends=('git')
install='surf.install'
_commit=da5290a41aac4eabef83f6b88039f44d28b0ea00  # surf-webkit2
source=("git+git://git.suckless.org/surf#commit=$_commit"
        'config.h')
md5sums=('SKIP'
         'SKIP')

pkgver() {
  cd "${srcdir}/${pkgname}"
  git describe --tags | sed 's/-/+/g' | sed 's/0.6/0.7/'
}

build() {
  cd "${srcdir}/${pkgname}"

  cp "${srcdir}/config.h" config.h

  sed -i 's/CPPFLAGS =/CPPFLAGS +=/g' config.mk
  sed -i 's/CFLAGS =/CFLAGS +=/g' config.mk
  sed -i 's/LDFLAGS =/LDFLAGS +=/g' config.mk

  make
}

package() {
  cd "${srcdir}/${pkgname}"

  make PREFIX=/usr DESTDIR="${pkgdir}" install
  install -Dm0644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
