From f01d74ae1b6a91235f82f87baec81e437ac62760 Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" Date: Thu, 14 Mar 2024 14:38:29 -0300 Subject: soundtouch: Update to 2.3.2 and update the Meson port based on CMake Part-of: --- recipes/soundtouch.recipe | 39 ++- recipes/soundtouch/0001-Add-Meson-build.patch | 363 +++++++++++++++++++++ .../0001-Add-minimal-meson-build-system.patch | 211 ------------ .../0001-Export-symbols-for-a-DLL-correctly.patch | 136 -------- .../0008-Fix-compilation-with-clang.patch | 34 -- 5 files changed, 387 insertions(+), 396 deletions(-) create mode 100644 recipes/soundtouch/0001-Add-Meson-build.patch delete mode 100644 recipes/soundtouch/0001-Add-minimal-meson-build-system.patch delete mode 100644 recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch delete mode 100644 recipes/soundtouch/0008-Fix-compilation-with-clang.patch diff --git a/recipes/soundtouch.recipe b/recipes/soundtouch.recipe index f2f6d367..53ebf67e 100644 --- a/recipes/soundtouch.recipe +++ b/recipes/soundtouch.recipe @@ -4,32 +4,41 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'soundtouch' - version = '2.1.0' + version = '2.3.2' btype = BuildType.MESON stype = SourceType.TARBALL - url = 'https://gitlab.com/soundtouch/soundtouch/-/archive/%(version)s/soundtouch-%(version)s.tar.gz' - tarball_checksum = '454712b08bf758f6a4c0df8821350c323e5b274443a20e21d193d17c5dc3d0d5' - licenses = [License.LGPLv2_1Plus] + url = 'https://codeberg.org/soundtouch/soundtouch/archive/%(version)s.tar.gz' + tarball_dirname = 'soundtouch' + tarball_checksum = 'ed714f84a3e748de87b24f385ec69d3bdc51ca47b7f4710d2048b84b2761e7ff' patches = [ - 'soundtouch/0008-Fix-compilation-with-clang.patch', - 'soundtouch/0001-Add-minimal-meson-build-system.patch', - 'soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch', - ] + # https://wrapdb.mesonbuild.com/v2/soundtouch_2.3.2-1/get_patch + f'{name}/0001-Add-Meson-build.patch', + ] + + licenses = [License.LGPLv2_1Plus] files_libs = ['libSoundTouch'] files_devel = ['include/soundtouch', '%(libdir)s/pkgconfig/soundtouch.pc'] - def prepare (self): - if self.config.target_platform == Platform.ANDROID: - self.append_env('CXXFLAGS', '-fexceptions -DST_NO_EXCEPTION_HANDLING') + def prepare(self): + if self.config.platform == Platform.WINDOWS: + # tar and bsdtar fail extracting the symbolic link in + # source/SoundTouchDLL/LazarusTest/libSoundTouchDll.so + # as it's a placeholder + self.force_tarfile = True + # FIXME: change to self.using_msvc() once the Windows cross + # builds update their GCC + if self.config.target_platform == Platform.WINDOWS: + # This library doesn't use export macros except on SoundTouchDLL + self.library_type = LibraryType.STATIC def post_install (self): dependency_libs = [] if self.config.target_platform == Platform.ANDROID: + dependency_libs += ['-lm', '-llog'] + elif self.config.target_platform == Platform.LINUX: dependency_libs += ['-lm'] - - lib = LibtoolLibrary('SoundTouch', None, None, None, self.config.libdir, - self.config.target_platform, deps=dependency_libs) - lib.save() + LibtoolLibrary('SoundTouch', 2, 3, 2, self.config.libdir, + self.config.target_platform, deps=dependency_libs).save() super().post_install() diff --git a/recipes/soundtouch/0001-Add-Meson-build.patch b/recipes/soundtouch/0001-Add-Meson-build.patch new file mode 100644 index 00000000..ab7e279f --- /dev/null +++ b/recipes/soundtouch/0001-Add-Meson-build.patch @@ -0,0 +1,363 @@ +From f871f346f9af397a2e0ced987640fe9751319298 Mon Sep 17 00:00:00 2001 +From: "L. E. Segovia" +Date: Fri, 15 Mar 2024 21:40:37 -0300 +Subject: [PATCH 1/1] Add Meson build + +Source: https://wrapdb.mesonbuild.com/v2/soundtouch_2.3.2-1/get_patch +--- + include/meson.build | 19 +++++ + meson.build | 121 ++++++++++++++++++++++++++++ + meson_options.txt | 9 +++ + source/Android-lib/meson.build | 12 +++ + source/SoundStretch/meson.build | 16 ++++ + source/SoundTouch/meson.build | 48 +++++++++++ + source/SoundTouchDLL/meson.build | 47 +++++++++++ + source/SoundTouchDLL/meson/afxres.h | 1 + + source/meson.build | 6 ++ + 9 files changed, 279 insertions(+) + create mode 100644 include/meson.build + create mode 100644 meson.build + create mode 100644 meson_options.txt + create mode 100644 source/Android-lib/meson.build + create mode 100644 source/SoundStretch/meson.build + create mode 100644 source/SoundTouch/meson.build + create mode 100644 source/SoundTouchDLL/meson.build + create mode 100644 source/SoundTouchDLL/meson/afxres.h + create mode 100644 source/meson.build + +diff --git a/include/meson.build b/include/meson.build +new file mode 100644 +index 0000000..d19e1b3 +--- /dev/null ++++ b/include/meson.build +@@ -0,0 +1,19 @@ ++soundtouch_headers = files( ++ 'BPMDetect.h', ++ 'FIFOSampleBuffer.h', ++ 'FIFOSamplePipe.h', ++ 'STTypes.h', ++ 'SoundTouch.h', ++) ++ ++soundtouch_config_h = configure_file( ++ output: 'soundtouch_config.h', ++ configuration: conf, ++) ++ ++soundtouch_includes = include_directories('.') ++ ++install_headers( ++ [soundtouch_headers, soundtouch_config_h], ++ subdir: 'soundtouch' ++) +diff --git a/meson.build b/meson.build +new file mode 100644 +index 0000000..5372da2 +--- /dev/null ++++ b/meson.build +@@ -0,0 +1,121 @@ ++project( ++ 'soundtouch', ++ 'c', 'cpp', ++ version: '2.3.2', ++ license: 'LGPL-2.1-or-later', ++ default_options: [ ++ 'debug=true', ++ 'optimization=3', ++ 'c_std=c11', ++ # to avoid Meson's warning under MSVC ++ 'cpp_std=c++14', ++ # See below ("ST_NO_EXCEPTION_HANDLING") for the rationale ++ 'cpp_eh=default', ++ 'pkgconfig.relocatable=true', ++ ], ++ meson_version: '>= 0.52', ++) ++ ++cpp = meson.get_compiler('cpp') ++system = host_machine.system() ++cpu = host_machine.cpu() ++ ++openmp = dependency('openmp', required: get_option('openmp')) ++m = cpp.find_library('m', required: false) ++ ++soundtouch_args = [] ++ ++conf = configuration_data() ++ ++# Autotools applies -Ofast (implies -O3 -ffast-math) to allow gcc ++# autovectorization generate effective SIMD code. ++# I prefer here to do so only with these to avoid surprises ++# at lower levels. -- amyspark ++if get_option('optimization') in ['2', '3', 's'] ++ soundtouch_args += cpp.get_supported_arguments( ++ '/fp:fast', ++ '-ffast-math', ++ ) ++endif ++ ++is_android_softfp = cpp.compiles(''' ++#if defined(__SOFTFP__) && defined(ANDROID) ++#else ++#error "Not under Android soft FP" ++#endif''', name: 'targeting Android with soft float implementation') ++ ++if get_option('integer_samples') ++ conf.set('SOUNDTOUCH_INTEGER_SAMPLES', 1) ++ soundtouch_args += ['-DSOUNDTOUCH_INTEGER_SAMPLES=1'] ++else ++ conf.set('SOUNDTOUCH_FLOAT_SAMPLES', 1) ++ soundtouch_args += ['-DSOUNDTOUCH_FLOAT_SAMPLES=1'] ++endif ++ ++neon_cpu = cpu in ['arm', 'aarch64'] ++ ++# Use ARM instruction set instead of Thumb for improved calculation performance in ARM CPUs ++if cpu == 'arm' and system == 'android' ++ if cpp.get_define('__thumb__') != '' ++ soundtouch_args += cpp.get_supported_arguments('-marm') ++ endif ++endif ++ ++if neon_cpu and get_option('neon') ++ conf.set('SOUNDTOUCH_USE_NEON', 1) ++ soundtouch_args += ['-DSOUNDTOUCH_USE_NEON=1'] ++ soundtouch_args += cpp.get_supported_arguments('-mfpu=neon') ++endif ++ ++# GCC, by default, handles exceptions in C++ sources as /EHsc, allowing ++# exceptions intra C++ code, and terminating the app on hitting a C function's ++# stack. ++# Grep ST_NO_EXCEPTION_HANDLING and see: ++# https://learn.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=msvc-170 ++# https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fexceptions ++# ++# However, -fexceptions in Application.mk must be manually injected, as ++# their toolchain does not add it for historical reasons. ++# https://developer.android.com/ndk/guides/cpp-support?hl=es-419 ++if get_option('cpp_eh') in ['none'] ++ soundtouch_args += ['-DST_NO_EXCEPTION_HANDLING'] ++elif system == 'android' ++ soundtouch_args += cpp.get_supported_arguments('-fexceptions') ++endif ++ ++# Work around Android Clang / MS Clang not defining __GNUC__ ++# This affects cpuid detection in x86 and x64 targets ++# Amyspark: careful with this flag, it may interfere with STTypes.h ++if cpp.get_define('__clang__') != '' and cpp.get_define('__GNUC__') == '' ++ soundtouch_args += cpp.get_supported_arguments('-fgnuc-version=10') ++endif ++ ++# Amyspark: Turn off certain warnings that can trigger Werror ++soundtouch_args += cpp.get_supported_arguments( ++ '-Wno-unused-variable', ++ '-Wno-sign-compare', ++ '-Wno-unused-but-set-variable', ++ '-Wno-inconsistent-missing-override', ++ '-Wno-unused-const-variable', ++) ++ ++if cpu == 'x86' ++ soundtouch_args += cpp.get_supported_arguments('-mstackrealign') ++endif ++ ++deps = [ ++ openmp, ++ m, ++] ++ ++subdir('include') ++subdir('source') ++ ++pkg = import('pkgconfig') ++ ++pkg.generate( ++ soundtouch_lib, ++ name: 'SoundTouch', ++ description: 'SoundTouch is an open-source audio processing library for changing the Tempo, Pitch and Playback Rates of audio streams or files', ++ filebase: 'soundtouch' ++) +diff --git a/meson_options.txt b/meson_options.txt +new file mode 100644 +index 0000000..091e335 +--- /dev/null ++++ b/meson_options.txt +@@ -0,0 +1,9 @@ ++option('integer_samples', type: 'boolean', value: false, description: 'Use integers instead of floats for samples') ++ ++option('neon', type: 'boolean', value: true, description: 'Use ARM Neon SIMD instructions if in ARM CPU') ++ ++option('soundtouch_dll', type: 'boolean', value: true, description: 'Build SoundTouchDLL C wrapper library.') ++ ++option('soundstretch', type: 'boolean', value: false, description: 'Build soundstretch command line utility.') ++ ++option('openmp', type: 'feature', value: 'disabled', description: 'Use parallel multicore calculation through OpenMP') +diff --git a/source/Android-lib/meson.build b/source/Android-lib/meson.build +new file mode 100644 +index 0000000..62f15ea +--- /dev/null ++++ b/source/Android-lib/meson.build +@@ -0,0 +1,12 @@ ++soundtouch_sources_android = files( ++ 'jni/soundtouch-jni.cpp', ++) ++ ++log = cpp.find_library('log', required: true) ++ ++deps += [log] ++ ++soundtouch_args += cpp.get_supported_arguments( ++ '-fdata-sections', ++ '-ffunction-sections', ++) +diff --git a/source/SoundStretch/meson.build b/source/SoundStretch/meson.build +new file mode 100644 +index 0000000..560ae59 +--- /dev/null ++++ b/source/SoundStretch/meson.build +@@ -0,0 +1,16 @@ ++soundstretch_sources = files( ++ 'main.cpp', ++ 'RunParameters.cpp', ++ 'WavFile.cpp', ++) ++ ++if get_option('soundstretch') ++ soundstretch_bin = executable( ++ 'soundstretch', ++ soundstretch_sources, ++ cpp_args: soundtouch_args, ++ include_directories: include_directories('.'), ++ dependencies: soundtouch_dep, ++ install: true, ++ ) ++endif +diff --git a/source/SoundTouch/meson.build b/source/SoundTouch/meson.build +new file mode 100644 +index 0000000..a4a246b +--- /dev/null ++++ b/source/SoundTouch/meson.build +@@ -0,0 +1,48 @@ ++soundtouch_sources = files( ++ 'AAFilter.cpp', ++ 'BPMDetect.cpp', ++ 'cpu_detect_x86.cpp', ++ 'FIFOSampleBuffer.cpp', ++ 'FIRFilter.cpp', ++ 'InterpolateCubic.cpp', ++ 'InterpolateLinear.cpp', ++ 'InterpolateShannon.cpp', ++ 'mmx_optimized.cpp', ++ 'PeakFinder.cpp', ++ 'RateTransposer.cpp', ++ 'SoundTouch.cpp', ++ 'sse_optimized.cpp', ++ 'TDStretch.cpp', ++) ++ ++# This library requires WINDOWS_EXPORT_ALL_SYMBOLS to export all the relevant ++# classes. That's beyond mindbending to do for C++, see how it's done: ++# https://github.com/Kitware/CMake/blob/master/Source/bindexplib.cxx#L237 ++if system in ['windows', 'cygwin'] ++ soundtouch_lib = static_library( ++ 'SoundTouch', ++ soundtouch_sources, ++ cpp_args: soundtouch_args, ++ dependencies: deps, ++ include_directories: soundtouch_includes, ++ install: true ++ ) ++else ++ soundtouch_lib = library( ++ 'SoundTouch', ++ soundtouch_sources, ++ cpp_args: soundtouch_args, ++ dependencies: deps, ++ include_directories: soundtouch_includes, ++ version: meson.project_version(), ++ # DO NOT CHANGE THIS, SEE ABOVE! ++ # Also the Android.mk file was designed for GCC, not Clang (API 17+) ++ gnu_symbol_visibility: 'default', ++ install: true ++ ) ++endif ++ ++soundtouch_dep = declare_dependency( ++ link_with: soundtouch_lib, ++ include_directories: soundtouch_includes, ++) +diff --git a/source/SoundTouchDLL/meson.build b/source/SoundTouchDLL/meson.build +new file mode 100644 +index 0000000..af142e5 +--- /dev/null ++++ b/source/SoundTouchDLL/meson.build +@@ -0,0 +1,47 @@ ++soundtouch_dll_sources = files( ++ 'SoundTouchDLL.cpp', ++) ++ ++soundtouch_dll_includes = files( ++ 'SoundTouchDLL.h', ++) ++ ++soundtouch_dll_include_directories = [include_directories('.')] ++ ++windows = import('windows') ++ ++if system in ['windows', 'cygwin'] ++ if not cpp.has_header('afxres.h') ++ # Work around lack of afxres.h (ATL/MFC component missing in MSVS) ++ soundtouch_dll_include_directories += [include_directories('meson')] ++ endif ++ ++ soundtouch_dll_sources += windows.compile_resources( ++ files( ++ 'SoundTouchDLL.rc' ++ ), ++ include_directories: soundtouch_dll_include_directories ++ ) ++endif ++ ++if get_option('soundtouch_dll') ++ soundtouch_dll_args = [soundtouch_args, '-DDLL_EXPORTS'] ++ ++ soundtouch_dll_lib = shared_library( ++ 'SoundTouchDLL', ++ soundtouch_dll_sources, ++ cpp_args: soundtouch_dll_args, ++ include_directories: soundtouch_dll_include_directories, ++ dependencies: soundtouch_dep, ++ gnu_symbol_visibility: 'inlineshidden', ++ ) ++ ++ soundtouch_dll_dep = declare_dependency( ++ link_with: soundtouch_dll_lib, ++ ) ++ ++ install_headers( ++ soundtouch_dll_includes, ++ subdir: 'soundtouch', ++ ) ++endif +diff --git a/source/SoundTouchDLL/meson/afxres.h b/source/SoundTouchDLL/meson/afxres.h +new file mode 100644 +index 0000000..f6d2545 +--- /dev/null ++++ b/source/SoundTouchDLL/meson/afxres.h +@@ -0,0 +1 @@ ++#include +diff --git a/source/meson.build b/source/meson.build +new file mode 100644 +index 0000000..f59e855 +--- /dev/null ++++ b/source/meson.build +@@ -0,0 +1,6 @@ ++if system == 'android' ++ subdir('Android-lib') ++endif ++subdir('SoundTouch') ++subdir('SoundStretch') ++subdir('SoundTouchDLL') +-- +2.42.0.windows.2 + diff --git a/recipes/soundtouch/0001-Add-minimal-meson-build-system.patch b/recipes/soundtouch/0001-Add-minimal-meson-build-system.patch deleted file mode 100644 index f89ec789..00000000 --- a/recipes/soundtouch/0001-Add-minimal-meson-build-system.patch +++ /dev/null @@ -1,211 +0,0 @@ -From b9d5346b04f2b77d59de3690e3f705c5a0d101d3 Mon Sep 17 00:00:00 2001 -From: Matthew Waters -Date: Mon, 22 Oct 2018 21:05:58 +1100 -Subject: [PATCH] Add minimal meson build system - -No optimisations (mmx or sse) ---- - include/meson.build | 17 ++++++++ - meson.build | 43 ++++++++++++++++++++ - meson_options.txt | 9 +++++ - source/SoundStretch/meson.build | 11 ++++++ - source/SoundTouch/meson.build | 69 +++++++++++++++++++++++++++++++++ - source/meson.build | 2 + - 6 files changed, 151 insertions(+) - create mode 100644 include/meson.build - create mode 100644 meson.build - create mode 100644 meson_options.txt - create mode 100644 source/SoundStretch/meson.build - create mode 100644 source/SoundTouch/meson.build - create mode 100644 source/meson.build - -diff --git a/include/meson.build b/include/meson.build -new file mode 100644 -index 0000000..03bee39 ---- /dev/null -+++ b/include/meson.build -@@ -0,0 +1,17 @@ -+soundtouch_headers = [ -+ 'FIFOSampleBuffer.h', -+ 'FIFOSamplePipe.h', -+ 'SoundTouch.h', -+ 'STTypes.h', -+ 'BPMDetect.h', -+] -+ -+soundtouch_config_h = configure_file( -+ configuration: conf, -+ output: 'soundtouch_config.h' -+) -+ -+install_headers( -+ soundtouch_headers + [soundtouch_config_h], -+ subdir : 'soundtouch' -+) -diff --git a/meson.build b/meson.build -new file mode 100644 -index 0000000..4d56edc ---- /dev/null -+++ b/meson.build -@@ -0,0 +1,43 @@ -+project('SoundTouch', 'c', 'cpp', -+ version : '2.0.0', -+ meson_version : '>= 0.47', -+ default_options : [ 'warning_level=1', -+ 'buildtype=debugoptimized' ]) -+ -+pkgconfig = import('pkgconfig') -+ -+soversion = 1 -+libversion = '@0@.@1@.@2@'.format(soversion, 0, 0) -+ -+conf = configuration_data() -+ -+cxx = meson.get_compiler('cpp') -+ -+if get_option('integer_samples') -+ conf.set10('SOUNDTOUCH_INTEGER_SAMPLES', true) -+else -+ conf.set10('SOUNDTOUCH_FLOAT_SAMPLES', true) -+endif -+# FIXME -+conf.set10('SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS', true) -+have_mmx = false -+have_sse = false -+# FIXME Check for cpuid.h -+ -+libm = cxx.find_library('m', required : false) -+ -+platform_deps = [libm] -+soundtouch_inc = include_directories('include') -+ -+subdir('include') -+subdir('source') -+ -+pkgconfig.generate( -+ name: 'SoundTouch', -+ description: 'SoundTouch is an open-source audio processing library for changing the Tempo, Pitch and Playback Rates of audio streams or files', -+ url: 'https://www.surina.net/soundtouch/', -+ version: meson.project_version(), -+ filebase: 'soundtouch', -+ subdirs: 'soundtouch', -+ libraries: libsoundtouch, -+) -diff --git a/meson_options.txt b/meson_options.txt -new file mode 100644 -index 0000000..2e54708 ---- /dev/null -+++ b/meson_options.txt -@@ -0,0 +1,9 @@ -+option('integer_samples', type: 'boolean', value: false, -+ description: 'Use integer samples instead of floats') -+# FIXME -+option('openmp', type: 'boolean', value: false, -+ description: 'Use parallel multicore calculation through OpenMP') -+# FIXME -+option('x86_optimizations', type: 'boolean', value: false, -+ description: 'Use MMX or SSE optimizations') -+ -diff --git a/source/SoundStretch/meson.build b/source/SoundStretch/meson.build -new file mode 100644 -index 0000000..aa57488 ---- /dev/null -+++ b/source/SoundStretch/meson.build -@@ -0,0 +1,11 @@ -+soundstretch_sources = [ -+ 'main.cpp', -+ 'RunParameters.cpp', -+ 'WavFile.cpp', -+] -+ -+executable('SoundStretch', -+ soundstretch_sources, -+ dependencies: soundtouch_dep, -+ install: true -+) -diff --git a/source/SoundTouch/meson.build b/source/SoundTouch/meson.build -new file mode 100644 -index 0000000..9bfcf96 ---- /dev/null -+++ b/source/SoundTouch/meson.build -@@ -0,0 +1,69 @@ -+soundtouch_sources = [ -+ 'AAFilter.cpp', -+ 'FIRFilter.cpp', -+ 'FIFOSampleBuffer.cpp', -+ 'RateTransposer.cpp', -+ 'SoundTouch.cpp', -+ 'TDStretch.cpp', -+ 'cpu_detect_x86.cpp', -+ 'BPMDetect.cpp', -+ 'PeakFinder.cpp', -+ 'InterpolateLinear.cpp', -+ 'InterpolateCubic.cpp', -+ 'InterpolateShannon.cpp', -+] -+ -+soundtouch_mmx_sources = [ -+ 'mmx_optimized.cpp', -+] -+ -+soundtouch_sse_sources = [ -+ 'sse_optimized.cpp', -+] -+ -+extra_libs = [] -+if have_mmx -+ mmx_arg = '-mmmx' -+else -+ mmx_arg = '' -+endif -+ -+extra_libs += [ -+ static_library('SoundTouchMMX', -+ soundtouch_mmx_sources, -+ c_args: mmx_arg, -+ include_directories: [soundtouch_inc], -+ dependencies: platform_deps -+ ) -+] -+ -+if have_sse -+ sse_arg = '-msse' -+else -+ sse_arg = '' -+endif -+ -+extra_libs += [ -+ static_library('SoundTouchSSE', -+ soundtouch_sse_sources, -+ c_args : sse_arg, -+ include_directories: [soundtouch_inc], -+ dependencies: platform_deps -+ ) -+] -+ -+libsoundtouch = library('SoundTouch', -+ soundtouch_sources, -+ link_with: extra_libs, -+ version: libversion, -+ soversion: soversion, -+ install: true, -+ include_directories: [soundtouch_inc], -+ dependencies: platform_deps -+) -+ -+soundtouch_dep = declare_dependency( -+ link_with: libsoundtouch, -+ include_directories: [soundtouch_inc], -+ dependencies: platform_deps -+) -diff --git a/source/meson.build b/source/meson.build -new file mode 100644 -index 0000000..19a56de ---- /dev/null -+++ b/source/meson.build -@@ -0,0 +1,2 @@ -+subdir('SoundTouch') -+subdir('SoundStretch') --- -2.40.1 - diff --git a/recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch b/recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch deleted file mode 100644 index 4d5a85a6..00000000 --- a/recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 1faa2a6ab7456e2c52c9bcd33997cfc1092ac79d Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 8 Feb 2024 08:48:19 +0530 -Subject: [PATCH] Export symbols for a DLL correctly - -Fixes the MSVC build, which requires this. GCC (MinGW/Autotools) -simply exports everything. ---- - include/BPMDetect.h | 6 +++--- - include/FIFOSampleBuffer.h | 2 +- - include/FIFOSamplePipe.h | 4 ++-- - include/STTypes.h | 9 +++++++++ - include/SoundTouch.h | 2 +- - source/SoundTouch/meson.build | 6 ++++++ - 6 files changed, 22 insertions(+), 7 deletions(-) - -diff --git a/include/BPMDetect.h b/include/BPMDetect.h -index 8ece784..24a82e5 100644 ---- a/include/BPMDetect.h -+++ b/include/BPMDetect.h -@@ -68,14 +68,14 @@ namespace soundtouch - - //////////////////////////////////////////////////////////////////////////////// - -- typedef struct -+ typedef struct SOUNDTOUCH_API - { - float pos; - float strength; - } BEAT; - - -- class IIR2_filter -+ class SOUNDTOUCH_API IIR2_filter - { - double coeffs[5]; - double prev[5]; -@@ -87,7 +87,7 @@ namespace soundtouch - - - /// Class for calculating BPM rate for audio data. -- class BPMDetect -+ class SOUNDTOUCH_API BPMDetect - { - protected: - /// Auto-correlation accumulator bins. -diff --git a/include/FIFOSampleBuffer.h b/include/FIFOSampleBuffer.h -index de298dd..4b9232b 100644 ---- a/include/FIFOSampleBuffer.h -+++ b/include/FIFOSampleBuffer.h -@@ -49,7 +49,7 @@ namespace soundtouch - /// - /// Notice that in case of stereo audio, one sample is considered to consist of - /// both channel data. --class FIFOSampleBuffer : public FIFOSamplePipe -+class SOUNDTOUCH_API FIFOSampleBuffer : public FIFOSamplePipe - { - private: - /// Sample buffer. -diff --git a/include/FIFOSamplePipe.h b/include/FIFOSamplePipe.h -index 38ef31a..a9727d2 100644 ---- a/include/FIFOSamplePipe.h -+++ b/include/FIFOSamplePipe.h -@@ -49,7 +49,7 @@ namespace soundtouch - { - - /// Abstract base class for FIFO (first-in-first-out) sample processing classes. --class FIFOSamplePipe -+class SOUNDTOUCH_API FIFOSamplePipe - { - protected: - -@@ -135,7 +135,7 @@ public: - /// When samples are input to this class, they're first processed and then put to - /// the FIFO pipe that's defined as output of this class. This output pipe can be - /// either other processing stage or a FIFO sample buffer. --class FIFOProcessor :public FIFOSamplePipe -+class SOUNDTOUCH_API FIFOProcessor :public FIFOSamplePipe - { - protected: - /// Internal pipe where processed samples are put. -diff --git a/include/STTypes.h b/include/STTypes.h -index 862505e..0c823d6 100644 ---- a/include/STTypes.h -+++ b/include/STTypes.h -@@ -42,6 +42,15 @@ typedef unsigned long ulong; - typedef ulong ulongptr; - #endif - -+#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(SOUNDTOUCH_STATIC_COMPILATION) -+ #ifdef DLL_EXPORTS -+ #define SOUNDTOUCH_API __declspec(dllexport) -+ #else -+ #define SOUNDTOUCH_API __declspec(dllimport) -+ #endif -+#else -+ #define SOUNDTOUCH_API -+#endif - - // Helper macro for aligning pointer up to next 16-byte boundary - #define SOUNDTOUCH_ALIGN_POINTER_16(x) ( ( (ulongptr)(x) + 15 ) & ~(ulongptr)15 ) -diff --git a/include/SoundTouch.h b/include/SoundTouch.h -index f2addc1..5ead697 100644 ---- a/include/SoundTouch.h -+++ b/include/SoundTouch.h -@@ -165,7 +165,7 @@ namespace soundtouch - #define SETTING_INITIAL_LATENCY 8 - - --class SoundTouch : public FIFOProcessor -+class SOUNDTOUCH_API SoundTouch : public FIFOProcessor - { - private: - /// Rate transposer class instance -diff --git a/source/SoundTouch/meson.build b/source/SoundTouch/meson.build -index 9bfcf96..e184fcd 100644 ---- a/source/SoundTouch/meson.build -+++ b/source/SoundTouch/meson.build -@@ -52,8 +52,14 @@ extra_libs += [ - ) - ] - -+exports_arg = [] -+if host_machine.system() == 'windows' and get_option('default_library') != 'static' -+ exports_arg += ['-DDLL_EXPORTS'] -+endif -+ - libsoundtouch = library('SoundTouch', - soundtouch_sources, -+ cpp_args: exports_arg, - link_with: extra_libs, - version: libversion, - soversion: soversion, --- -2.43.0.windows.1 - diff --git a/recipes/soundtouch/0008-Fix-compilation-with-clang.patch b/recipes/soundtouch/0008-Fix-compilation-with-clang.patch deleted file mode 100644 index 03005ec6..00000000 --- a/recipes/soundtouch/0008-Fix-compilation-with-clang.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 60ec5d91ba521a2379c6c1803f2b587d0eafedb5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= -Date: Sun, 22 Sep 2013 17:22:23 +0200 -Subject: [PATCH 8/9] Fix compilation with clang - ---- - source/SoundTouch/cpu_detect_x86.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/source/SoundTouch/cpu_detect_x86.cpp b/source/SoundTouch/cpu_detect_x86.cpp -index 5ef0246..2c6fb52 100644 ---- a/source/SoundTouch/cpu_detect_x86.cpp -+++ b/source/SoundTouch/cpu_detect_x86.cpp -@@ -45,7 +45,7 @@ - - #if defined(SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS) - -- #if defined(__GNUC__) && defined(__i386__) -+ #if defined(__GNUC__) && defined(__i386__) && !defined(__clang__) - // gcc - #include "cpuid.h" - #elif defined(_M_IX86) -@@ -89,7 +89,7 @@ uint detectCPUextensions(void) - - /// If building for a 32bit system and the user wants optimizations. - /// Keep the _dwDisabledISA test (2 more operations, could be eliminated). --#elif ((defined(__GNUC__) && defined(__i386__)) \ -+#elif ((defined(__GNUC__) && defined(__i386__) && !defined(__clang__)) \ - || defined(_M_IX86)) \ - && defined(SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS) - --- -2.1.4 - -- cgit v1.2.3