#Packager: Dimitris Tzemos <dijemos(at)gmail.com>

pkgname=chromaprint
pkgver=1.5.1
pkgrel=1dj
source=("https://github.com/acoustid/${pkgname}/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
        "8ccad693.patch"
        "https://github.com/acoustid/chromaprint/commit/aa67c95b.patch")
sourcetemplate=http://people.salixos.org/djemos/salix/$pkgname
url="http://acoustid.org/chromaprint"
docs=("CHANGES.txt" "NEWS.txt" "COPYING.txt" "README.txt")

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"chromaprint (audio fingerprint library)"
"Chromaprint is the core component of the Acoustid project."
"It's a client-side library that implements a custom algorithm for"
"extracting fingerprints from any audio source."
""
"homepage: http://acoustid.org/chromaprint"
)

build() {
	if pkg-config --exists libavcodec; then tools="-DBUILD_TOOLS=ON"; else tools=""; fi
	
	cd "$SRC/${pkgname}-${pkgver}"
   patch -p1 < ../8ccad693.patch || return 1
   patch -p1 < ../aa67c95b.patch  || return 1 # Port to ffmpeg 5
   sed -e '/CMAKE_CXX_STANDARD/d' -i CMakeLists.txt # Don't enforce c++11

	mkdir -p build
	cd build
	cmake \
    -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIB_SUFFIX=${LIBDIRSUFFIX} \
    $tools \
    -DCMAKE_BUILD_TYPE=Release ..
	
	make -j $numjobs || return 1
    make install DESTDIR=$PKG || return 1
	cd ..
}
