# $Id: PKGBUILD 228951 2015-01-12 23:45:48Z bisson $
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Tobias Kieslich <tobias@archlinux.org>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Dominik Ryba <domryba@post.pl>

pkgname=hugin
pkgver=2014.0.0
pkgrel=3
pkgdesc='Panorama photo stitcher'
url='http://hugin.sourceforge.net/'
license=('GPL')
arch=('i686' 'x86_64')
makedepends=('cmake' 'boost' 'tclap' 'mesa' 'swig')
depends=('wxgtk' 'boost-libs' 'enblend-enfuse' 'exiv2' 'libpano13' 'python'
         'lensfun' 'lapack' 'make' 'perl-image-exiftool' 'desktop-file-utils')
source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${pkgname}-${pkgver%.*}/${pkgname}-${pkgver/r/_r}.tar.bz2"
        "http://downloads.sourceforge.net/boost/boost_1_55_0.tar.bz2")
sha1sums=('7b4ae181f664b9e0a68f55f298cdaa210fa09aa9'
          'cef9a0cc7084b1d639e06cd3bc34e4251524c840')

install=install

prepare() {
	cd "${srcdir}/${pkgname}-${pkgver/rc?}"

	# We take the module "spirit" from boost 1.55 and use it instead of the one
	# that is provided by boost 1.56+ because hugin doesn't compile with the
	# latter.  This is no proper fix for the problem but it works for now.
	mkdir -p src/boost
	cp -r "${srcdir}/boost_1_55_0/boost/spirit" src/boost/

	# Fix compiling against lensfun-0.3.0
	sed '/LF_DIST_MODEL_FOV1/d' -i src/hugin_base/lensdb/LensDB.cpp
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver/rc?}"
	cmake . \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DENABLE_LAPACK=yes \

	make
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver/rc?}"
	make DESTDIR="${pkgdir}" install
}
