# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=id3lib
pkgver=3.8.3
pkgrel=2
pkgdesc="Library for reading, writing, and manipulating ID3v2 tags"
url="http://id3lib.sourceforge.net"
arch="all"
license="LGPL-2.0+"
depends=""
depends_dev="zlib-dev"
makedepends="$depends_dev"
subpackages="$pkgname-dev"
source="https://downloads.sourceforge.net/project/id3lib/id3lib/$pkgver/id3lib-$pkgver.tar.gz
	cstring.patch
	modern-cpp.patch
	test-expose-proper-stdlib-symbols.patch
	CVE-2007-4460.patch
	"

# secfixes:
#   3.8.3-r2:
#     - CVE-2007-4460

prepare() {
	default_prepare
	update_config_sub
}

build() {
	cd "$builddir"
	export CFLAGS="$CFLAGS -fPIC"
	export CXXFLAGS="$CXXFLAGS -fPIC"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

sha512sums="3787e261f86933c1c2f2bff2c4b349b42f5d8636e489e4f39f9d75e6dfbdc79b87009a0f4ce4b786f2fb3dbc01ca9d56c4112095b46244f897e6c9a28573adaf  id3lib-3.8.3.tar.gz
e379e848788f7fda3a86b02b9865dfe5db69d66ffcfb81184c1cd92f2f1ed7b4d40f13cc77f9de294afc13ae61ab50c3aa13f9a4cc4eb85cb7a727d25268ee6a  cstring.patch
334eed099c93ea279d877437a92f684bfb0df12774fd7fffb628b6e8c4b17b17952d6f7c0bf0dff03a87887f0f1233c70d98b69f23580dcf3bf64c8d4b93fc85  modern-cpp.patch
cd79daddffbafc11e555f16be827ccedc03e419b7c24ab1da1852af294dc486a0836d612318eb9861691ef8462ca38be41cfa2c12849f022ebb187c6ef95a1b9  test-expose-proper-stdlib-symbols.patch
97b1686ca3b7feefe7c2cc5f90a31f42fb55fd7baf45b0abe07c6d879bdf752f21305a6a883241c18e20847c43175c3d2c911dce14aa5f382f46bf44c07759f1  CVE-2007-4460.patch"