# Template file for 'boost'
pkgname=boost
version=1.44.0
_boostver="$(echo $version|sed 's|\.|_|g')"
wrksrc=${pkgname}_${_boostver}
distfiles="${SOURCEFORGE_SITE}/$pkgname/${pkgname}_${_boostver}.tar.bz2"
build_style=custom-install
short_desc="Free peer-reviewed portable C++ source libraries"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=45c328029d97d1f1dc7ff8c9527cd0c5cc356636084a800bca2ee4bfab1978db
long_desc="
 boost is a library for applications dealing with netlink sockets.
 The library provides an interface for raw netlink messaging and various
 netlink family specific interfaces."

subpackages="boost-build boost-devel boost-jam boost-python"
Add_dependency run libgcc
Add_dependency run glibc
Add_dependency run libstdc++
Add_dependency run zlib
Add_dependency run bzip2
Add_dependency run icu-libs
Add_dependency build zlib-devel
Add_dependency build bzip2-devel
Add_dependency build icu-devel
Add_dependency build python

do_build()
{
	cd ${wrksrc} && ./bootstrap.sh -prefix=${DESTDIR}/usr || return 1
	cd ${wrksrc} && ./bjam cflags=-fno-strict-aliasing ${makejobs} || return 1
}

do_install()
{
	# Install bjam
	_bindir="bin.linuxx86"
	[ "${xbps_machine}" = "x86_64" ] && _bindir="bin.linuxx86_64"
	install -m755 -d ${DESTDIR}/usr/bin
	install -m755 ${wrksrc}/tools/jam/src/${_bindir}/bjam \
		${DESTDIR}/usr/bin || return 1

	# Install headers/libs
	cd ${wrksrc} && ./bjam --prefix=${DESTDIR}/usr install || return 1

	# Install Boost.Build stuff.
	install -d ${DESTDIR}/usr/share/boost-build
	cd ${wrksrc}/tools/build/v2 && cp -a . ${DESTDIR}/usr/share/boost-build
	find ${DESTDIR}/usr/share/boost-build \
		-type f -name \*.orig -exec rm -f {} \;
	( echo '# System wide configuration file for Boost.Build.' ; \
	  echo ; \
	  echo 'using gcc ;' ; ) >${wrksrc}/site-config.jam
	install -m644 -D ${wrksrc}/site-config.jam \
		${DESTDIR}/etc/site-config.jam

	# license
	install -d ${DESTDIR}/usr/share/licenses/${pkgname}
	install -m644 ${wrksrc}/LICENSE_1_0.txt \
		${DESTDIR}/usr/share/licenses/${pkgname}/ || return 1
}
