SUMMARY="The biblical text research engine"
DESCRIPTION="The SWORD Project is the CrossWire Bible Society's free Bible \
software project. Its purpose is to create cross-platform open-source tools-- \
covered by the GNU General Public License-- that allow programmers and Bible \
societies to write new Bible software more quickly and easily. We also create \
Bible study software for all readers, students, scholars, and translators of \
the Bible, and have a growing collection of over 200 texts in over 50 languages."
HOMEPAGE="http://www.crosswire.org/sword"
COPYRIGHT="1998-2018 CrossWire Bible Society"
LICENSE="GNU GPL v2"
REVISION="5"
SOURCE_URI="http://www.crosswire.org/ftpmirror/pub/sword/source/v${portVersion%.*}/sword-$portVersion.tar.gz"
CHECKSUM_SHA256="ce9aa8f721a737f406115d35ff438bd07c829fce1605f0d6dcdabc4318bc5e93"
PATCHES="sword-$portVersion.patchset"

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

GLOBAL_WRITABLE_FILES="settings/sword.conf auto-merge"

PROVIDES="
	sword$secondaryArchSuffix = $portVersion
	cmd:diatheke$secondaryArchSuffix = $portVersion
	cmd:emptyvss$secondaryArchSuffix = $portVersion
	cmd:imp2gbs$secondaryArchSuffix = $portVersion
	cmd:imp2ld$secondaryArchSuffix = $portVersion
	cmd:imp2vs$secondaryArchSuffix = $portVersion
	cmd:installmgr$secondaryArchSuffix = $portVersion
	cmd:mkfastmod$secondaryArchSuffix = $portVersion
	cmd:mod2imp$secondaryArchSuffix = $portVersion
	cmd:mod2osis$secondaryArchSuffix = $portVersion
	cmd:mod2vpl$secondaryArchSuffix = $portVersion
	cmd:mod2zmod$secondaryArchSuffix = $portVersion
	cmd:osis2mod$secondaryArchSuffix = $portVersion
	cmd:stripaccents$secondaryArchSuffix = $portVersion
	cmd:tei2mod$secondaryArchSuffix = $portVersion
	cmd:vpl2mod$secondaryArchSuffix = $portVersion
	cmd:vs2osisref$secondaryArchSuffix = $portVersion
	cmd:vs2osisreftxt$secondaryArchSuffix = $portVersion
	cmd:xml2gbs$secondaryArchSuffix = $portVersion
	lib:libsword_$portVersion$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libclucene_core$secondaryArchSuffix
	lib:libclucene_shared$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libicudata$secondaryArchSuffix >= 66
	lib:libicui18n$secondaryArchSuffix >= 66
	lib:libicuio$secondaryArchSuffix >= 66
	lib:libicuuc$secondaryArchSuffix >= 66
	lib:libnghttp2$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	sword${secondaryArchSuffix}_devel = $portVersion
	devel:libsword$secondaryArchSuffix
	devel:libsword_$portVersion$secondaryArchSuffix
	"
REQUIRES_devel="
	sword$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libclucene_core$secondaryArchSuffix
	devel:libclucene_shared$secondaryArchSuffix
	devel:libcppunit$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libicudata$secondaryArchSuffix >= 66
	devel:libicui18n$secondaryArchSuffix >= 66
	devel:libicuio$secondaryArchSuffix >= 66
	devel:libicuuc$secondaryArchSuffix >= 66
	devel:libnghttp2$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/libsword.la

	prepareInstalledDevelLibs libsword libsword-$portVersion
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}

TEST()
{
	make check
}
