# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Tor Krill <tor@krill.nu>
# Contributor: Lee.MaRS <leemars@gmail.com>

pkgname=gsoap
pkgver=2.8.88
pkgrel=1
pkgdesc="Offers an XML language binding to ease the development of SOAP/XML Web services in C and C/C++"
url="https://www.cs.fsu.edu/~engelen/soap.html"
arch=('x86_64')
license=('GPL' 'custom')
depends=('openssl' 'zlib' 'gcc-libs')
makedepends=('autoconf' 'automake')
options=('staticlibs')
source=("https://prdownloads.sourceforge.net/gsoap2/${pkgname}_${pkgver}.zip"
	'0001-no-xlocale.patch'
	'LICENSE')
sha256sums=('effbf8a4533917b9eb3aa0e79db13573ef52e768158f5b4eb93d49b0c5cb2fa8'
            '4058a13b4ac5b26c4a1a5e6363390b47652a02ef29cab835de6720ddb516e405'
            '0457ad7ae5599c7ee2e30f94d685dfd1a39cc9a9e3937aef1417d1752dfc6eb3')

prepare() {
  cd "$srcdir"/gsoap-2.8
#  patch -Np1 < "${srcdir}"/0001-no-xlocale.patch
}

build() {
  cd "$srcdir"/gsoap-2.8
  # needed for programs which use gsoap and have -fPIC enabled
  # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=353724
  export CFLAGS+=" -fPIC"
  export CXXFLAGS+=" -fPIC"
  ./configure --prefix=/usr
  make -j1
}

package() {
  cd "$srcdir"/gsoap-2.8
  make DESTDIR="$pkgdir" install
  mkdir -p "$pkgdir"/usr/share/gsoap/import
  mkdir -p "$pkgdir"/usr/share/gsoap/WS
  cp -R gsoap/import "$pkgdir"/usr/share/gsoap/
  cp -R gsoap/WS "$pkgdir"/usr/share/gsoap/
  install -D ../LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
