Merge pull request #1139 from TimothyGu/aubio

Fix aubio
This commit is contained in:
Timothy Gu 2016-01-07 19:09:52 -08:00
commit 03cbbcf46d
3 changed files with 143 additions and 78 deletions

View File

@ -1,12 +1,104 @@
From a34301d5fcdb6187dceb508bab341727ec57d0b4 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Fri, 14 Nov 2014 16:37:52 -0500
Subject: [PATCH 1/4] Add options for enabling shared and/or static libraries
This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Brossier <piem@piem.org>
Date: Tue, 5 Jan 2016 21:28:06 -0500
Subject: [PATCH] wscript: check HAVE_AV* from ctx.env
From https://github.com/aubio/aubio/commit/eb6899125ac83900710180c02b94bc593a1426d2
diff --git a/wscript b/wscript
index 1111111..2222222 100644
--- a/wscript
+++ b/wscript
@@ -226,7 +226,7 @@ def configure(ctx):
args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False)
ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False)
- if all ( 'HAVE_' + i in ctx.env.define_key
+ if all ( 'HAVE_' + i in ctx.env
for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
ctx.define('HAVE_LIBAV', 1)
ctx.msg('Checking for all libav libraries', 'yes')
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Tue, 5 Jan 2016 21:47:01 -0500
Subject: [PATCH] wscript: check more variables from ctx.env
diff --git a/wscript b/wscript
index 1111111..2222222 100644
--- a/wscript
+++ b/wscript
@@ -192,11 +192,11 @@ def configure(ctx):
ctx.define('HAVE_FFTW3', 1)
# fftw not enabled, use vDSP or ooura
- if 'HAVE_FFTW3F' in ctx.env.define_key:
+ if 'HAVE_FFTW3F' in ctx.env:
ctx.msg('Checking for FFT implementation', 'fftw3f')
- elif 'HAVE_FFTW3' in ctx.env.define_key:
+ elif 'HAVE_FFTW3' in ctx.env:
ctx.msg('Checking for FFT implementation', 'fftw3')
- elif 'HAVE_ACCELERATE' in ctx.env.define_key:
+ elif 'HAVE_ACCELERATE' in ctx.env:
ctx.msg('Checking for FFT implementation', 'vDSP')
else:
ctx.msg('Checking for FFT implementation', 'ooura')
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Tue, 5 Jan 2016 22:48:20 -0500
Subject: [PATCH] wscript: fftw3 support requires pthreads
diff --git a/wscript b/wscript
index 1111111..2222222 100644
--- a/wscript
+++ b/wscript
@@ -194,8 +194,10 @@ def configure(ctx):
# fftw not enabled, use vDSP or ooura
if 'HAVE_FFTW3F' in ctx.env:
ctx.msg('Checking for FFT implementation', 'fftw3f')
+ ctx.env.LINKFLAGS += ['-pthread']
elif 'HAVE_FFTW3' in ctx.env:
ctx.msg('Checking for FFT implementation', 'fftw3')
+ ctx.env.LINKFLAGS += ['-pthread']
elif 'HAVE_ACCELERATE' in ctx.env:
ctx.msg('Checking for FFT implementation', 'vDSP')
else:
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Tue, 5 Jan 2016 22:18:21 -0500
Subject: [PATCH] wscript: Install static library
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/src/wscript_build b/src/wscript_build
index 94b2062..1a72e4a 100644
index 1111111..2222222 100644
--- a/src/wscript_build
+++ b/src/wscript_build
@@ -38,3 +38,7 @@ for target in build_features:
ctx.install_files('${PREFIX}/include/aubio/',
ctx.path.ant_glob('**/*.h', excl = ['**_priv.h', 'config.h']),
relative_trick=True)
+
+# install static libs
+from waflib.Tools.c import cstlib
+cstlib.inst_to = '${LIBDIR}'
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Tue, 5 Jan 2016 21:15:37 -0500
Subject: [PATCH] Add options for enabling shared and/or static libraries
diff --git a/src/wscript_build b/src/wscript_build
index 1111111..2222222 100644
--- a/src/wscript_build
+++ b/src/wscript_build
@@ -18,13 +18,11 @@ ctx(features = 'c',
@ -21,23 +113,23 @@ index 94b2062..1a72e4a 100644
-else: #linux, darwin, android, mingw, ...
- build_features = ['cshlib', 'cstlib']
+build_features = []
+if ctx.options.enable_shared:
+if ctx.env.HAVE_SHARED:
+ build_features += ['cshlib']
+if ctx.options.enable_static:
+if ctx.env.HAVE_STATIC:
+ build_features += ['cstlib']
for target in build_features:
ctx(features = 'c ' + target,
diff --git a/wscript b/wscript
index 83ad7b8..7013f12 100644
index 1111111..2222222 100644
--- a/wscript
+++ b/wscript
@@ -73,6 +73,13 @@ def options(ctx):
help_str = 'compile in double precision mode',
help_disable_str = 'compile in single precision mode (default)')
@@ -76,6 +76,13 @@ def options(ctx):
help_str = 'build fat binaries (darwin only)',
help_disable_str = 'do not build fat binaries (default)')
+ add_option_enable_disable(ctx, 'shared', default = True,
+ help_str = 'compile shared libraries (defaut)',
+ help_str = 'compile shared libraries (default)',
+ help_disable_str = 'do not compile shared library')
+ add_option_enable_disable(ctx, 'static', default = True,
+ help_str = 'compile static libraries (default)',
@ -46,45 +138,27 @@ index 83ad7b8..7013f12 100644
ctx.add_option('--with-target-platform', type='string',
help='set target platform for cross-compilation', dest='target_platform')
--
1.9.1
From e133535438a965b3f6f7f0cac5cb5c062c07829f Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Fri, 14 Nov 2014 16:39:51 -0500
Subject: [PATCH 2/4] fftw3 support requires -pthread
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/wscript b/wscript
index 7013f12..052fb27 100644
--- a/wscript
+++ b/wscript
@@ -197,8 +197,10 @@ def configure(ctx):
# fftw not enabled, use vDSP or ooura
if 'HAVE_FFTW3F' in ctx.env.define_key:
ctx.msg('Checking for FFT implementation', 'fftw3f')
+ ctx.env.LINKFLAGS += ['-pthread']
elif 'HAVE_FFTW3' in ctx.env.define_key:
ctx.msg('Checking for FFT implementation', 'fftw3')
+ ctx.env.LINKFLAGS += ['-pthread']
elif 'HAVE_ACCELERATE' in ctx.env.define_key:
ctx.msg('Checking for FFT implementation', 'vDSP')
@@ -99,7 +106,10 @@ def configure(ctx):
else:
--
1.9.1
ctx.env.CFLAGS += ['-Wall']
- if target_platform not in ['win32', 'win64']:
+ ctx.env.HAVE_SHARED = int(ctx.options.enable_shared)
+ ctx.env.HAVE_STATIC = int(ctx.options.enable_static)
+
+ if not ctx.options.enable_shared and target_platform not in ['win32', 'win64']:
ctx.env.CFLAGS += ['-fPIC']
else:
ctx.define('HAVE_WIN_HACKS', 1)
From 16fda40e02065b670b63e193a453357051ca9c33 Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Fri, 14 Nov 2014 16:40:53 -0500
Subject: [PATCH 3/4] Add static deps to pkgconfig file
Date: Tue, 5 Jan 2016 21:25:46 -0500
Subject: [PATCH] Add static deps to pkgconfig file
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/aubio.pc.in b/aubio.pc.in
index 301a1b5..0cd2281 100644
index 1111111..2222222 100644
--- a/aubio.pc.in
+++ b/aubio.pc.in
@@ -6,5 +6,7 @@ includedir=@includedir@
@ -96,10 +170,10 @@ index 301a1b5..0cd2281 100644
+Libs.private: @PCLIBS@
Cflags: -I${includedir}
diff --git a/wscript b/wscript
index 052fb27..424bcf8 100644
index 1111111..2222222 100644
--- a/wscript
+++ b/wscript
@@ -176,6 +176,8 @@ def configure(ctx):
@@ -183,6 +183,8 @@ def configure(ctx):
if (ctx.options.enable_complex == True):
ctx.check(header_name='complex.h')
@ -108,44 +182,44 @@ index 052fb27..424bcf8 100644
# check for fftw3
if (ctx.options.enable_fftw3 != False or ctx.options.enable_fftw3f != False):
# one of fftwf or fftw3f
@@ -197,9 +199,13 @@ def configure(ctx):
@@ -204,9 +206,13 @@ def configure(ctx):
# fftw not enabled, use vDSP or ooura
if 'HAVE_FFTW3F' in ctx.env.define_key:
if 'HAVE_FFTW3F' in ctx.env:
ctx.msg('Checking for FFT implementation', 'fftw3f')
+ pcrequires += ['fftw3f >= 3.0.0']
+ pclibs += ['-lpthread']
+ pclibs += ['-pthread']
ctx.env.LINKFLAGS += ['-pthread']
elif 'HAVE_FFTW3' in ctx.env.define_key:
elif 'HAVE_FFTW3' in ctx.env:
ctx.msg('Checking for FFT implementation', 'fftw3')
+ pcrequires += ['fftw3 >= 3.0.0']
+ pclibs += ['-lpthread']
+ pclibs += ['-pthread']
ctx.env.LINKFLAGS += ['-pthread']
elif 'HAVE_ACCELERATE' in ctx.env.define_key:
elif 'HAVE_ACCELERATE' in ctx.env:
ctx.msg('Checking for FFT implementation', 'vDSP')
@@ -210,16 +216,22 @@ def configure(ctx):
@@ -217,16 +223,22 @@ def configure(ctx):
if (ctx.options.enable_sndfile != False):
ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
args = '--cflags --libs', mandatory = False)
+ if 'HAVE_SNDFILE' in ctx.env.define_key:
+ if 'HAVE_SNDFILE' in ctx.env:
+ pcrequires += ['sndfile >= 1.0.4']
# check for libsamplerate
if (ctx.options.enable_samplerate != False):
ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
args = '--cflags --libs', mandatory = False)
+ if 'HAVE_SAMPLERATE' in ctx.env.define_key:
+ if 'HAVE_SAMPLERATE' in ctx.env:
+ pcrequires += ['samplerate >= 0.0.15']
# check for jack
if (ctx.options.enable_jack != False):
ctx.check_cfg(package = 'jack',
args = '--cflags --libs', mandatory = False)
+ if 'HAVE_JACK' in ctx.env.define_key:
+ if 'HAVE_JACK' in ctx.env:
+ pcrequires += ['jack']
# check for libav
if (ctx.options.enable_avcodec != False):
@@ -235,9 +247,13 @@ def configure(ctx):
@@ -242,9 +254,13 @@ def configure(ctx):
for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
ctx.define('HAVE_LIBAV', 1)
ctx.msg('Checking for all libav libraries', 'yes')
@ -159,22 +233,18 @@ index 052fb27..424bcf8 100644
ctx.define('HAVE_WAVREAD', 1)
ctx.define('HAVE_WAVWRITE', 1)
--
1.9.1
From 407863716f05ffca5b2241d7dcedb3d1c1ae87ad Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Fri, 14 Nov 2014 16:45:04 -0500
Subject: [PATCH 4/4] [MXE] disable tests and examples
Date: Tue, 5 Jan 2016 21:27:05 -0500
Subject: [PATCH] [MXE] disable tests and examples
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/wscript b/wscript
index 424bcf8..7f135b5 100644
index 1111111..2222222 100644
--- a/wscript
+++ b/wscript
@@ -290,9 +290,9 @@ def build(bld):
@@ -297,9 +297,9 @@ def build(bld):
bld.recurse('src')
if bld.env['DEST_OS'] not in ['ios', 'iosimulator']:
pass
@ -182,11 +252,8 @@ index 424bcf8..7f135b5 100644
- bld.recurse('examples')
- bld.recurse('tests')
+ #if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']:
+ #bld.recurse('examples')
+ #bld.recurse('tests')
+ # bld.recurse('examples')
+ # bld.recurse('tests')
bld( source = 'aubio.pc.in' )
--
1.9.1

View File

@ -29,7 +29,7 @@ define $(PKG)_BUILD
--prefix='$(PREFIX)/$(TARGET)' \
--enable-fftw3f \
$(if $(BUILD_STATIC), \
--enable-static --disable-shared, \
--enable-static --disable-shared --disable-jack, \
--disable-static --enable-shared)
# disable txt2man and doxygen
@ -37,10 +37,6 @@ define $(PKG)_BUILD
cd '$(1)' && '$(PREFIX)/$(BUILD)/bin/waf' build install
# It is not trivial to adjust the installation in waf-based builds
$(if $(BUILD_STATIC), \
$(INSTALL) -m644 '$(1)/build/src/libaubio.a' '$(PREFIX)/$(TARGET)/lib')
'$(TARGET)-gcc' \
-W -Wall -Werror -ansi -pedantic \
'$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-aubio.exe' \

View File

@ -28,3 +28,5 @@ define $(PKG)_BUILD
--prefix='$(PREFIX)/$(TARGET)' \
--dist-target=mingw
endef
$(PKG)_BUILD_STATIC =