# Description: A high-quality MPEG audio decoder
# URL: http://www.underbit.com/products/mad/
# Packager: pierre at nutyx dot org
# Depends on: 

name=libmad
version=0.15.1b
release=1

source=(ftp://ftp.mars.org/pub/mpeg/$name-$version.tar.gz\
	http://www.linuxfromscratch.org/patches/blfs/svn/libmad-$version-fixes-1.patch)


build() {
	cd $name-$version
        patch -Np1 -i ../libmad-$version-fixes-1.patch
        sed "s@AM_CONFIG_HEADER@AC_CONFIG_HEADERS@g" -i configure.ac
        touch NEWS AUTHORS ChangeLog
        autoreconf -fi
        ./configure --prefix=/usr --disable-static
        make
        make DESTDIR=$PKG install
        mkdir -p $PKG/usr/lib/pkgconfig

cat > $PKG/usr/lib/pkgconfig/mad.pc << "EOF"
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: mad
Description: MPEG audio decoder
Requires:
Version: #version#
Libs: -L${libdir} -lmad
Cflags: -I${includedir}
EOF
sed -i "s/#version#/$version/" $PKG/usr/lib/pkgconfig/mad.pc
}
