From f1f9ca4519fa899b90959d28d58aa5006e25de95 Mon Sep 17 00:00:00 2001 From: Martchus Date: Wed, 19 Dec 2018 16:38:32 +0000 Subject: [PATCH] Add essentia-git Adjustments compared to the AUR version: * Add support for more architectures * Shorten description * Fix formatting (standard for PKGBUILDs is 2 spaces) * Use makeflags * Build as shared library --- ...skip-adding-debug-optimization-flags.patch | 38 ++++++++++++ .../git/0002-Allow-to-skip-msse-flags.patch | 45 ++++++++++++++ essentia/git/PKGBUILD | 62 +++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 essentia/git/0001-Allow-to-skip-adding-debug-optimization-flags.patch create mode 100644 essentia/git/0002-Allow-to-skip-msse-flags.patch create mode 100644 essentia/git/PKGBUILD diff --git a/essentia/git/0001-Allow-to-skip-adding-debug-optimization-flags.patch b/essentia/git/0001-Allow-to-skip-adding-debug-optimization-flags.patch new file mode 100644 index 00000000..78d74a23 --- /dev/null +++ b/essentia/git/0001-Allow-to-skip-adding-debug-optimization-flags.patch @@ -0,0 +1,38 @@ +From 26fcda33ac3864d2d5c9f307708881018f6b5c78 Mon Sep 17 00:00:00 2001 +From: Martchus +Date: Wed, 19 Dec 2018 10:28:03 +0100 +Subject: [PATCH 1/2] Allow to skip adding debug/optimization flags + +--- + wscript | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/wscript b/wscript +index 3916036b..4be3812c 100644 +--- a/wscript ++++ b/wscript +@@ -44,7 +44,7 @@ def options(ctx): + + ctx.add_option('--mode', action='store', + dest='MODE', default="release", +- help='debug or release') ++ help='debug, release or default') + + ctx.add_option('--std', action='store', + dest='STD', default='c++11', +@@ -140,8 +140,11 @@ def configure(ctx): + print ('→ Building in release mode') + ctx.env.CXXFLAGS += ['-O2'] # '-march=native' ] # '-msse3', '-mfpmath=sse' ] + ++ elif ctx.options.MODE == 'default': ++ pass ++ + else: +- raise ValueError('mode should be either "debug" or "release"') ++ raise ValueError('mode should be either "debug" or "release" or "default"') + + if not ctx.options.CROSS_COMPILE_MINGW32 and sys.platform != 'win32': + # required if we want to use libessentia.a to be linked in the python bindings +-- +2.20.1 + diff --git a/essentia/git/0002-Allow-to-skip-msse-flags.patch b/essentia/git/0002-Allow-to-skip-msse-flags.patch new file mode 100644 index 00000000..7a246b20 --- /dev/null +++ b/essentia/git/0002-Allow-to-skip-msse-flags.patch @@ -0,0 +1,45 @@ +From 7a4520834d8a6dc69a54daef0bef3590e71681e3 Mon Sep 17 00:00:00 2001 +From: Martchus +Date: Wed, 19 Dec 2018 10:28:23 +0100 +Subject: [PATCH 2/2] Allow to skip msse flags + +This makes sense when building for other platforms +than x86. +--- + wscript | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/wscript b/wscript +index 4be3812c..3b7c1e7e 100644 +--- a/wscript ++++ b/wscript +@@ -54,6 +54,10 @@ def options(ctx): + dest='ARCH', default="x64", + help='Target architecture when compiling on OSX: i386, x64 or FAT') + ++ ctx.add_option('--no-msse', action='store_true', ++ dest='NO_MSSE', default=False, ++ help='never add compiler flags for msse') ++ + ctx.add_option('--cross-compile-mingw32', action='store_true', + dest='CROSS_COMPILE_MINGW32', default=False, + help='cross-compile for windows using mingw32 on linux') +@@ -95,6 +99,7 @@ def configure(ctx): + ctx.env.ALGOINCLUDE = [] + ctx.env.INCLUDE_ALGOS = ctx.options.INCLUDE_ALGOS + ctx.env.FFT = ctx.options.FFT ++ ctx.env.NO_MSSE = ctx.options.NO_MSSE + + + if ctx.options.CROSS_COMPILE_MINGW32: +@@ -126,6 +131,7 @@ def configure(ctx): + if (not ctx.options.EMSCRIPTEN and + not ctx.options.CROSS_COMPILE_ANDROID and + not ctx.options.CROSS_COMPILE_IOS and ++ not ctx.options.NO_MSSE and + sys.platform != 'win32'): + ctx.env.CXXFLAGS += ['-msse', '-msse2', '-mfpmath=sse'] + +-- +2.20.1 + diff --git a/essentia/git/PKGBUILD b/essentia/git/PKGBUILD new file mode 100644 index 00000000..9145815d --- /dev/null +++ b/essentia/git/PKGBUILD @@ -0,0 +1,62 @@ +# Maintainer: Eugene Cherny +# Contributor: Martchus + +pkgname=essentia-git +pkgrel=1 +pkgver=r1956.c5ea2738 +pkgdesc='Library and tools for audio and music analysis, description and synthesis' +arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64') +url="http://essentia.upf.edu/documentation/" +license=('AGPL') +makedepends=('git' 'python' 'glibc') +depends=('fftw' 'ffmpeg' 'libsamplerate' 'taglib' 'libyaml' + 'python' 'python-numpy' 'python-yaml' 'chromaprint') +provides=('essentia') +conflicts=('essentia' 'essentia-acousticbrainz' + 'lib32-essentia-acousticbrainz') +source=('git+https://github.com/MTG/essentia.git#branch=master' + '0001-Allow-to-skip-adding-debug-optimization-flags.patch' + '0002-Allow-to-skip-msse-flags.patch') +sha256sums=('SKIP' + '25e29d35bee35a6229ed6e0736503ca8aefca13d022e3be4a9798342d01b2943' + 'b715673958026bc26e459c0dba4adc18fd287f095fa1afc2a6e880d4f4c17102') + +pkgver() { + cd "$srcdir/essentia" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd "$srcdir/essentia" + patch -p1 -i ../0001-Allow-to-skip-adding-debug-optimization-flags.patch + patch -p1 -i ../0002-Allow-to-skip-msse-flags.patch +} + +build() { + cd "$srcdir/essentia" + + local platform_flags= + [[ $CARCH != x86_64 ]] && [[ $CARCH != i686 ]] && \ + platform_flags+='--no-msse' + + ./waf configure \ + --mode=default \ + --with-cpptests \ + --with-examples \ + --with-python \ + --python=$(which python) \ + $platform_flags \ + --prefix="$pkgdir/usr" + ./waf $MAKEFLAGS +} + +#check() { +# cd "$srcdir/$pkgname" +# ./waf run_tests +# ./waf run_python_tests +#} + +package() { + cd "$srcdir/essentia" + ./waf install +}