# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=libgpod
pkgver=0.8.3
pkgrel=11
pkgdesc="A shared library to access the contents of an iPod"
url="https://sourceforge.net/projects/gtkpod/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="automake autoconf libtool intltool libimobiledevice-dev libplist-dev
	swig mutagen sg3_utils-dev gdk-pixbuf-dev glib-dev sqlite-dev
	gobject-introspection-dev libxml2-dev gtk-doc"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="https://downloads.sourceforge.net/project/gtkpod/libgpod/libgpod-0.8/libgpod-$pkgver.tar.bz2
	0001-323-Segmentation-fault-when-opening-ipod.patch
	0002-Fix-spelling-errors-in-comments-and-strings-using-co.patch
	0003-Fixed-PList-deprecation.patch
	libgpod-0.8.2-pkgconfig_overlinking.patch
	gcc14.patch
	"
prepare() {
	default_prepare
	sed -e 's|libplist >= 1.0|libplist-2.0 >= 2.2|' -i configure.ac # support libplist 2.2
	autoreconf -fi
}

build() {
	MCS=/usr/bin/mcs ./configure \
		--prefix=/usr \
		--with-udev-dir=/lib/udev \
		--enable-udev
	make PREFIX=/usr
	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
}

check() {
	make check
}

package() {
	make PREFIX=/usr DESTDIR="$pkgdir" install
	rmdir "$pkgdir"/tmp
}

sha512sums="
e39f22054c2d2bdf5fc764aa1f692de17a1a06c7c7e9c60883d126b216dacca7840bf818e7e7e039218fe2a64c0920ba96d8cbbe310e11c1c4e68b82e7cbbd8e  libgpod-0.8.3.tar.bz2
d1a813a45230ca716e0c6ed5497d68089762ce5b4cac9462f1959083fdf40bedbf7449a55d63170800d74372921fad02a9d5a3146e9f8ed652ffd58238360b49  0001-323-Segmentation-fault-when-opening-ipod.patch
f95d53e616763e4e620862fb2e1abc2fcec29951c2047b7f08bfbee69ce68661772f499f90f87d81a2707583b3d8017d11dcaf75a9028f50b7c3260a9768c285  0002-Fix-spelling-errors-in-comments-and-strings-using-co.patch
163e33c3e727240561021dd8a4d921bad4724845db00d1d87c963a9e8619dbfda90de9d42944bf33f5b3479b00b3908e550a831489b12c7d4f0e83cdaae697ad  0003-Fixed-PList-deprecation.patch
c8ebcc18ba7b44aef8fada3f9fea88fdaaf6bae12cf809b08f98e85ab6396ae032bfd7706809cd266be67c694749d4364a9cc591eb750478e095cbbcbe061419  libgpod-0.8.2-pkgconfig_overlinking.patch
8f834962b05977676b7771a53c9a1004354783dc3c5e2d11278e9330f8958577916b7310f9e2b7e76cdba1ab61c65dd3fd02a01a0ab7a0f28d34761aa019f31a  gcc14.patch
"
