From 4509e764cc691a0ae097ef512bda2095cf477152 Mon Sep 17 00:00:00 2001 From: bagong Date: Tue, 20 Jun 2017 00:31:34 +0200 Subject: [PATCH] [AUBIO] Add new package --- ports/aubio/CONTROL | 4 + ports/aubio/aubio-5.def | 442 ++++++++++++++++++++++++++++++ ports/aubio/crt_lib_linkage.patch | 68 +++++ ports/aubio/portfile.cmake | 106 +++++++ 4 files changed, 620 insertions(+) create mode 100644 ports/aubio/CONTROL create mode 100644 ports/aubio/aubio-5.def create mode 100644 ports/aubio/crt_lib_linkage.patch create mode 100644 ports/aubio/portfile.cmake diff --git a/ports/aubio/CONTROL b/ports/aubio/CONTROL new file mode 100644 index 0000000000..f7aee6191a --- /dev/null +++ b/ports/aubio/CONTROL @@ -0,0 +1,4 @@ +Source: aubio +Version: 0.46~alpha +Description: Aubio is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio. +Build-Depends: ffmpeg, libsndfile diff --git a/ports/aubio/aubio-5.def b/ports/aubio/aubio-5.def new file mode 100644 index 0000000000..8b3fb9b7de --- /dev/null +++ b/ports/aubio/aubio-5.def @@ -0,0 +1,442 @@ +EXPORTS +aubio_autocorr +aubio_beattracking_checkstate +aubio_beattracking_do +aubio_beattracking_get_bpm +aubio_beattracking_get_confidence +aubio_beattracking_get_period +aubio_beattracking_get_period_s +aubio_bintofreq +aubio_bintomidi +aubio_cleanup +aubio_db_spl +aubio_default_log +aubio_fft_do +aubio_fft_do_complex +aubio_fft_get_imag +aubio_fft_get_norm +aubio_fft_get_phas +aubio_fft_get_real +aubio_fft_get_realimag +aubio_fft_get_spectrum +aubio_fft_rdo +aubio_fft_rdo_complex +aubio_filter_do +aubio_filter_do_filtfilt +aubio_filter_do_outplace +aubio_filter_do_reset +aubio_filter_get_feedback +aubio_filter_get_feedforward +aubio_filter_get_order +aubio_filter_get_samplerate +aubio_filter_set_a_weighting +aubio_filter_set_biquad +aubio_filter_set_c_weighting +aubio_filter_set_samplerate +aubio_filterbank_do +aubio_filterbank_get_coeffs +aubio_filterbank_set_coeffs +aubio_filterbank_set_mel_coeffs_slaney +aubio_filterbank_set_triangle_bands +aubio_freqtobin +aubio_freqtomidi +aubio_hist_do +aubio_hist_do_notnull +aubio_hist_dyn_notnull +aubio_hist_mean +aubio_hist_weight +aubio_io_validate_channels +aubio_io_validate_samplerate +aubio_is_power_of_two +aubio_level_detection +aubio_level_lin +aubio_log +aubio_log_reset +aubio_log_set_function +aubio_log_set_level_function +aubio_mfcc_do +aubio_miditobin +aubio_miditofreq +aubio_next_power_of_two +aubio_notes_do +aubio_notes_get_minioi_ms +aubio_notes_get_silence +aubio_notes_set_minioi_ms +aubio_notes_set_silence +aubio_onset_do +aubio_onset_get_awhitening +aubio_onset_get_compression +aubio_onset_get_delay +aubio_onset_get_delay_ms +aubio_onset_get_delay_s +aubio_onset_get_descriptor +aubio_onset_get_last +aubio_onset_get_last_ms +aubio_onset_get_last_s +aubio_onset_get_minioi +aubio_onset_get_minioi_ms +aubio_onset_get_minioi_s +aubio_onset_get_silence +aubio_onset_get_threshold +aubio_onset_get_thresholded_descriptor +aubio_onset_reset +aubio_onset_set_awhitening +aubio_onset_set_compression +aubio_onset_set_default_parameters +aubio_onset_set_delay +aubio_onset_set_delay_ms +aubio_onset_set_delay_s +aubio_onset_set_minioi +aubio_onset_set_minioi_ms +aubio_onset_set_minioi_s +aubio_onset_set_silence +aubio_onset_set_threshold +aubio_ooura_cdft +aubio_ooura_ddct +aubio_ooura_ddst +aubio_ooura_dfct +aubio_ooura_dfst +aubio_ooura_rdft +aubio_parameter_get_current_value +aubio_parameter_get_max_value +aubio_parameter_get_min_value +aubio_parameter_get_next_value +aubio_parameter_get_steps +aubio_parameter_set_current_value +aubio_parameter_set_max_value +aubio_parameter_set_min_value +aubio_parameter_set_steps +aubio_parameter_set_target_value +aubio_peakpicker_do +aubio_peakpicker_get_threshold +aubio_peakpicker_get_thresholded_input +aubio_peakpicker_get_thresholdfn +aubio_peakpicker_set_threshold +aubio_peakpicker_set_thresholdfn +aubio_pitch_cands +aubio_pitch_do +aubio_pitch_get_confidence +aubio_pitch_get_silence +aubio_pitch_get_tolerance +aubio_pitch_set_silence +aubio_pitch_set_tolerance +aubio_pitch_set_unit +aubio_pitch_slideblock +aubio_pitchfcomb_do +aubio_pitchmcomb_combdet +aubio_pitchmcomb_do +aubio_pitchmcomb_get_root_peak +aubio_pitchmcomb_quadpick +aubio_pitchmcomb_sort_cand_ene +aubio_pitchmcomb_sort_cand_freq +aubio_pitchmcomb_sort_peak +aubio_pitchmcomb_spectral_pp +aubio_pitchschmitt_do +aubio_pitchspecacf_do +aubio_pitchspecacf_get_confidence +aubio_pitchspecacf_get_tolerance +aubio_pitchspecacf_set_tolerance +aubio_pitchyin_diff +aubio_pitchyin_do +aubio_pitchyin_get_confidence +aubio_pitchyin_get_tolerance +aubio_pitchyin_getcum +aubio_pitchyin_getpitch +aubio_pitchyin_set_tolerance +aubio_pitchyinfft_do +aubio_pitchyinfft_get_confidence +aubio_pitchyinfft_get_tolerance +aubio_pitchyinfft_set_tolerance +aubio_pvoc_do +aubio_pvoc_rdo +aubio_quadfrac +aubio_resampler_do +aubio_sampler_do +aubio_sampler_do_multi +aubio_sampler_get_playing +aubio_sampler_load +aubio_sampler_play +aubio_sampler_set_playing +aubio_sampler_stop +aubio_scale_do +aubio_scale_set_limits +aubio_schmittS16LE +aubio_silence_detection +aubio_sink_close +aubio_sink_do +aubio_sink_do_multi +aubio_sink_get_channels +aubio_sink_get_samplerate +aubio_sink_preset_channels +aubio_sink_preset_samplerate +aubio_sink_sndfile_close +aubio_sink_sndfile_do +aubio_sink_sndfile_do_multi +aubio_sink_sndfile_get_channels +aubio_sink_sndfile_get_samplerate +aubio_sink_sndfile_open +aubio_sink_sndfile_preset_channels +aubio_sink_sndfile_preset_samplerate +aubio_sink_wavwrite_close +aubio_sink_wavwrite_do +aubio_sink_wavwrite_do_multi +aubio_sink_wavwrite_get_channels +aubio_sink_wavwrite_get_samplerate +aubio_sink_wavwrite_open +aubio_sink_wavwrite_preset_channels +aubio_sink_wavwrite_preset_samplerate +aubio_source_avcodec_close +aubio_source_avcodec_do +aubio_source_avcodec_do_multi +aubio_source_avcodec_get_channels +aubio_source_avcodec_get_duration +aubio_source_avcodec_get_samplerate +aubio_source_avcodec_has_network_url +aubio_source_avcodec_readframe +aubio_source_avcodec_reset_resampler +aubio_source_avcodec_seek +aubio_source_close +aubio_source_do +aubio_source_do_multi +aubio_source_get_channels +aubio_source_get_duration +aubio_source_get_samplerate +aubio_source_seek +aubio_source_sndfile_close +aubio_source_sndfile_do +aubio_source_sndfile_do_multi +aubio_source_sndfile_get_channels +aubio_source_sndfile_get_duration +aubio_source_sndfile_get_samplerate +aubio_source_sndfile_seek +aubio_source_wavread_close +aubio_source_wavread_do +aubio_source_wavread_do_multi +aubio_source_wavread_get_channels +aubio_source_wavread_get_duration +aubio_source_wavread_get_samplerate +aubio_source_wavread_readframe +aubio_source_wavread_seek +aubio_specdesc_centroid +aubio_specdesc_complex +aubio_specdesc_decrease +aubio_specdesc_do +aubio_specdesc_energy +aubio_specdesc_hfc +aubio_specdesc_kl +aubio_specdesc_kurtosis +aubio_specdesc_mkl +aubio_specdesc_phase +aubio_specdesc_rolloff +aubio_specdesc_skewness +aubio_specdesc_slope +aubio_specdesc_specdiff +aubio_specdesc_specflux +aubio_specdesc_spread +aubio_specdesc_wphase +aubio_spectral_whitening_do +aubio_spectral_whitening_get_floor +aubio_spectral_whitening_get_relax_time +aubio_spectral_whitening_reset +aubio_spectral_whitening_set_floor +aubio_spectral_whitening_set_relax_time +aubio_tempo_do +aubio_tempo_get_bpm +aubio_tempo_get_confidence +aubio_tempo_get_delay +aubio_tempo_get_delay_ms +aubio_tempo_get_delay_s +aubio_tempo_get_last +aubio_tempo_get_last_ms +aubio_tempo_get_last_s +aubio_tempo_get_last_tatum +aubio_tempo_get_period +aubio_tempo_get_period_s +aubio_tempo_get_silence +aubio_tempo_get_threshold +aubio_tempo_set_delay +aubio_tempo_set_delay_ms +aubio_tempo_set_delay_s +aubio_tempo_set_silence +aubio_tempo_set_tatum_signature +aubio_tempo_set_threshold +aubio_tempo_was_tatum +aubio_tss_do +aubio_tss_set_alpha +aubio_tss_set_beta +aubio_tss_set_threshold +aubio_unwrap2pi +aubio_wavetable_do +aubio_wavetable_do_multi +aubio_wavetable_get_amp +aubio_wavetable_get_freq +aubio_wavetable_get_playing +aubio_wavetable_play +aubio_wavetable_set_amp +aubio_wavetable_set_freq +aubio_wavetable_set_playing +aubio_wavetable_stop +aubio_zero_crossing_rate +cvec_centroid +cvec_copy +cvec_logmag +cvec_mean +cvec_moment +cvec_norm_get_data +cvec_norm_get_sample +cvec_norm_ones +cvec_norm_set_all +cvec_norm_set_sample +cvec_norm_zeros +cvec_phas_get_data +cvec_phas_get_sample +cvec_phas_ones +cvec_phas_set_all +cvec_phas_set_sample +cvec_phas_zeros +cvec_print +cvec_sum +cvec_zeros +del_aubio_beattracking +del_aubio_fft +del_aubio_filter +del_aubio_filterbank +del_aubio_hist +del_aubio_mfcc +del_aubio_notes +del_aubio_onset +del_aubio_parameter +del_aubio_peakpicker +del_aubio_pitch +del_aubio_pitchfcomb +del_aubio_pitchmcomb +del_aubio_pitchschmitt +del_aubio_pitchspecacf +del_aubio_pitchyin +del_aubio_pitchyinfft +del_aubio_pvoc +del_aubio_resampler +del_aubio_sampler +del_aubio_scale +del_aubio_sink +del_aubio_sink_sndfile +del_aubio_sink_wavwrite +del_aubio_source +del_aubio_source_avcodec +del_aubio_source_sndfile +del_aubio_source_wavread +del_aubio_specdesc +del_aubio_spectral_whitening +del_aubio_tempo +del_aubio_tss +del_aubio_wavetable +del_cvec +del_fmat +del_fvec +del_lvec +fmat_copy +fmat_get_channel +fmat_get_channel_data +fmat_get_data +fmat_get_sample +fmat_ones +fmat_print +fmat_rev +fmat_set +fmat_set_sample +fmat_vecmul +fmat_weight +fmat_zeros +fvec_abs +fvec_adapt_thres +fvec_add +fvec_alpha_norm +fvec_alpha_normalise +fvec_ceil +fvec_clamp +fvec_copy +fvec_cos +fvec_exp +fvec_floor +fvec_get_data +fvec_get_sample +fvec_gettimesig +fvec_ishift +fvec_local_hfc +fvec_log +fvec_log10 +fvec_max +fvec_max_elem +fvec_mean +fvec_median +fvec_min +fvec_min_elem +fvec_min_removal +fvec_moving_thres +fvec_ones +fvec_peakpick +fvec_pow +fvec_print +fvec_push +fvec_quadratic_peak_mag +fvec_quadratic_peak_pos +fvec_rev +fvec_round +fvec_set_all +fvec_set_sample +fvec_set_window +fvec_shift +fvec_sin +fvec_sqrt +fvec_sum +fvec_weight +fvec_weighted_copy +fvec_zeros +lvec_get_data +lvec_get_sample +lvec_ones +lvec_print +lvec_set_all +lvec_set_sample +lvec_zeros +new_aubio_beattracking +new_aubio_fft +new_aubio_filter +new_aubio_filter_a_weighting +new_aubio_filter_biquad +new_aubio_filter_c_weighting +new_aubio_filterbank +new_aubio_hist +new_aubio_mfcc +new_aubio_notes +new_aubio_onset +new_aubio_parameter +new_aubio_peakpicker +new_aubio_pitch +new_aubio_pitchfcomb +new_aubio_pitchmcomb +new_aubio_pitchschmitt +new_aubio_pitchspecacf +new_aubio_pitchyin +new_aubio_pitchyinfft +new_aubio_pvoc +new_aubio_resampler +new_aubio_sampler +new_aubio_scale +new_aubio_sink +new_aubio_sink_sndfile +new_aubio_sink_wavwrite +new_aubio_source +new_aubio_source_avcodec +new_aubio_source_sndfile +new_aubio_source_wavread +new_aubio_specdesc +new_aubio_spectral_whitening +new_aubio_tempo +new_aubio_tss +new_aubio_wavetable +new_aubio_window +new_cvec +new_fmat +new_fvec +new_lvec diff --git a/ports/aubio/crt_lib_linkage.patch b/ports/aubio/crt_lib_linkage.patch new file mode 100644 index 0000000000..36a8a3640c --- /dev/null +++ b/ports/aubio/crt_lib_linkage.patch @@ -0,0 +1,68 @@ +diff --git a/src/wscript_build b/src/wscript_build +index 0a7d72a..bf84227 100644 +--- a/src/wscript_build ++++ b/src/wscript_build +@@ -24,7 +24,12 @@ ctx(features = 'c', + if ctx.env['DEST_OS'] in ['ios', 'iosimulator']: + build_features = ['cstlib', 'cshlib'] + elif ctx.env['DEST_OS'] in ['win32', 'win64']: +- build_features = ['cstlib', 'cshlib'] ++ if ctx.options.library_linkage == "static": ++ build_features = ['cstlib'] ++ elif ctx.options.library_linkage == "dynamic": ++ build_features = ['cshlib'] ++ else: ++ build_features = ['cstlib', 'cshlib'] + elif ctx.env['DEST_OS'] in ['emscripten']: + build_features = ['cstlib'] + elif '--static' in ctx.env['LDFLAGS'] or '--static' in ctx.env['LINKFLAGS']: +diff --git a/wscript b/wscript +index 6363f1e..e0d57a4 100644 +--- a/wscript ++++ b/wscript +@@ -44,6 +44,16 @@ def options(ctx): + dest = 'build_type', + help = 'whether to compile with (--build-type=release) or without (--build-type=debug) '\ + ' compiler opimizations [default: release]') ++ ctx.add_option('--crt-linkage', action = 'store', ++ default = "dynamic", ++ choices = ('static', 'dynamic'), ++ dest = 'crt_linkage', ++ help = 'whether to compile with static CRT linkage (--crt-linkage=static) or the default dynamic (--crt-linkage=dynamic)') ++ ctx.add_option('--library-linkage', action = 'store', ++ default = "both", ++ choices = ('dynamic', 'static', 'both'), ++ dest = 'library_linkage', ++ help = 'whether to compile a dynamic (shared) (--library-linkage=dynamic) or static library (--library-linkage=static) ("both" is broken for msvc)') + add_option_enable_disable(ctx, 'fftw3f', default = False, + help_str = 'compile with fftw3f instead of ooura (recommended)', + help_disable_str = 'do not compile with fftw3f') +@@ -139,16 +149,25 @@ def configure(ctx): + else: + # enable debug symbols + ctx.env.CFLAGS += ['/Z7', '/FS'] +- ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO'] ++ if ctx.options.library_linkage == "dynamic": ++ ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO', '/DEF:..\\aubio-5.def'] ++ else: ++ ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO'] + # configure warnings + ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS'] + # set optimization level and runtime libs + if (ctx.options.build_type == "release"): + ctx.env.CFLAGS += ['/Ox'] +- ctx.env.CFLAGS += ['/MD'] ++ if (ctx.options.crt_linkage == "static"): ++ ctx.env.CFLAGS += ['/MT'] ++ else: ++ ctx.env.CFLAGS += ['/MD'] + else: + assert(ctx.options.build_type == "debug") +- ctx.env.CFLAGS += ['/MDd'] ++ if (ctx.options.crt_linkage == "static"): ++ ctx.env.CFLAGS += ['/MTd'] ++ else: ++ ctx.env.CFLAGS += ['/MDd'] + + ctx.check_cc(lib='m', uselib_store='M', mandatory=False) + diff --git a/ports/aubio/portfile.cmake b/ports/aubio/portfile.cmake new file mode 100644 index 0000000000..714ec3ae8c --- /dev/null +++ b/ports/aubio/portfile.cmake @@ -0,0 +1,106 @@ +# NOTES +# - if you get a codepage/unicode related error (non-critical) during configuration, +# ignore it or, try switching the console codepage to windows english (`chcp 1252`) +# - the build breaks with "missing pthreads" if --enable-fftw3(f) is added (if fftw3 +# is not added, the embedded ooura fft lib is used) +# - the port uses ffmpeg and libsndfile as dependencies and also depends on possibilty to acquire waf and pkg-config(-lite) in vcpkg. +# - crt-linkage is handled here, not in the generic waf-configure function because it is controlled via a patch to the aubio wscript +# Waf seems to have no generic way to switch crt-linkage. +# - The static build works, but: vcpkg's static ffmpegs build is fake ;), therefore it is still required to make the ffmpeg dlls +# available in order to run exectables with statically linked aubio. + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/aubio-3c230fae309e9ea3298783368dd71bae6172359a) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/aubio/aubio/archive/3c230fae309e9ea3298783368dd71bae6172359a.zip" + FILENAME "aubio-0.4.6-3c230f.zip" + SHA512 081fe59612f0b1860f465208739b1377869c64b91cecf4a6f6fbdea19204b801c650ff956b34be5988ef1905f3546d3c55846037487e0b34b014f1adbb68629c +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# Pkg-config is equired by aubio to detect ffmpeg and libsndfile +vcpkg_find_acquire_program(PKG-CONFIG) + +# Waf depends on python, so this also installs python3 +vcpkg_acquire_waf() + +# Configure pkg-config dir +get_filename_component(PKG_CONFIG_DIR ${PKG-CONFIG} DIRECTORY) +# Add pkg-config and vcpkg-bin-dir to environment search path +set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/debug/bin;${PKG_CONFIG_DIR};$ENV{PATH}") +# Set pkg-config search-path +set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig") + +# Add waf executable if missing +if(NOT EXISTS "${SOURCE_PATH}/waf") + file(COPY "${WAF_DIR}/waf" DESTINATION "${SOURCE_PATH}") +endif() + +# Add arguments for crt linkage and library linkage +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/crt_lib_linkage.patch" +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/aubio-5.def DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_waf( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + --library-linkage=${VCPKG_LIBRARY_LINKAGE} + --crt-linkage=${VCPKG_CRT_LINKAGE} + --enable-sndfile + --enable-avcodec + --disable-docs + --verbose + # OPTIONS_DEBUG + # OPTIONS_RELEASE + OPTIONS_BUILD + --library-linkage=${VCPKG_LIBRARY_LINKAGE} + --verbose + --notests + # OPTIONS_BUILD_RELEASE + # OPTIONS_BUILD_DEBUG + # TARGETS +) + +# Postinstall cleanup debug +message(STATUS "Cleaning up build") +# Remove unused files +# Debug executable and include folder +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(GLOB DEBUG_EXECS ${CURRENT_PACKAGES_DIR}/debug/bin/*) +file(REMOVE ${DEBUG_EXECS}) +# In release branch move execs to tools +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/aubio) +file(GLOB RELEASE_EXECS ${CURRENT_PACKAGES_DIR}/bin/*.exe) +file(GLOB RELEASE_EXE_SYMBOLS ${CURRENT_PACKAGES_DIR}/bin/*.pdb) +FILE(COPY ${RELEASE_EXECS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/aubio) +FILE(REMOVE ${RELEASE_EXECS} ${RELEASE_EXE_SYMBOLS}) + +# Prepare (re-)moving dynamic libs +file(GLOB DEBUG_DLLS ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll ${CURRENT_PACKAGES_DIR}/debug/lib/*.pdb) +file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/*.dll ${CURRENT_PACKAGES_DIR}/lib/*.pdb) + +if(${VCPKG_LIBRARY_LINKAGE} MATCHES "dynamic") + # Move dlls + file(COPY ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) + file(COPY ${RELEASE_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE ${DEBUG_DLLS} ${RELEASE_DLLS}) +elseif(${VCPKG_LIBRARY_LINKAGE} MATCHES "static") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +# Handle copyright and credentials +file(COPY + ${SOURCE_PATH}/COPYING + ${SOURCE_PATH}/AUTHORS + ${SOURCE_PATH}/ChangeLog + ${SOURCE_PATH}/README.md + DESTINATION + ${CURRENT_PACKAGES_DIR}/share/aubio) + +file(RENAME ${CURRENT_PACKAGES_DIR}/share/aubio/COPYING ${CURRENT_PACKAGES_DIR}/share/aubio/copyright) + +# TODO +# Add python script for dynamic symbols export in dynamic linking