# Template build file for 'jsoncpp'.
pkgname=jsoncpp
version=0.6.0rc2
_srcversion=0.6.0-rc2
revision=5
hostmakedepends="scons"
wrksrc="${pkgname}-src-${_srcversion}"
short_desc="A JSON implementation in C++"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="Public Domain or MIT"
homepage="http://jsoncpp.sourceforge.net/"
distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-src-${_srcversion}.tar.gz"
checksum=d4d193d163f520b08b9155cba978615892ca1359d77e3fb261fce2f86d09b283

do_build() {
	sed -i SConstruct -e "s/g++/${CXX}/g"
	scons CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS} " \
		DESTDIR="${DESTDIR}" platform=linux-gcc
	${CXX} -o libjsoncpp.so.0.0.0 -shared -Wl,-soname,libjsoncpp.so.0 \
		buildscons/linux-gcc-*/src/lib_json/*.os -lpthread
}

do_install() {
	vmkdir usr/lib
	cp libjsoncpp.so.0.0.0 ${DESTDIR}/usr/lib/
	ln -sf libjsoncpp.so.0.0.0 ${DESTDIR}/usr/lib/libjsoncpp.so
	ln -sf libjsoncpp.so.0.0.0 ${DESTDIR}/usr/lib/libjsoncpp.so.0
	vmkdir usr/include/jsoncpp/json
	install -p -m 0644 include/json/*.h ${DESTDIR}/usr/include/jsoncpp/json
	vinstall ${FILESDIR}/jsoncpp.pc 644 usr/lib/pkgconfig
}

jsoncpp-devel_package() {
	depends="jsoncpp>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
