# $Id: PKGBUILD 123896 2014-12-15 03:26:49Z fyan $
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Christian Hesse <mail@eworm.de>
# Contributor: Daenyth <Daenyth+Arch [at] gmail [dot] com>
# Contributor: nofxx <x@nofxx.com>

pkgname=iodine
pkgver=0.7.0
pkgrel=3
pkgdesc='Tunnel IPv4 data through a DNS server'
arch=('i686' 'x86_64')
url='http://code.kryo.se/iodine'
license=('custom:ISC')
depends=('zlib' 'net-tools')
backup=('etc/conf.d/iodined')
source=("http://code.kryo.se/${pkgname}/${pkgname}-${pkgver}.tar.gz"
        'iodined.service'
        'iodined.conf.d')
sha256sums=('ad2b40acf1421316ec15800dcde0f587ab31d7d6f891fa8b9967c4ded93c013e'
            '4019f95432c7b272b96c80a112abd56f4c308bfab4cc920525880c30f417cb84'
            '47e710954cdf68b4c2f66cac367c2bf4e750f682cd393001b8da67da1cdee54b')

build() {
  cd ${pkgname}-${pkgver}

  make
}

package() {
  cd ${pkgname}-${pkgver}

  make prefix=/usr sbindir=/usr/bin DESTDIR="${pkgdir}" install
  install -d "${pkgdir}/usr/share/licenses/iodine"
  sed -n '/AUTHORS & LICENSE/,$p' README > "${pkgdir}/usr/share/licenses/iodine/LICENSE"

  install -Dm644 "$srcdir/iodined.service" "$pkgdir/usr/lib/systemd/system/iodined.service"
  install -Dm644 "$srcdir/iodined.conf.d" "$pkgdir/etc/conf.d/iodined"
}
