This file is part of MXE. See LICENSE.md for licensing information. Contains ad hoc patches for cross building. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 5 Jan 2016 21:28:06 -0500 Subject: [PATCH 1/8] 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 Date: Tue, 5 Jan 2016 21:47:01 -0500 Subject: [PATCH 2/8] 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 Date: Tue, 5 Jan 2016 22:48:20 -0500 Subject: [PATCH 3/8] 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 Date: Tue, 5 Jan 2016 22:18:21 -0500 Subject: [PATCH 4/8] wscript: Install static library diff --git a/src/wscript_build b/src/wscript_build 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 Date: Tue, 5 Jan 2016 21:15:37 -0500 Subject: [PATCH 5/8] 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', lib = 'm', target = 'lib_objects') -# build libaubio.so (cshlib) and/or libaubio.a (cstlib) -if ctx.env['DEST_OS'] in ['ios', 'iosimulator']: - build_features = ['cstlib'] -elif ctx.env['DEST_OS'] in ['win32', 'win64']: - build_features = ['cshlib'] -else: #linux, darwin, android, mingw, ... - build_features = ['cshlib', 'cstlib'] +build_features = [] +if ctx.env.HAVE_SHARED: + build_features += ['cshlib'] +if ctx.env.HAVE_STATIC: + build_features += ['cstlib'] for target in build_features: ctx(features = 'c ' + target, diff --git a/wscript b/wscript index 1111111..2222222 100644 --- a/wscript +++ b/wscript @@ -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 (default)', + help_disable_str = 'do not compile shared library') + add_option_enable_disable(ctx, 'static', default = True, + help_str = 'compile static libraries (default)', + help_disable_str = 'do not compile static library') + ctx.add_option('--with-target-platform', type='string', help='set target platform for cross-compilation', dest='target_platform') @@ -99,7 +106,10 @@ def configure(ctx): else: 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 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 5 Jan 2016 21:25:46 -0500 Subject: [PATCH 6/8] Add static deps to pkgconfig file diff --git a/aubio.pc.in b/aubio.pc.in index 1111111..2222222 100644 --- a/aubio.pc.in +++ b/aubio.pc.in @@ -6,5 +6,7 @@ includedir=@includedir@ Name: aubio Description: a library for audio labelling Version: @VERSION@ +Requires.private: @PCREQUIRES@ Libs: -L${libdir} -laubio +Libs.private: @PCLIBS@ Cflags: -I${includedir} diff --git a/wscript b/wscript index 1111111..2222222 100644 --- a/wscript +++ b/wscript @@ -183,6 +183,8 @@ def configure(ctx): if (ctx.options.enable_complex == True): ctx.check(header_name='complex.h') + pcrequires = [] + pclibs = [] # check for fftw3 if (ctx.options.enable_fftw3 != False or ctx.options.enable_fftw3f != False): # one of fftwf or fftw3f @@ -204,9 +206,13 @@ def configure(ctx): # fftw not enabled, use vDSP or ooura if 'HAVE_FFTW3F' in ctx.env: ctx.msg('Checking for FFT implementation', 'fftw3f') + pcrequires += ['fftw3f >= 3.0.0'] + pclibs += ['-pthread'] ctx.env.LINKFLAGS += ['-pthread'] elif 'HAVE_FFTW3' in ctx.env: ctx.msg('Checking for FFT implementation', 'fftw3') + pcrequires += ['fftw3 >= 3.0.0'] + pclibs += ['-pthread'] ctx.env.LINKFLAGS += ['-pthread'] elif 'HAVE_ACCELERATE' in ctx.env: ctx.msg('Checking for FFT implementation', 'vDSP') @@ -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: + 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: + 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: + pcrequires += ['jack'] # check for libav if (ctx.options.enable_avcodec != False): @@ -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') + pcrequires += ['libavcodec >= 54.35.0', 'libavformat >= 52.3.0', + 'libavutil >= 52.3.0', 'libavresample >= 1.0.1'] else: ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW') + ctx.env.PCREQUIRES = ', '.join(pcrequires) + ctx.env.PCLIBS = ', '.join(pclibs) ctx.define('HAVE_WAVREAD', 1) ctx.define('HAVE_WAVWRITE', 1) From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 5 Jan 2016 21:27:05 -0500 Subject: [PATCH 7/8] disable tests and examples diff --git a/wscript b/wscript index 1111111..2222222 100644 --- a/wscript +++ b/wscript @@ -297,9 +297,9 @@ def build(bld): bld.recurse('src') if bld.env['DEST_OS'] not in ['ios', 'iosimulator']: pass - if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']: - bld.recurse('examples') - bld.recurse('tests') + #if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']: + # bld.recurse('examples') + # bld.recurse('tests') bld( source = 'aubio.pc.in' ) From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Sun, 25 Feb 2018 14:23:25 +0000 Subject: [PATCH 8/8] Fix build with FFmpeg 4.0 diff --git a/src/io/source_avcodec.c b/src/io/source_avcodec.c index 1111111..2222222 100644 --- a/src/io/source_avcodec.c +++ b/src/io/source_avcodec.c @@ -34,7 +34,11 @@ #include "fmat.h" #include "source_avcodec.h" +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56, 56, 0) #define AUBIO_AVCODEC_MAX_BUFFER_SIZE FF_MIN_BUFFER_SIZE +#else +#define AUBIO_AVCODEC_MAX_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE +#endif struct _aubio_source_avcodec_t { uint_t hop_size;