# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=('libpipeline' 'libpipeline-devel')
pkgver=1.5.8
pkgrel=1
pkgdesc="a C library for manipulating pipelines of subprocesses in a flexible and convenient way"
url="http://libpipeline.nongnu.org/"
groups=('libraries')
arch=('i686' 'x86_64')
license=('BSD')
makedepends=('openssl-devel' 'zlib-devel' 'autotools' 'gcc')
options=('!libtool')
source=(https://download.savannah.gnu.org/releases/libpipeline/libpipeline-$pkgver.tar.gz{,.asc})
sha256sums=('1b1203ca152ccd63983c3f2112f7fe6fa5afd453218ede5153d1b31e11bb8405'
            'SKIP')
validpgpkeys=('AC0A4FF12611B6FCCF01C111393587D97D86500B') # "Colin Watson <cjwatson@chiark.greenend.org.uk>"

prepare() {
  cd "${pkgname}-${pkgver}"

  autoreconf -fi
}

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

  export MSYSTEM=CYGWIN
  ./configure --build=${CHOST} --prefix=/usr
  make
  make DESTDIR="${srcdir}/dest" install
}

check() {
  cd "${pkgname}-${pkgver}"
  make check
}

package_libpipeline() {
  depends=('gcc-libs')
  groups=('libraries')

  mkdir -p ${pkgdir}/usr/bin
  cp -f ${srcdir}/dest/usr/bin/*.dll ${pkgdir}/usr/bin/
  cp -rf ${srcdir}/dest/usr/share ${pkgdir}/usr/
}

package_libpipeline-devel() {
  pkgdesc="libpipeline headers and libraries"
  options=('staticlibs')
  depends=("libpipeline=${pkgver}")
  groups=('development')

  mkdir -p ${pkgdir}/usr
  cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
  cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/
}
