# Template file for 'libgphoto2'
pkgname=libgphoto2
version=2.4.13
homepage="http://www.gphoto.org"
distfiles="${SOURCEFORGE_SITE}/gphoto/$pkgname-$version.tar.bz2"
build_style=gnu-configure
configure_args="--disable-rpath udevscriptdir=/lib/udev"
short_desc="Digital camera access library"
maintainer="Juan RP <xtraeme@gmail.com>"
license="GPL-2"
checksum=01bce1c3f89fbaca571cb2b5be1f2980a0095c5f6516e33a8273d65b9dc8e70e
long_desc="
 libgphoto2 is the core library designed to allow access to digital
 camera by external programs. Here is an overview of the global
 architecture:

 It abstracts communication ports and camera protocol, to allow a
 complete modularity. To support a new communication physical layer
 (like IEEE1394), just add a new port to libgphoto2_port. To support
 a new kind a digital camera, just provide a new camlib with the
 required callbacks. All of this will be transparent to client
 programs that call libgphoto2."

subpackages="$pkgname-devel"

Add_dependency build pkg-config
Add_dependency build libltdl-devel
Add_dependency build libusb-compat-devel
Add_dependency build jpeg-devel
Add_dependency build gd-devel
Add_dependency build libexif-devel

post_install() {
	# Remove unused udev helper
	rm -rf ${pkgdir}/usr/lib/udev

	vmkdir lib/udev/rules.d
	LD_LIBRARY_PATH="${DESTDIR}/usr/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \
		CAMLIBS="${DESTDIR}/usr/lib/libgphoto2/${version}" \
		"${DESTDIR}/usr/lib/libgphoto2/print-camera-list" udev-rules version 136 > \
		"${DESTDIR}/lib/udev/rules.d/40-gphoto.rules"

	# Remove recursive symlink
	rm -f ${DESTDIR}/usr/include/gphoto2/gphoto2
	install -d ${DESTDIR}/lib/udev/rules.d
}
