File essentia.spec of Package essentia

#
# spec file for package essentia
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define model_version v2.1_beta5
%define soversion 0
Name:           essentia
Version:        2.1.0+git20190804.ed59cc48
Release:        0
Summary:        C++ library for audio and music analysis, description and synthesis
License:        AGPL-3.0-only
Group:          Development/Libraries/C and C++
Url:            https://github.com/MTG/essentia
Source:         essentia-%{version}.tar.xz
Source1:        https://raw.githubusercontent.com/MTG/essentia/d02b6c752046802a711530e2bcd5feafca42247d/waf
# Note that not all essentia versions support all models. Check that they're compatible when doing a new release!
Source2:        https://essentia.upf.edu/svm_models/essentia-extractor-svm_models-%{model_version}.tar.gz
Patch0:         fix-install-dirs-2014.patch
Patch1:         fix-install-dirs.patch
Patch2:         0001-Fix-highlevel-parameter-in-MusicExtractor-which-coul.patch
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig(fftw3)
BuildRequires:  ffmpeg-4-libavcodec-devel
BuildRequires:  ffmpeg-4-libavformat-devel
BuildRequires:  pkgconfig(libchromaprint)
BuildRequires:  pkgconfig(samplerate)
BuildRequires:  pkgconfig(taglib)
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python-rpm-macros
BuildRequires:  gaia2-devel
BuildRequires:  libsvm-devel
BuildRequires:  libyaml-devel
%if %{suse_version} >= 1600
BuildRequires:  python3-numpy1
BuildRequires:  python3-numpy1-devel
%else
BuildRequires:  python3-numpy
BuildRequires:  python3-numpy-devel
%endif
BuildRequires:  vamp-plugin-sdk-devel
BuildRequires:  pkgconfig(eigen3)

%description
Essentia is a C++ library with Python bindings for audio analysis and audio-based
music information retrieval. The library contains an extensive collection of
reusable algorithms which implement audio input/output functionality, standard
digital signal processing blocks, statistical characterization of data, and a
large set of spectral, temporal, tonal and high-level music descriptors.

%package -n libessentia%{soversion}
Summary:  Essentia development package
Group:    Development/Libraries/C and C++

%description -n libessentia%{soversion}
Essentia is a C++ library with Python bindings for audio analysis and audio-based
music information retrieval. The library contains an extensive collection of
reusable algorithms which implement audio input/output functionality, standard
digital signal processing blocks, statistical characterization of data, and a
large set of spectral, temporal, tonal and high-level music descriptors.

This package contains the essentia library.

%package devel
Summary:  Essentia development package
Group:    Development/Libraries/C and C++
Requires: libessentia%{soversion} = %{version}-%{release}

%description devel
Essentia is a C++ library with Python bindings for audio analysis and audio-based
music information retrieval. The library contains an extensive collection of
reusable algorithms which implement audio input/output functionality, standard
digital signal processing blocks, statistical characterization of data, and a
large set of spectral, temporal, tonal and high-level music descriptors.

This package contains the header files for libessentia.

%package -n %{python_flavor}-essentia
Summary:  Essentia Python Bindings
Group:    Development/Libraries/Python
Requires: libessentia%{soversion} = %{version}-%{release}
Provides: python3-essentia = %{version}-%{release}
%if %{suse_version} >= 1600
Requires: %{python_flavor}-numpy1
%else
Requires: %{python_flavor}-numpy
%endif

%description -n %{python_flavor}-essentia
Essentia is a C++ library with Python bindings for audio analysis and audio-based
music information retrieval. The library contains an extensive collection of
reusable algorithms which implement audio input/output functionality, standard
digital signal processing blocks, statistical characterization of data, and a
large set of spectral, temporal, tonal and high-level music descriptors.

This package contains the python bindings for libessentia.

%package tools
Summary:  Essentia library tools
Group:    Productivity/Multimedia/Sound/Utilities
Requires: libessentia%{soversion} = %{version}-%{release}

%description tools
Essentia is a C++ library with Python bindings for audio analysis and audio-based
music information retrieval. The library contains an extensive collection of
reusable algorithms which implement audio input/output functionality, standard
digital signal processing blocks, statistical characterization of data, and a
large set of spectral, temporal, tonal and high-level music descriptors.

This package contains utilities for Essentia.

%package vamp
Summary:  Essentia vamp plugin
Group:    Productivity/Multimedia/Sound/Utilities
Requires: libessentia%{soversion} = %{version}-%{release}

%description vamp
Essentia is a C++ library with Python bindings for audio analysis and audio-based
music information retrieval. The library contains an extensive collection of
reusable algorithms which implement audio input/output functionality, standard
digital signal processing blocks, statistical characterization of data, and a
large set of spectral, temporal, tonal and high-level music descriptors.

This package contains vamp plugins for libessentia.

%package models
Summary:  Essentia classifier models
Group:    Productivity/Multimedia/Sound/Utilities
Requires: libessentia%{soversion} = %{version}-%{release}
BuildArch: noarch

%description models
Essentia is a C++ library with Python bindings for audio analysis and audio-based
music information retrieval. The library contains an extensive collection of
reusable algorithms which implement audio input/output functionality, standard
digital signal processing blocks, statistical characterization of data, and a
large set of spectral, temporal, tonal and high-level music descriptors.

This package contains the high-level classifier models for libessentia.

%prep
%setup -q -n %{name}-%{version}
#%%patch -p1 -P 0
%patch -p1 -P 1
%patch -p1 -P 2
cp %{SOURCE1} waf
sed -ie "1s/python$/python3/" waf

chmod -x Changelog
tar zxvf %{SOURCE2}

%build
export LANG=C.UTF8
./waf configure --prefix=/usr/ --libdir=%{_libdir} \
                        --with-python --python=/usr/bin/python3 \
                        --with-cpptests --with-examples --with-vamp --with-gaia \
%ifarch aarch64 %{arm}
                        --no-msse \
%endif
                        %{nil}
#./waf configure --prefix=/usr/ --with-python \
#                        --with-cpptests --with-examples --with-vamp --with-gaia
./waf

%install
export LANG=C.UTF8
./waf install --destdir=%{buildroot}
install -d %{buildroot}%{_bindir}
install --mode 755 src/python/essentia_extractor %{buildroot}%{_bindir}/

cd essentia-extractor-svm_models-%{model_version}
mkdir -p %{buildroot}/%{_datadir}/essentia-extractor-svm_models
install --mode 664 * %{buildroot}/%{_datadir}/essentia-extractor-svm_models/

%post
%postun

%files
%license COPYING.txt
%doc Changelog README.md

%files -n libessentia0
%{_libdir}/libessentia.so

%files devel
/usr/include/essentia
%{_libdir}/pkgconfig/essentia.pc

%files -n %{python_flavor}-essentia
%{python3_sitearch}/essentia
%{_bindir}/essentia_extractor

%files tools
%{_bindir}/essentia_standard_*
%{_bindir}/essentia_streaming_*

%files vamp
%{_libdir}/vamp/libvamp_essentia.so

%files models
%{_datadir}/essentia-extractor-svm_models/

%changelog

openSUSE Build Service is sponsored by