# Template file for 'ca-certificates'
pkgname=ca-certificates
version=20110421
revision=3
distfiles="${DEBIAN_SITE}/main/c/${pkgname}/${pkgname}_${version}.tar.gz"
build_style=custom-install
short_desc="Common CA certificates"
maintainer="Mike Rosset <mike.rosset@gmail.com>"
homepage="http://packages.qa.debian.org/c/ca-certificates.html"
license="GPL-2"
conf_files="/etc/ca-certificates.conf"
checksum=30069a2a39ddd0cda32851a8292d2f489e0bed40a64a19e6e384d4d37d9fc418
long_desc="
 Common CA certificates"

noarch=yes

Add_dependency full findutils
Add_dependency full sed
Add_dependency full openssl
Add_dependency full run-parts
Add_dependency build python

do_build() {
	make ${makejobs}
}

do_install() {
	mkdir -p $DESTDIR/usr/share/ca-certificates
	mkdir -p $DESTDIR/usr/sbin
	mkdir -p $DESTDIR/etc/ssl/certs
	make install DESTDIR=${DESTDIR}
	install -D -m644 sbin/update-ca-certificates.8 \
		${DESTDIR}/usr/share/man/man8/update-ca-certificates.8

	cd ${DESTDIR}/usr/share/ca-certificates
	find . -name '*.crt' | sort | cut -b3- \
		> ${DESTDIR}/etc/ca-certificates.conf
}

post_stow() {
	[ ! -d etc/ca-certificates/update.d ] && \
		install -d ${XBPS_MASTERDIR}/etc/ca-certificates/update.d
	mkdir -p ${XBPS_MASTERDIR}/etc/ssl/certs
	${DESTDIR}/usr/sbin/update-ca-certificates --fresh
}
