makedepends=(alsa-lib flac)

description="Silicon Graphics Audio File Library"
url="https://audiofile.68k.org/"

maintainer="rems"
packager="Great-OS Team"

name=audiofile
version=0.3.6
release=5

source=(https://audiofile.68k.org/$name-$version.tar.gz
		01_gcc6.patch
		03_CVE-2015-7747.patch
		04_clamp-index-values-to-fix-index-overflow-in-IMA.cpp.patch
		05_Always-check-the-number-of-coefficients.patch
		06_Check-for-multiplication-overflow-in-MSADPCM-decodeSam.patch
		07_Check-for-multiplication-overflow-in-sfconvert.patch
		09_Actually-fail-when-error-occurs-in-parseFormat.patch
		10_Check-for-division-by-zero-in-BlockCodec-runPull.patch)
		
prepare() {
  cd $name-$version
  patch -Np1 -i ../01_gcc6.patch
  patch -Np1 -i ../03_CVE-2015-7747.patch
  patch -Np1 -i ../04_clamp-index-values-to-fix-index-overflow-in-IMA.cpp.patch
  patch -Np1 -i ../05_Always-check-the-number-of-coefficients.patch
  patch -Np1 -i ../06_Check-for-multiplication-overflow-in-MSADPCM-decodeSam.patch
  patch -Np1 -i ../07_Check-for-multiplication-overflow-in-sfconvert.patch
  patch -Np1 -i ../09_Actually-fail-when-error-occurs-in-parseFormat.patch
  patch -Np1 -i ../10_Check-for-division-by-zero-in-BlockCodec-runPull.patch
}

build() {
  cd $name-$version

  ./configure --prefix=/usr
  make
}

package() {
  cd $name-$version

  make DESTDIR=$PKG install
}
