# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lucene++
pkgver=3.0.7
pkgrel=5
pkgdesc="C++ port of the popular Java Lucene library"
url="https://github.com/luceneplusplus/LucenePlusPlus"
arch="all"
license="GPL Apache"
depends=""
depends_dev="boost-dev"
makedepends="$depends_dev cmake linux-headers ccache"
install=""
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/luceneplusplus/LucenePlusPlus/archive/rel_3.0.7.tar.gz"

_builddir="$srcdir/LucenePlusPlus-rel_$pkgver"

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	mkdir "$_builddir"/build
	cd "$_builddir"/build
	# stupid (but functional) hack to prevent fority header to break
	# the build. Remeber to remove ccache from deps when fixed.
	export PATH="/usr/lib/ccache/bin/:$PATH"
	cmake "$_builddir" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DLIB_DESTINATION=/usr/lib \
		-DBoost_LIBRARY_DIR=/usr/lib \
		-DENABLE_CUSTOM_ALLOCATOR='FALSE' \
		-DCMAKE_CXX_FLAGS='-DBOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT' \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"/build
	make DESTDIR="$pkgdir" install
}

md5sums="e260c1ff9c10af7070faee29f325f955  lucene++-3.0.7.tar.gz"
sha256sums="6c19f203311e4b44a0ccf7b1127db77436eb47159ea1c54f7531a0b1ca585e0c  lucene++-3.0.7.tar.gz"
sha512sums="92f3bba320980673cc64c983616aa38d25b44ea811237ed226741b892757fb8151e4f833aa58a18dbe7a0c9a899d94e828aa15e6d7b48a69ab730d1d772db220  lucene++-3.0.7.tar.gz"
