### this file is sourced not run
PKGNAME=libid3lib32
PKGVER=3.8.3
PKGBUILD=1
PKGARCH=i686

# source: JakeSFR
TARBALL=id3lib-${PKGVER}.tar.gz
MD5SUM=19f27ddd2dda4b2d26a559a4f0f402a7
SRC_URL=http://downloads.sourceforge.net/sourceforge/id3lib/${TARBALL}
BUNDLE=

SLACKREQ=''
SLACKINSTALL=''

SLACKDESC="${PKGNAME}: ${PKGNAME} ${PKGVER} (Library for manipulating ID3v1/ID3v2 tags)  
${PKGNAME}:  
${PKGNAME}: id3lib is an open-source, cross-platform software development library
${PKGNAME}: for reading, writing, and manipulating ID3v1 and ID3v2 tags. It is an
${PKGNAME}: on-going project whose primary goals are full compliance with the
${PKGNAME}: ID3v2 standard, portability across several platforms, and providing
${PKGNAME}: a powerful and feature-rich API with a highly stable and efficient
${PKGNAME}: implementation.
${PKGNAME}: This contains 32-bit version of the library.
${PKGNAME}: 
${PKGNAME}: http://id3lib.sourceforge.net/
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	
	# apply patches from Arch/Debian
	cd tmp/id3lib* &&
	patch -Np1 -i ../pkg/00-add-libz-to-compilation.patch &&
	patch -Np1 -i ../pkg/05-create-m4-directory.patch &&
	patch -Np1 -i ../pkg/10-fix-compilation-with-cpp-headers.patch &&
	patch -Np1 -i ../pkg/15-fix-headers-of-main-functions.patch &&
	patch -Np1 -i ../pkg/20-create-manpages.patch &&
	patch -Np1 -i ../pkg/30-fix-utf16.patch &&
	patch -Np1 -i ../pkg/40-deal-with-mkstemp.patch &&
	patch -Np1 -i ../pkg/50-remove-outdated-check.patch &&
	patch -Np1 -i ../pkg/60-add-c-wrapper-functions.patch &&
	patch -Np1 -i ../pkg/60-fix_make_check.patch &&
	patch -Np1 -i ../pkg/60-id3lib-missing-nullpointer-check.patch &&
	patch -Np1 -i ../pkg/60-spelling.patch &&
	patch -Np1 -i ../pkg/61-fix_vbr_stack_smash.patch &&
	true
}

### package - only collect the libraries
pkg_package() {
	rm -rf bin sbin usr/bin usr/sbin usr/include usr/share
}

### build
pkg_build() {
	cd /tmp/id3lib* &&
	libtoolize -fc &&
	aclocal &&
	autoconf &&
	automake --add-missing --copy &&
	pkg_build_autoconf &&
	pkg_build_slackdesc &&
	true
}
