diff options
30 files changed, 781 insertions, 730 deletions
@@ -1,4 +1,2 @@ build/** -.waf-* -.lock-waf* __pycache__ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index cc8b569..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "waflib"] - path = waflib - url = ../../drobilla/autowaf.git diff --git a/doc/c/wscript b/doc/c/wscript deleted file mode 100644 index d515ddf..0000000 --- a/doc/c/wscript +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -def build(bld): - dox_to_sphinx = bld.path.find_node("../../scripts/dox_to_sphinx.py") - index_xml = bld.path.get_bld().make_node("xml/index.xml") - - files = [ - ("../summary.rst", "sphinx/summary.rst"), - ("index.rst", "sphinx/index.rst"), - ("overview.rst", "sphinx/overview.rst"), - ("plugins.rst", "sphinx/plugins.rst"), - ("uis.rst", "sphinx/uis.rst"), - ("world.rst", "sphinx/world.rst"), - ] - - # Run Doxygen to generate XML documentation - bld(features="doxygen", doxyfile="Doxyfile") - - # Substitute variables to make Sphinx configuration file - bld(features="subst", - source="../conf.py.in", - target="sphinx/conf.py", - LILV_VERSION=bld.env.LILV_VERSION) - - # Copy static documentation files to Sphinx build directory - for f in files: - bld(features="subst", is_copy=True, source=f[0], target=f[1]) - - # Generate Sphinx markup from Doxygen XML - bld.add_group() - bld(rule="${PYTHON} " + dox_to_sphinx.abspath() + " -f ${SRC} ${TGT}", - source=index_xml, - target="sphinx/api/") - - doc_dir = bld.env.DOCDIR + "/lilv-%s/" % bld.env.LILV_MAJOR_VERSION - - # Run Sphinx to generate HTML documentation - for builder in ["html", "singlehtml"]: - bld(features="sphinx", - sphinx_source=bld.path.get_bld().make_node("sphinx"), - sphinx_output_format=builder, - sphinx_options=["-E", "-q", "-t", builder], - install_path=doc_dir + "c/%s/" % builder) diff --git a/lilv.pc.in b/lilv.pc.in deleted file mode 100644 index 97f4f8c..0000000 --- a/lilv.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIBDIR@ -includedir=@INCLUDEDIR@ - -Name: Lilv -Version: @LILV_VERSION@ -Description: Simple C library for hosting LV2 plugins -Requires: @LILV_PKG_DEPS@ -Libs: -L${libdir} -l@LIB_LILV@ @LILV_PKG_LIBS@ -Cflags: -I${includedir}/lilv-@LILV_MAJOR_VERSION@ diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..788142c --- /dev/null +++ b/meson.build @@ -0,0 +1,238 @@ +project('lilv', ['c'], + version: '0.24.13', + license: 'ISC', + meson_version: '>= 0.49.2', + default_options: [ + 'b_ndebug=if-release', + 'buildtype=release', + 'c_std=c99', + 'default_library=shared', + 'warning_level=2', + ]) + +lilv_src_root = meson.current_source_dir() +major_version = meson.project_version().split('.')[0] +version_suffix = '-@0@'.format(major_version) +versioned_name = 'lilv' + version_suffix + +# Load build tools +pkg = import('pkgconfig') +cc = meson.get_compiler('c') + +# Set ultra strict warnings for developers, if requested +if get_option('strict') + subdir('meson') + + c_warnings = all_c_warnings + if cc.get_id() == 'clang' + c_warnings += [ + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-documentation-unknown-command', + '-Wno-double-promotion', + '-Wno-float-equal', + '-Wno-format-nonliteral', + '-Wno-implicit-float-conversion', + '-Wno-implicit-int-conversion', + '-Wno-nullability-extension', + '-Wno-nullable-to-nonnull-conversion', + '-Wno-padded', + '-Wno-reserved-id-macro', + '-Wno-shorten-64-to-32', + '-Wno-sign-conversion', + '-Wno-switch-enum', + '-Wno-vla', + ] + elif cc.get_id() == 'gcc' + c_warnings += [ + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-conversion', + '-Wno-double-promotion', + '-Wno-float-equal', + '-Wno-format-nonliteral', + '-Wno-format-truncation', + '-Wno-padded', + '-Wno-stack-protector', + '-Wno-suggest-attribute=const', + '-Wno-suggest-attribute=pure', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-unsuffixed-float-constants', + '-Wno-unused-const-variable', + '-Wno-unused-parameter', + '-Wno-vla', + ] + elif cc.get_id() == 'msvc' + c_warnings += [ + '/wd4061', # enumerator in switch is not explicitly handled + '/wd4365', # signed/unsigned mismatch + '/wd4514', # unreferenced inline function has been removed + '/wd4774', # format string is not a string literal + '/wd4820', # padding added after construct + '/wd4996', # POSIX name for this item is deprecated + ] + endif + + add_project_arguments(cc.get_supported_arguments(c_warnings), + language: ['c']) +endif + +# Add special arguments for MSVC +if cc.get_id() == 'msvc' + msvc_args = [ + '/D_CRT_SECURE_NO_WARNINGS', + '/TP', + '/experimental:external', + '/external:W0', + '/external:anglebrackets', + ] + + add_project_arguments(msvc_args, language: ['c']) +endif + +c_headers = ['include/lilv/lilv.h'] +c_header_files = files(c_headers) + +sources = [ + 'src/collections.c', + 'src/filesystem.c', + 'src/instance.c', + 'src/lib.c', + 'src/node.c', + 'src/plugin.c', + 'src/pluginclass.c', + 'src/port.c', + 'src/query.c', + 'src/scalepoint.c', + 'src/state.c', + 'src/ui.c', + 'src/util.c', + 'src/world.c', + 'src/zix/tree.c', +] + +# System libraries +m_dep = cc.find_library('m', required: false) +dl_dep = cc.find_library('dl', required: false) + +# Dependencies + +lv2_dep = dependency('lv2', + version: '>= 1.18.2', + fallback: ['lv2', 'lv2_dep']) + +serd_dep = dependency('serd-0', + version: '>= 0.30.9', + fallback: ['serd', 'serd_dep']) + +sord_dep = dependency('sord-0', + version: '>= 0.16.9', + fallback: ['sord', 'sord_dep']) + +sratom_dep = dependency('sratom-0', + version: '>=0.6.9', + fallback: ['sratom', 'sratom_dep']) + +# Determine library type and the flags needed to build it +if get_option('default_library') == 'both' + if host_machine.system() == 'windows' + error('default_library=both is not supported on Windows') + endif + + library_type = 'both_libraries' + library_args = ['-DLILV_INTERNAL'] + prog_args = [] +elif get_option('default_library') == 'shared' + library_type = 'shared_library' + library_args = ['-DLILV_INTERNAL'] + prog_args = [] +else + library_type = 'static_library' + library_args = ['-DLILV_INTERNAL', '-DLILV_STATIC'] + prog_args = ['-DLILV_STATIC'] +endif + +# Build shared and/or static library/libraries +liblilv = build_target( + versioned_name, + sources, + version: meson.project_version(), + include_directories: include_directories(['include', 'src']), + c_args: library_args, + dependencies: [m_dep, dl_dep, lv2_dep, serd_dep, sord_dep, sratom_dep], + gnu_symbol_visibility: 'hidden', + install: true, + target_type: library_type) + +lilv_dep = declare_dependency( + include_directories: include_directories(['include']), + dependencies: [m_dep, dl_dep, lv2_dep, serd_dep, sord_dep, sratom_dep], + link_with: liblilv) + +pkg.generate( + liblilv, + name: 'Lilv', + filebase: versioned_name, + subdirs: [versioned_name], + version: meson.project_version(), + description: 'A library for hosting LV2 plugins') + +# Build lilvi command line utility +# if get_option('utils') + +# lilvi = executable('lilvi', 'src/lilvi.c', +# c_args: prog_args, +# install: true, +# dependencies: lilv_dep) + +# if not get_option('docs').disabled() +# install_man('doc/lilvi.1') +# endif + +# endif + +# Install header to a versioned include directory +install_headers(c_headers, subdir: versioned_name / 'lilv') + +# if not get_option('docs').disabled() +# subdir('doc') +# endif + +if get_option('tests') + if library_type == 'both_libraries' + liblilv_static = liblilv.get_static_lib() + elif library_type == 'shared_library' + liblilv_static = static_library( + versioned_name, + sources, + include_directories: include_directories(['include', 'src']), + c_args: library_args, + dependencies: [m_dep, dl_dep, lv2_dep, serd_dep, sord_dep, sratom_dep], + gnu_symbol_visibility: 'default') + else + liblilv_static = liblilv + endif + + lilv_static_dep = declare_dependency( + include_directories: include_directories(['include']), + dependencies: [m_dep, dl_dep, lv2_dep, serd_dep, sord_dep, sratom_dep], + link_with: liblilv_static) + + subdir('test') +endif + +if not meson.is_subproject() and meson.version().version_compare('>=0.53.0') + summary('Tests', get_option('tests'), bool_yn: true) + summary('Utilities', get_option('utils'), bool_yn: true) + + summary('Install prefix', get_option('prefix')) + + summary('Headers', get_option('prefix') / get_option('includedir')) + summary('Libraries', get_option('prefix') / get_option('libdir')) + + if get_option('utils') + summary('Executables', get_option('prefix') / get_option('bindir')) + summary('Man pages', get_option('prefix') / get_option('mandir')) + endif +endif diff --git a/meson/meson.build b/meson/meson.build new file mode 100644 index 0000000..20e0522 --- /dev/null +++ b/meson/meson.build @@ -0,0 +1,196 @@ +# General code to enable approximately all warnings. +# +# This is trivial for clang and MSVC, but GCC does not have such an option, and +# has several esoteric warnings, so we need to enable everything we want +# explicitly. We enable everything that does not require a value argument, +# except for warnings that are only relevant for very old languages (earlier +# than C99 or C++11) or non-standard extensions. +# +# Omitted common warnings: +# +# Wabi= +# Waggregate-return +# Walloc-size-larger-than=BYTES +# Walloca-larger-than=BYTES +# Wframe-larger-than=BYTES +# Wlarger-than=BYTES +# Wstack-usage=BYTES +# Wsystem-headers +# Wtraditional +# Wtraditional-conversion +# Wtrampolines +# Wvla-larger-than=BYTES +# +# Omitted C warnings: +# +# Wc90-c99-compat +# Wdeclaration-after-statement +# Wtraditional +# Wtraditional-conversion +# +# Omitted C++ warnings: +# +# Wnamespaces +# Wtemplates + +gcc_common_warnings = [ + '-Walloc-zero', + '-Walloca', + '-Wanalyzer-too-complex', + '-Warith-conversion', + '-Warray-bounds=2', + '-Wattribute-alias=2', + '-Wcast-align=strict', + '-Wcast-qual', + '-Wconversion', + '-Wdate-time', + '-Wdisabled-optimization', + '-Wdouble-promotion', + '-Wduplicated-branches', + '-Wduplicated-cond', + '-Wfloat-equal', + '-Wformat-overflow=2', + '-Wformat-signedness', + '-Wformat-truncation=2', + '-Wformat=2', + '-Wimplicit-fallthrough=2', + '-Winit-self', + '-Winline', + '-Winvalid-pch', + '-Wlogical-op', + '-Wmissing-declarations', + '-Wmissing-include-dirs', + '-Wmultichar', + '-Wnormalized=nfc', + '-Wnull-dereference', + '-Wpacked', + '-Wpadded', + '-Wredundant-decls', + '-Wscalar-storage-order', + '-Wshadow', + '-Wshift-overflow=2', + '-Wsizeof-array-argument', + '-Wstack-protector', + '-Wstrict-aliasing=3', + '-Wstrict-overflow=5', + '-Wstringop-overflow=3', + '-Wsuggest-attribute=cold', + '-Wsuggest-attribute=const', + '-Wsuggest-attribute=format', + '-Wsuggest-attribute=malloc', + '-Wsuggest-attribute=noreturn', + '-Wsuggest-attribute=pure', + '-Wswitch-default', + '-Wswitch-enum', + '-Wsync-nand', + '-Wundef', + '-Wunused-const-variable=2', + '-Wunused-macros', + '-Wvarargs', + '-Wvector-operation-performance', + '-Wvla', + '-Wwrite-strings', +] + +gcc_c_warnings = [ + '-Wbad-function-cast', + '-Wc++-compat', + '-Wc99-c11-compat', + '-Wdesignated-init', + '-Wdiscarded-array-qualifiers', + '-Wdiscarded-qualifiers', + '-Wincompatible-pointer-types', + '-Wjump-misses-init', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', + '-Wstrict-prototypes', + '-Wunsuffixed-float-constants', +] + +# Set all_c_warnings for the current C compiler +if is_variable('cc') + if cc.get_id() == 'clang' + all_c_warnings = ['-Weverything'] + elif cc.get_id() == 'gcc' + all_c_warnings = gcc_common_warnings + [ + '-Wbad-function-cast', + '-Wc++-compat', + '-Wc99-c11-compat', + '-Wdesignated-init', + '-Wdiscarded-array-qualifiers', + '-Wdiscarded-qualifiers', + '-Wincompatible-pointer-types', + '-Wjump-misses-init', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', + '-Wstrict-prototypes', + '-Wunsuffixed-float-constants', + ] + elif cc.get_id() == 'msvc' + all_c_warnings = ['/Wall'] + else + all_c_warnings = [] + endif +endif + +# Set all_cpp_warnings for the current C++ compiler +if is_variable('cpp') + if cpp.get_id() == 'clang' + all_cpp_warnings = [ + '-Weverything', + '-Wno-c++98-compat', + '-Wno-c++98-compat-pedantic' + ] + elif cpp.get_id() == 'gcc' + all_cpp_warnings = gcc_common_warnings + [ + '-Wabi-tag', + '-Waligned-new=all', + '-Wcatch-value=3', + '-Wcomma-subscript', + '-Wconditionally-supported', + '-Wctor-dtor-privacy', + '-Wdeprecated-copy-dtor', + '-Weffc++', + '-Wextra-semi', + '-Wmismatched-tags', + '-Wmultiple-inheritance', + '-Wnoexcept', + '-Wnoexcept-type', + '-Wnon-virtual-dtor', + '-Wold-style-cast', + '-Woverloaded-virtual', + '-Wplacement-new=2', + '-Wredundant-tags', + '-Wregister', + '-Wsign-promo', + '-Wstrict-null-sentinel', + '-Wsuggest-final-methods', + '-Wsuggest-final-types', + '-Wsuggest-override', + '-Wuseless-cast', + '-Wvirtual-inheritance', + '-Wvolatile', + '-Wzero-as-null-pointer-constant', + ] + elif cpp.get_id() == 'msvc' + all_cpp_warnings = ['/Wall'] + else + all_cpp_warnings = [] + endif +endif + +# Set all_objc_warnings for the current Objective C compiler +if is_variable('objcc') + all_objc_warnings = [] + if objcc.get_id() == 'clang' + all_objc_warnings = ['-Weverything'] + elif objc.get_id() == 'gcc' + all_objc_warnings = gcc_common_warnings + [ + '-Wno-direct-ivar-access', + ] + else + all_objc_warnings = [] + endif +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..4cca6ff --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,11 @@ +option('docs', type: 'feature', value: 'auto', yield: true, + description: 'Build documentation') + +option('strict', type: 'boolean', value: false, yield: true, + description: 'Enable ultra-strict warnings') + +option('tests', type: 'boolean', value: true, yield: true, + description: 'Build tests') + +option('utils', type: 'boolean', value: true, yield: true, + description: 'Build command line utilities') diff --git a/test/bad_syntax.lv2/meson.build b/test/bad_syntax.lv2/meson.build new file mode 100644 index 0000000..07e96d7 --- /dev/null +++ b/test/bad_syntax.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('bad_syntax', + 'bad_syntax.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'bad_syntax.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('bad_syntax', + executable('test_bad_syntax', + 'test_bad_syntax.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/failed_instantiation.lv2/meson.build b/test/failed_instantiation.lv2/meson.build new file mode 100644 index 0000000..2221b4f --- /dev/null +++ b/test/failed_instantiation.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('failed_instantiation', + 'failed_instantiation.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'failed_instantiation.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('failed_instantiation', + executable('test_failed_instantiation', + 'test_failed_instantiation.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/failed_lib_descriptor.lv2/meson.build b/test/failed_lib_descriptor.lv2/meson.build new file mode 100644 index 0000000..b4c37f4 --- /dev/null +++ b/test/failed_lib_descriptor.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('failed_lib_descriptor', + 'failed_lib_descriptor.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'failed_lib_descriptor.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('failed_lib_descriptor', + executable('test_failed_lib_descriptor', + 'test_failed_lib_descriptor.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/lib_descriptor.lv2/meson.build b/test/lib_descriptor.lv2/meson.build new file mode 100644 index 0000000..9006dfc --- /dev/null +++ b/test/lib_descriptor.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('lib_descriptor', + 'lib_descriptor.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'lib_descriptor.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('lib_descriptor', + executable('test_lib_descriptor', + 'test_lib_descriptor.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/lilv_test_utils.c b/test/lilv_test_utils.c index f658f1b..bc6eb3d 100644 --- a/test/lilv_test_utils.c +++ b/test/lilv_test_utils.c @@ -47,7 +47,7 @@ lilv_test_env_new(void) // Set custom LV2_PATH in build directory to only use test data char* test_path = lilv_path_canonical(LILV_TEST_DIR); - char* lv2_path = lilv_strjoin(test_path, "/test_lv2_path", NULL); + char* lv2_path = lilv_strjoin(test_path, "/lv2", NULL); LilvNode* path = lilv_new_string(world, lv2_path); lilv_world_set_option(world, LILV_OPTION_LV2_PATH, path); free(lv2_path); diff --git a/test/core.lv2/lv2core.ttl b/test/lv2/core.lv2/lv2core.ttl index 5659487..5659487 100644 --- a/test/core.lv2/lv2core.ttl +++ b/test/lv2/core.lv2/lv2core.ttl diff --git a/test/core.lv2/manifest.ttl b/test/lv2/core.lv2/manifest.ttl index a77ad71..a77ad71 100644 --- a/test/core.lv2/manifest.ttl +++ b/test/lv2/core.lv2/manifest.ttl diff --git a/test/lv2/core.lv2/meson.build b/test/lv2/core.lv2/meson.build new file mode 100644 index 0000000..f6e08e3 --- /dev/null +++ b/test/lv2/core.lv2/meson.build @@ -0,0 +1,8 @@ +ttl_files = [ + 'lv2core.ttl', + 'manifest.ttl', +] + +foreach f : ttl_files + configure_file(copy: true, input: f, output: f) +endforeach diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..597b765 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,61 @@ +autoship = find_program('autoship', required: false) + +subdir('lv2/core.lv2') + +subdir('bad_syntax.lv2') +subdir('failed_instantiation.lv2') +subdir('failed_lib_descriptor.lv2') +subdir('lib_descriptor.lv2') +subdir('missing_descriptor.lv2') +subdir('missing_name.lv2') +subdir('missing_plugin.lv2') +subdir('missing_port.lv2') +subdir('missing_port_name.lv2') +subdir('new_version.lv2') +subdir('old_version.lv2') +subdir('test_plugin.lv2') + +unit_tests = [ + 'bad_port_index', + 'bad_port_symbol', + 'classes', + 'discovery', + 'filesystem', + 'get_symbol', + 'no_author', + 'no_verify', + 'plugin', + 'port', + 'preset', + 'project', + 'project_no_author', + 'prototype', + 'reload_bundle', + 'replace_version', + 'state', + 'string', + 'ui', + 'util', + 'value', + 'verify', + 'world', +] + +define_args = [ + '-DLILV_TEST_BUNDLE="@0@/"'.format(meson.current_build_dir() / 'test_plugin.lv2'), + '-DLILV_TEST_DIR="@0@/"'.format(meson.current_build_dir()), +] + +foreach unit : unit_tests + test(unit, + executable('test_@0@'.format(unit), + ['lilv_test_utils.c', 'test_@0@.c'.format(unit)], + c_args: prog_args + define_args, + include_directories: include_directories(['../src']), + dependencies: [lv2_dep, lilv_static_dep]), + suite: 'unit') +endforeach + +if autoship.found() + test('autoship', autoship, args: ['test', lilv_src_root], suite: 'data') +endif diff --git a/test/missing_descriptor.lv2/meson.build b/test/missing_descriptor.lv2/meson.build new file mode 100644 index 0000000..2112a99 --- /dev/null +++ b/test/missing_descriptor.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('missing_descriptor', + 'missing_descriptor.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'missing_descriptor.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('missing_descriptor', + executable('test_missing_descriptor', + 'test_missing_descriptor.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/missing_name.lv2/meson.build b/test/missing_name.lv2/meson.build new file mode 100644 index 0000000..02979be --- /dev/null +++ b/test/missing_name.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('missing_name', + 'missing_name.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'missing_name.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('missing_name', + executable('test_missing_name', + 'test_missing_name.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/missing_plugin.lv2/meson.build b/test/missing_plugin.lv2/meson.build new file mode 100644 index 0000000..7197a33 --- /dev/null +++ b/test/missing_plugin.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('missing_plugin', + 'missing_plugin.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'missing_plugin.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('missing_plugin', + executable('test_missing_plugin', + 'test_missing_plugin.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/missing_port.lv2/meson.build b/test/missing_port.lv2/meson.build new file mode 100644 index 0000000..c3f5461 --- /dev/null +++ b/test/missing_port.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('missing_port', + 'missing_port.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'missing_port.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('missing_port', + executable('test_missing_port', + 'test_missing_port.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/missing_port_name.lv2/meson.build b/test/missing_port_name.lv2/meson.build new file mode 100644 index 0000000..806370b --- /dev/null +++ b/test/missing_port_name.lv2/meson.build @@ -0,0 +1,24 @@ +module = shared_module('missing_port_name', + 'missing_port_name.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'missing_port_name.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + +test('missing_port_name', + executable('test_missing_port_name', + 'test_missing_port_name.c', + c_args: prog_args, + dependencies: [lv2_dep, lilv_static_dep]), + args: [meson.current_build_dir() / ''], + suite: 'plugin') + diff --git a/test/new_version.lv2/meson.build b/test/new_version.lv2/meson.build new file mode 100644 index 0000000..dce1ba2 --- /dev/null +++ b/test/new_version.lv2/meson.build @@ -0,0 +1,16 @@ +module = shared_module('new_version', + 'new_version.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'new_version.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + diff --git a/test/old_version.lv2/meson.build b/test/old_version.lv2/meson.build new file mode 100644 index 0000000..85b1dad --- /dev/null +++ b/test/old_version.lv2/meson.build @@ -0,0 +1,16 @@ +module = shared_module('old_version', + 'old_version.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'old_version.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + diff --git a/test/test.lv2/manifest.ttl.in b/test/test_plugin.lv2/manifest.ttl.in index bc3952c..48b009b 100644 --- a/test/test.lv2/manifest.ttl.in +++ b/test/test_plugin.lv2/manifest.ttl.in @@ -3,5 +3,5 @@ <http://example.org/lilv-test-plugin> a lv2:Plugin ; - lv2:binary <test@SHLIB_EXT@> ; - rdfs:seeAlso <test.ttl> . + lv2:binary <test_plugin@SHLIB_EXT@> ; + rdfs:seeAlso <test_plugin.ttl> . diff --git a/test/test_plugin.lv2/meson.build b/test/test_plugin.lv2/meson.build new file mode 100644 index 0000000..eb12c4f --- /dev/null +++ b/test/test_plugin.lv2/meson.build @@ -0,0 +1,16 @@ +module = shared_module('test_plugin', + 'test_plugin.c', + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '') + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'test_plugin.ttl'] + +foreach f : ttl_files + configure_file(input: f + '.in', + output: f, + configuration: config) +endforeach + diff --git a/test/test.lv2/test.c b/test/test_plugin.lv2/test_plugin.c index 2be34b4..2be34b4 100644 --- a/test/test.lv2/test.c +++ b/test/test_plugin.lv2/test_plugin.c diff --git a/test/test.lv2/test.ttl.in b/test/test_plugin.lv2/test_plugin.ttl.in index 1c16b4c..1c16b4c 100644 --- a/test/test.lv2/test.ttl.in +++ b/test/test_plugin.lv2/test_plugin.ttl.in @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -# Minimal waf script for projects that include waflib directly - -import sys -import inspect -import os - -try: - from waflib import Context, Scripting -except Exception as e: - sys.stderr.write('error: Failed to import waf (%s)\n' % e) - if os.path.exists('.git'): - sys.stderr.write("Are submodules up to date? " - "Try 'git submodule update --init --recursive'\n") - - sys.exit(1) - - -def main(): - script_path = os.path.abspath(inspect.getfile(inspect.getmodule(main))) - project_path = os.path.dirname(script_path) - Scripting.waf_entry_point(os.getcwd(), Context.WAFVERSION, project_path) - - -if __name__ == '__main__': - main() diff --git a/waflib b/waflib deleted file mode 160000 -Subproject b600c928b221a001faeab7bd92786d0b25714bc diff --git a/wscript b/wscript deleted file mode 100644 index 9810fed..0000000 --- a/wscript +++ /dev/null @@ -1,641 +0,0 @@ -#!/usr/bin/env python - -import glob -import os -import shutil -import sys - -from waflib import Build, Options, Logs -from waflib.extras import autowaf - -# Library and package version (UNIX style major, minor, micro) -# major increment <=> incompatible changes -# minor increment <=> compatible changes (additions) -# micro increment <=> no interface changes -LILV_VERSION = '0.24.13' -LILV_MAJOR_VERSION = '0' - -# Mandatory waf variables -APPNAME = 'lilv' # Package name for waf dist -VERSION = LILV_VERSION # Package version for waf dist -top = '.' # Source directory -out = 'build' # Build directory - -# Release variables -uri = 'http://drobilla.net/sw/lilv' -dist_pattern = 'http://download.drobilla.net/lilv-%d.%d.%d.tar.bz2' -post_tags = ['Hacking', 'LAD', 'LV2', 'Lilv'] - -tests = [ - 'test_bad_port_index', - 'test_bad_port_symbol', - 'test_classes', - 'test_discovery', - 'test_filesystem', - 'test_get_symbol', - 'test_no_author', - 'test_no_verify', - 'test_plugin', - 'test_port', - 'test_preset', - 'test_project', - 'test_project_no_author', - 'test_prototype', - 'test_reload_bundle', - 'test_replace_version', - 'test_state', - 'test_string', - 'test_ui', - 'test_util', - 'test_value', - 'test_verify', - 'test_world', -] - -test_plugins = [ - 'bad_syntax', - 'failed_instantiation', - 'failed_lib_descriptor', - 'lib_descriptor', - 'missing_descriptor', - 'missing_name', - 'missing_plugin', - 'missing_port', - 'missing_port_name', - 'new_version', - 'old_version' -] - - -def options(ctx): - ctx.load('compiler_c') - ctx.load('compiler_cxx') - ctx.load('python') - opt = ctx.configuration_options() - ctx.add_flags( - opt, - {'no-utils': 'do not build command line utilities', - 'no-bindings': 'do not build python bindings', - 'dyn-manifest': 'build support for dynamic manifests', - 'no-bash-completion': 'do not install bash completion script', - 'static': 'build static library', - 'no-shared': 'do not build shared library', - 'static-progs': 'build programs as static binaries'}) - - opt.add_option('--default-lv2-path', type='string', default='', - dest='default_lv2_path', - help='default LV2 path to use if LV2_PATH is unset') - - -def configure(conf): - conf.load('compiler_c', cache=True) - try: - conf.load('compiler_cxx', cache=True) - conf.define('LILV_CXX', True) - except Exception: - pass - - if not Options.options.no_bindings: - try: - conf.load('python', cache=True) - conf.check_python_version((2, 6, 0)) - conf.env.LILV_PYTHON = 1 - except Exception as e: - Logs.warn('Failed to configure Python (%s)\n' % e) - - conf.load('autowaf', cache=True) - autowaf.set_c_lang(conf, 'c99') - - if conf.env.DOCS: - conf.load('sphinx') - - conf.env.BASH_COMPLETION = not Options.options.no_bash_completion - conf.env.BUILD_UTILS = not Options.options.no_utils - conf.env.BUILD_SHARED = not Options.options.no_shared - conf.env.STATIC_PROGS = Options.options.static_progs - conf.env.BUILD_STATIC = (Options.options.static or - Options.options.static_progs) - - if not conf.env.BUILD_SHARED and not conf.env.BUILD_STATIC: - conf.fatal('Neither a shared nor a static build requested') - - if Options.options.strict: - # Check for programs used by lint target - conf.find_program("flake8", var="FLAKE8", mandatory=False) - conf.find_program("clang-tidy", var="CLANG_TIDY", mandatory=False) - conf.find_program("iwyu_tool", var="IWYU_TOOL", mandatory=False) - - if Options.options.ultra_strict: - autowaf.add_compiler_flags(conf.env, '*', { - 'clang': [ - '-Wno-documentation-unknown-command', - '-Wno-nullability-extension', - ] - }) - - autowaf.add_compiler_flags(conf.env, 'c', { - 'clang': [ - '-Wno-cast-align', - '-Wno-cast-qual', - '-Wno-double-promotion', - '-Wno-float-equal', - '-Wno-format-nonliteral', - '-Wno-implicit-float-conversion', - '-Wno-implicit-int-conversion', - '-Wno-padded', - '-Wno-reserved-id-macro', - '-Wno-shorten-64-to-32', - '-Wno-sign-conversion', - '-Wno-switch-enum', - '-Wno-vla', - ], - 'gcc': [ - '-Wno-cast-align', - '-Wno-cast-qual', - '-Wno-conversion', - '-Wno-double-promotion', - '-Wno-float-equal', - '-Wno-padded', - '-Wno-stack-protector', - '-Wno-suggest-attribute=const', - '-Wno-suggest-attribute=pure', - '-Wno-switch-enum', - '-Wno-vla', - ], - 'msvc': [ - '/wd4061', # enumerator in switch is not explicitly handled - '/wd4365', # signed/unsigned mismatch - '/wd4514', # unreferenced inline function has been removed - '/wd4774', # format string is not a string literal - '/wd4820', # padding added after construct - '/wd4996', # POSIX name for this item is deprecated - ], - }) - - autowaf.add_compiler_flags(conf.env, 'cxx', { - 'clang': [ - '-Wno-extra-semi', - ], - 'gcc': [ - '-Wno-effc++', - '-Wno-extra-semi', - '-Wno-pedantic', - ], - }) - - conf.check_pkg('lv2 >= 1.18.0', uselib_store='LV2') - conf.check_pkg('serd-0 >= 0.30.0', uselib_store='SERD') - conf.check_pkg('sord-0 >= 0.14.0', uselib_store='SORD') - conf.check_pkg('sratom-0 >= 0.4.0', uselib_store='SRATOM') - conf.check_pkg('sndfile >= 1.0.0', uselib_store='SNDFILE', mandatory=False) - - defines = ['_POSIX_C_SOURCE=200809L', '_BSD_SOURCE', '_DEFAULT_SOURCE'] - if conf.env.DEST_OS == 'darwin': - defines += ['_DARWIN_C_SOURCE'] - - rt_lib = ['rt'] - if conf.env.DEST_OS == 'darwin' or conf.env.DEST_OS == 'win32': - rt_lib = [] - - conf.check_function('c', 'lstat', - header_name = ['sys/stat.h'], - defines = defines, - define_name = 'HAVE_LSTAT', - return_type = 'int', - arg_types = 'const char*, struct stat*', - mandatory = False) - - conf.check_function('c', 'flock', - header_name = 'sys/file.h', - defines = defines, - define_name = 'HAVE_FLOCK', - return_type = 'int', - arg_types = 'int, int', - mandatory = False) - - conf.check_function('c', 'fileno', - header_name = 'stdio.h', - defines = defines, - define_name = 'HAVE_FILENO', - return_type = 'int', - arg_types = 'FILE*', - mandatory = False) - - conf.check_function('c', 'clock_gettime', - header_name = ['sys/time.h', 'time.h'], - defines = ['_POSIX_C_SOURCE=200809L'], - define_name = 'HAVE_CLOCK_GETTIME', - uselib_store = 'CLOCK_GETTIME', - lib = rt_lib, - return_type = 'int', - arg_types = 'clockid_t, struct timespec*', - mandatory = False) - - conf.check_cc(define_name = 'HAVE_LIBDL', - lib = 'dl', - mandatory = False) - - if Options.options.dyn_manifest: - conf.define('LILV_DYN_MANIFEST', 1) - - lilv_path_sep = ':' - lilv_dir_sep = '/' - if conf.env.DEST_OS == 'win32': - lilv_path_sep = ';' - lilv_dir_sep = '\\\\' - - conf.define('LILV_PATH_SEP', lilv_path_sep) - conf.define('LILV_DIR_SEP', lilv_dir_sep) - - # Set default LV2 path - lv2_path = Options.options.default_lv2_path - if lv2_path == '': - if conf.env.DEST_OS == 'darwin': - lv2_path = lilv_path_sep.join(['~/Library/Audio/Plug-Ins/LV2', - '~/.lv2', - '/usr/local/lib/lv2', - '/usr/lib/lv2', - '/Library/Audio/Plug-Ins/LV2']) - elif conf.env.DEST_OS == 'haiku': - lv2_path = lilv_path_sep.join(['~/.lv2', - '/boot/common/add-ons/lv2']) - elif conf.env.DEST_OS == 'win32': - lv2_path = lilv_path_sep.join(['%APPDATA%\\\\LV2', - '%COMMONPROGRAMFILES%\\\\LV2']) - else: - libdirname = os.path.basename(conf.env.LIBDIR) - lv2_path = lilv_path_sep.join(['~/.lv2', - '/usr/%s/lv2' % libdirname, - '/usr/local/%s/lv2' % libdirname]) - - if sys.platform == 'win32': - lv2_path = lv2_path.replace('%', '%%') - - conf.define('LILV_DEFAULT_LV2_PATH', lv2_path) - - # Set up environment for building/using as a subproject - autowaf.set_lib_env(conf, 'lilv', LILV_VERSION, - include_path=str(conf.path.find_node('include'))) - - conf.define('LILV_NO_DEFAULT_CONFIG', 1) - - autowaf.display_summary( - conf, - {'Default LV2_PATH': lv2_path, - 'Utilities': bool(conf.env.BUILD_UTILS), - 'Unit tests': bool(conf.env.BUILD_TESTS), - 'Dynamic manifest support': conf.is_defined('LILV_DYN_MANIFEST'), - 'Python bindings': bool(conf.env.LILV_PYTHON)}) - - -def build_util(bld, name, defines, libs=''): - obj = bld(features = 'c cprogram', - source = name + '.c', - includes = ['.', 'include', './src', './utils'], - use = 'liblilv', - uselib = 'SERD SORD SRATOM LV2 ' + libs, - target = name, - defines = defines, - install_path = '${BINDIR}') - if not bld.env.BUILD_SHARED or bld.env.STATIC_PROGS: - obj.use = 'liblilv_static' - if bld.env.STATIC_PROGS: - if not bld.env.MSVC_COMPILER: - obj.lib = ['m'] - obj.env.SHLIB_MARKER = obj.env.STLIB_MARKER - obj.linkflags = ['-static', '-Wl,--start-group'] - return obj - - -def build(bld): - # C/C++ Headers - includedir = '${INCLUDEDIR}/lilv-%s/lilv' % LILV_MAJOR_VERSION - bld.install_files(includedir, bld.path.ant_glob('include/lilv/*.h')) - bld.install_files(includedir, bld.path.ant_glob('include/lilv/*.hpp')) - - lib_source = ''' - src/collections.c - src/filesystem.c - src/instance.c - src/lib.c - src/node.c - src/plugin.c - src/pluginclass.c - src/port.c - src/query.c - src/scalepoint.c - src/state.c - src/ui.c - src/util.c - src/world.c - src/zix/tree.c - '''.split() - - lib = [] - libflags = ['-fvisibility=hidden'] - defines = [] - if bld.is_defined('HAVE_LIBDL'): - lib += ['dl'] - if bld.env.DEST_OS == 'win32': - lib = [] - if bld.env.MSVC_COMPILER: - libflags = [] - - # Pkgconfig file - autowaf.build_pc(bld, 'LILV', LILV_VERSION, LILV_MAJOR_VERSION, [], - {'LILV_MAJOR_VERSION': LILV_MAJOR_VERSION, - 'LILV_PKG_DEPS': 'lv2 serd-0 sord-0 sratom-0', - 'LILV_PKG_LIBS': ' -l'.join([''] + lib)}) - - # Shared Library - if bld.env.BUILD_SHARED: - obj = bld(features = 'c cshlib', - export_includes = ['.', 'include'], - source = lib_source, - includes = ['.', 'include', './src'], - name = 'liblilv', - target = 'lilv-%s' % LILV_MAJOR_VERSION, - vnum = LILV_VERSION, - install_path = '${LIBDIR}', - defines = ['LILV_INTERNAL', 'ZIX_STATIC'], - cflags = libflags, - lib = lib, - uselib = 'SERD SORD SRATOM LV2') - - # Static library - if bld.env.BUILD_STATIC: - obj = bld(features = 'c cstlib', - export_includes = ['.', 'include'], - source = lib_source, - includes = ['.', 'include', './src'], - name = 'liblilv_static', - target = 'lilv-%s' % LILV_MAJOR_VERSION, - vnum = LILV_VERSION, - install_path = '${LIBDIR}', - defines = defines + ['LILV_STATIC', - 'LILV_INTERNAL', - 'ZIX_STATIC', - 'ZIX_INTERNAL'], - uselib = 'SERD SORD SRATOM LV2') - - # Python bindings - if bld.env.LILV_PYTHON: - bld(features = 'subst', - is_copy = True, - source = 'bindings/python/lilv.py', - target = 'lilv.py', - install_path = '${PYTHONDIR}') - - if bld.env.BUILD_TESTS: - import re - - test_libs = lib - test_cflags = [''] - test_linkflags = [''] - if not bld.env.NO_COVERAGE: - test_cflags += ['--coverage'] - test_linkflags += ['--coverage'] - - # Copy skeleton LV2 bundle for tests - for name in ('manifest.ttl', 'lv2core.ttl'): - bld(features = 'subst', - is_copy = True, - source = 'test/core.lv2/' + name, - target = 'test/test_lv2_path/core.lv2/' + name, - install_path = None) - - # Make a pattern for shared objects without the 'lib' prefix - module_pattern = re.sub('^lib', '', bld.env.cshlib_PATTERN) - shlib_ext = module_pattern[module_pattern.rfind('.'):] - - for p in ['test'] + test_plugins: - obj = bld(features = 'c cshlib', - source = 'test/%s.lv2/%s.c' % (p, p), - name = p, - target = 'test/%s.lv2/%s' % (p, p), - install_path = None, - defines = defines + ['LILV_STATIC', 'ZIX_STATIC'], - cflags = test_cflags, - linkflags = test_linkflags, - lib = test_libs, - uselib = 'LV2') - obj.env.cshlib_PATTERN = module_pattern - - for p in test_plugins: - if not bld.path.find_node('test/%s.lv2/test_%s.c' % (p, p)): - continue - - obj = bld(features = 'c cprogram', - source = 'test/%s.lv2/test_%s.c' % (p, p), - target = 'test/test_%s' % p, - includes = ['.', 'include', './src'], - use = 'liblilv_profiled', - install_path = None, - defines = defines + ['LILV_STATIC', 'ZIX_STATIC'], - cflags = test_cflags, - linkflags = test_linkflags, - lib = test_libs, - uselib = 'SERD SORD SRATOM LV2') - - # Test plugin data files - for p in ['test'] + test_plugins: - for i in ['manifest.ttl.in', p + '.ttl.in']: - bundle = 'test/%s.lv2/' % p - bld(features = 'subst', - source = bundle + i, - target = bundle + i.replace('.in', ''), - install_path = None, - SHLIB_EXT = shlib_ext) - - # Static profiled library (for unit test code coverage) - obj = bld(features = 'c cstlib', - source = lib_source, - includes = ['.', 'include', './src'], - name = 'liblilv_profiled', - target = 'lilv_profiled', - install_path = None, - defines = defines + ['LILV_STATIC', - 'LILV_INTERNAL', - 'ZIX_STATIC', - 'ZIX_INTERNAL', - ], - cflags = test_cflags, - linkflags = test_linkflags, - lib = test_libs, - uselib = 'SERD SORD SRATOM LV2') - - # Unit test program - testdir = bld.path.get_bld().make_node('test').abspath() - bpath = os.path.join(testdir, 'test.lv2') - bpath = bpath.replace('\\', '/') - testdir = testdir.replace('\\', '/') - for test in tests: - obj = bld(features = 'c cprogram', - source = ['test/%s.c' % test, - 'test/lilv_test_utils.c'], - includes = ['.', 'include', './src'], - use = 'liblilv_profiled', - lib = test_libs, - uselib = 'SERD SORD SRATOM LV2', - target = 'test/' + test, - install_path = None, - defines = (defines + - ['LILV_STATIC'] + - ['LILV_TEST_BUNDLE=\"%s/\"' % bpath] + - ['LILV_TEST_DIR=\"%s/\"' % testdir] + - ['ZIX_STATIC']), - cflags = test_cflags, - linkflags = test_linkflags) - - # C++ API test - if 'COMPILER_CXX' in bld.env: - obj = bld(features = 'cxx cxxprogram', - source = 'test/lilv_cxx_test.cpp', - includes = ['.', 'include', './src'], - use = 'liblilv_profiled', - lib = test_libs, - uselib = 'SERD SORD SRATOM LV2', - target = 'test/lilv_cxx_test', - install_path = None, - defines = ['LILV_STATIC', 'ZIX_STATIC'], - cxxflags = test_cflags, - linkflags = test_linkflags) - - if bld.env.LILV_PYTHON: - test_bundle = 'bindings/bindings_test_plugin.lv2/' - - # Copy Python unittest files - for i in ['test_api.py']: - bld(features = 'subst', - is_copy = True, - source = 'bindings/test/python/' + i, - target = 'bindings/' + i, - install_path = None) - - # Build bindings test plugin - obj = bld(features = 'c cshlib', - source = 'bindings/test/bindings_test_plugin.c', - name = 'bindings_test_plugin', - target = test_bundle + '/bindings_test_plugin', - install_path = None, - defines = defines, - cflags = test_cflags, - linkflags = test_linkflags, - lib = test_libs, - uselib = 'LV2') - obj.env.cshlib_PATTERN = module_pattern - - # Bindings test plugin data files - for i in ['manifest.ttl.in', 'bindings_test_plugin.ttl.in']: - bld(features = 'subst', - source = 'bindings/test/' + i, - target = test_bundle + i.replace('.in', ''), - install_path = None, - SHLIB_EXT = shlib_ext) - - # Utilities - if bld.env.BUILD_UTILS: - utils = ''' - utils/lilv-bench - utils/lv2info - utils/lv2ls - ''' - for i in utils.split(): - build_util(bld, i, defines) - - if bld.env.HAVE_SNDFILE: - obj = build_util(bld, 'utils/lv2apply', defines, 'SNDFILE') - - # lv2bench (less portable than other utilities) - if (bld.env.DEST_OS != 'win32' and - bld.is_defined('HAVE_CLOCK_GETTIME') and - not bld.env.STATIC_PROGS): - obj = build_util(bld, 'utils/lv2bench', defines) - if bld.env.DEST_OS != 'darwin': - obj.lib = ['rt'] - - # Documentation - if bld.env.DOCS: - bld.recurse('doc/c') - - # Man pages - bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1')) - - # Bash completion - if bld.env.BASH_COMPLETION: - bld.install_as('${SYSCONFDIR}/bash_completion.d/lilv', - 'utils/lilv.bash_completion') - - bld.add_post_fun(autowaf.run_ldconfig) - - -def test(tst): - with tst.group('unit') as check: - for test in tests: - check(['./test/' + test]) - - if tst.is_defined('LILV_CXX'): - check(['./test/lilv_cxx_test']) - - if tst.env.LILV_PYTHON: - with tst.group('python') as check: - check(['python', '-m', 'unittest', 'discover', 'bindings/']) - - with tst.group('plugin') as check: - for p in test_plugins: - prog_name = tst.env.cprogram_PATTERN % ('test_' + p) - if os.path.exists(os.path.join('test', prog_name)): - check(['./test/test_' + p, 'test/%s.lv2/' % p]) - - try: - shutil.rmtree('state') - except Exception: - pass - - -class LintContext(Build.BuildContext): - fun = cmd = 'lint' - - -def lint(ctx): - "checks code for style issues" - import subprocess - - st = 0 - - if "FLAKE8" in ctx.env: - Logs.info("Running flake8") - st = subprocess.call([ctx.env.FLAKE8[0], - "wscript", - "--ignore", - "E101,E129,W191,E221,W504,E251,E241,E741"]) - else: - Logs.warn("Not running flake8") - - if "IWYU_TOOL" in ctx.env: - Logs.info("Running include-what-you-use") - cmd = [ctx.env.IWYU_TOOL[0], "-o", "clang", "-p", "build"] - output = subprocess.check_output(cmd).decode('utf-8') - if 'error: ' in output: - sys.stdout.write(output) - st += 1 - else: - Logs.warn("Not running include-what-you-use") - - if "CLANG_TIDY" in ctx.env and "clang" in ctx.env.CC[0]: - Logs.info("Running clang-tidy") - sources = glob.glob('src/*.c') + glob.glob('tests/*.c') - sources = list(map(os.path.abspath, sources)) - procs = [] - for source in sources: - cmd = [ctx.env.CLANG_TIDY[0], "--quiet", "-p=.", source] - procs += [subprocess.Popen(cmd, cwd="build")] - - for proc in procs: - stdout, stderr = proc.communicate() - st += proc.returncode - else: - Logs.warn("Not running clang-tidy") - - if st != 0: - sys.exit(st) |