SUMMARY="Generator Tools for Coding SOAP/XML Web Services in C and C++"
DESCRIPTION="The gSOAP toolkit provides a cross-platform software development \
toolkit for C and C++ server and client Web service applications, and \
simplifies the overall use of XML in any type of application. The toolkit \
supports SOAP 1.1/1.2 RPC encoding and document/literal styles, WSDL 1.1, \
MTOM/MIME/DIME attachments (streaming), SOAP-over-UDP, request-response and \
one-way messaging. The toolkit also supports WS-Addressing and WS-Security, \
with several other WS-* available or under development."
HOMEPAGE="https://www.genivia.com/dev.html"
COPYRIGHT="2000-2018 Robert van Engelen, Genivia Inc."
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://sourceforge.net/projects/gsoap2/files/gsoap-2.8/gsoap_2.8.75.zip"
CHECKSUM_SHA256="825cfc31d97090ab634d8739a57179e59e5ac6f6071878cdf3c32d8cb90b3649"
SOURCE_DIR="gsoap-2.8"
PATCHES="gsoap-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	gsoap$secondaryArchSuffix = $portVersion
	cmd:soapcpp2$commandSuffix = $portVersion
	cmd:wsdl2h$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libgpg_error$secondaryArchSuffix
	lib:libgcrypt$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	gsoap${secondaryArchSuffix}_devel = $portVersion
	devel:libgsoap++$secondaryArchSuffix
	devel:libgsoap$secondaryArchSuffix
	devel:libgsoapck++$secondaryArchSuffix
	devel:libgsoapck$secondaryArchSuffix
	devel:libgsoapssl++$secondaryArchSuffix
	devel:libgsoapssl$secondaryArchSuffix
	"
REQUIRES_devel="
	gsoap$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libgnutls$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:bison
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage gsoap$secondaryArchSuffix \
	"$commandBinDir"/soapcpp2 \
	"$commandBinDir"/wsdl2h

BUILD()
{
	autoreconf -vfi
	chmod +x ./configure
	runConfigure --omit-dirs binDir \
		./configure --bindir=$commandBinDir \
		--enable-ipv6 \
		--enable-gnutls
	make
		# multi-job builds fail
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libgsoap++ \
		libgsoap \
		libgsoapck++ \
		libgsoapck \
		libgsoapssl++ \
		libgsoapssl
	fixPkgconfig

	rmdir "$libDir"

	packageEntries devel \
		"$developDir"
}
