# Template file for 'cld2'
pkgname=cld2
version=0.0.1.20150821
revision=1
_gitrev=b56fa78a2fe44ac2851bae5bf4f4693a0644da7b
wrksrc="${pkgname}-${_gitrev}"
short_desc="Compact Language Detector 2"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="Apache-2.0"
homepage="https://github.com/CLD2Owners/cld2"
distfiles="https://github.com/CLD2Owners/cld2/archive/${_gitrev}.tar.gz>${pkgname}-${version}.tar.gz"
checksum=2bd0f8aa344698c0ce6b2c89f5540af10e69e92d4c74f9fe66ffe25281be1111

CXXFLAGS="-Wno-narrowing"

do_configure() {
	:
}

do_build() {
	cd internal
	sed -i compile_libs.sh -e "s;^g++;$CXX;"
	./compile_libs.sh CFLAGS= CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS"
}

do_install() {
	local f
	vmkdir usr/include/cld2/internal
	vmkdir usr/include/cld2/public
	for f in internal/*.h; do
		vinstall ${f} 644 usr/include/cld2/internal
	done
	for f in public/*.h; do
		vinstall ${f} 644 usr/include/cld2/public
	done
	vmkdir usr/lib
	vinstall internal/libcld2.so 755 usr/lib
	vinstall internal/libcld2_full.so 755 usr/lib
	vdoc README.md
}

cld2-full_package() {
	short_desc+=" - full detection"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/lib/libcld2_full.so
	}
}

cld2-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}-full>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
	}
}
