# Depends on: libjpeg-turbo libexif libusb-compat

description="Core library of gphoto2, designed to allow access to digital camera by external programs."
url="http://www.gphoto.org/proj/libgphoto2/"
packager="Sipo"
name=libgphoto2
version=2.5.16
_version="${version//./_}"
release=2

source=(https://github.com/gphoto/$name/archive/libgphoto2-${_version}-release.tar.gz)


build() {
cd $name-$name-${_version}-release

autoreconf -fvi

./configure --prefix=/usr --disable-rpath

make
make DESTDIR=$PKG install

cd $PKG/usr/lib/libgphoto2

export LD_LIBRARY_PATH=$PKG/usr/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
export CAMLIBS=$PWD/$version

./print-camera-list hwdb \
| install -Dm644 /dev/stdin $PKG/etc/udev/hwdb.d/20-gphoto.hwdb
./print-camera-list udev-rules version 201 \
| install -Dm644 /dev/stdin $PKG/etc/udev/rules.d/40-gphoto.rules

# Obsolets libs

rm $PKG/usr/lib/libgphoto2.la
rm $PKG/usr/lib/libgphoto2/2.5.16/*.la
rm $PKG/usr/lib/libgphoto2_port.la
rm $PKG/usr/lib/libgphoto2_port/0.12.0/*.la

}
