summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-14 11:50:43 -0400
committerDavid Robillard <d@drobilla.net>2022-07-18 20:18:28 -0400
commit55dc97a32eeeb42012ce1e7d28ed99ea537f4d2f (patch)
treec0fc78d78609c1bd3e880499bd0e80a4498b0be3
parent891f4044c92117517041c9e7ee4099b75bd493da (diff)
downloadlilv-55dc97a32eeeb42012ce1e7d28ed99ea537f4d2f.tar.gz
lilv-55dc97a32eeeb42012ce1e7d28ed99ea537f4d2f.tar.bz2
lilv-55dc97a32eeeb42012ce1e7d28ed99ea537f4d2f.zip
Switch to meson build system
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules3
-rw-r--r--INSTALL66
-rw-r--r--INSTALL.md70
-rw-r--r--NEWS3
-rw-r--r--bindings/python/meson.build9
-rw-r--r--doc/c/Doxyfile.in (renamed from doc/c/Doxyfile)6
-rw-r--r--doc/c/api/meson.build6
-rw-r--r--doc/c/meson.build47
-rw-r--r--doc/c/wscript43
-rw-r--r--doc/c/xml/meson.build18
-rw-r--r--doc/meson.build19
-rw-r--r--lilv.pc.in11
-rw-r--r--meson.build201
-rw-r--r--meson/library/meson.build31
-rw-r--r--meson/suppressions/meson.build102
-rw-r--r--meson/warnings/meson.build175
-rw-r--r--meson_options.txt17
-rw-r--r--src/filesystem.c8
-rw-r--r--src/util.c1
-rw-r--r--test/bad_syntax.lv2/meson.build25
-rw-r--r--test/failed_instantiation.lv2/meson.build25
-rw-r--r--test/failed_lib_descriptor.lv2/meson.build25
-rw-r--r--test/lib_descriptor.lv2/meson.build25
-rw-r--r--test/lilv_test_uri_map.h9
-rw-r--r--test/lilv_test_utils.c4
-rw-r--r--test/lv2/core.lv2/lv2core.ttl (renamed from test/core.lv2/lv2core.ttl)0
-rw-r--r--test/lv2/core.lv2/manifest.ttl (renamed from test/core.lv2/manifest.ttl)0
-rw-r--r--test/lv2/core.lv2/meson.build8
-rw-r--r--test/meson.build80
-rw-r--r--test/missing_descriptor.lv2/meson.build25
-rw-r--r--test/missing_name.lv2/meson.build25
-rw-r--r--test/missing_plugin.lv2/meson.build25
-rw-r--r--test/missing_port.lv2/meson.build25
-rw-r--r--test/missing_port_name.lv2/meson.build25
-rw-r--r--test/new_version.lv2/meson.build17
-rw-r--r--test/old_version.lv2/meson.build17
-rw-r--r--test/test_plugin.lv2/manifest.ttl.in (renamed from test/test.lv2/manifest.ttl.in)4
-rw-r--r--test/test_plugin.lv2/meson.build17
-rw-r--r--test/test_plugin.lv2/test_plugin.c (renamed from test/test.lv2/test.c)2
-rw-r--r--test/test_plugin.lv2/test_plugin.ttl.in (renamed from test/test.lv2/test.ttl.in)0
-rw-r--r--test/test_string.c2
-rw-r--r--tools/bench.h (renamed from utils/bench.h)2
-rw-r--r--tools/lilv.bash_completion (renamed from utils/lilv.bash_completion)0
-rw-r--r--tools/lv2apply.c (renamed from utils/lv2apply.c)0
-rw-r--r--tools/lv2bench.c (renamed from utils/lv2bench.c)2
-rw-r--r--tools/lv2info.c (renamed from utils/lv2info.c)0
-rw-r--r--tools/lv2ls.c (renamed from utils/lv2ls.c)0
-rw-r--r--tools/meson.build83
-rw-r--r--tools/uri_table.h (renamed from utils/uri_table.h)0
-rw-r--r--utils/lilv-bench.c34
-rwxr-xr-xwaf27
m---------waflib0
-rw-r--r--wscript643
54 files changed, 1155 insertions, 859 deletions
diff --git a/.gitignore b/.gitignore
index 204c242..467d5b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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/INSTALL b/INSTALL
deleted file mode 100644
index 9b54f51..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,66 +0,0 @@
-Installation Instructions
-=========================
-
-Basic Installation
-------------------
-
-Building this software requires only Python. To install with default options:
-
- ./waf configure
- ./waf
- ./waf install # or sudo ./waf install
-
-Configuration Options
----------------------
-
-All supported options can be viewed using the command:
-
- ./waf --help
-
-Most options only need to be passed during the configure stage, for example:
-
- ./waf configure --prefix=/usr
- ./waf
- ./waf install
-
-Compiler Configuration
-----------------------
-
-Several standard environment variables can be used to control how compilers are
-invoked:
-
- * CC: Path to C compiler
- * CFLAGS: C compiler options
- * CXX: Path to C++ compiler
- * CXXFLAGS: C++ compiler options
- * CPPFLAGS: C preprocessor options
- * LINKFLAGS: Linker options
-
-Library Versioning
-------------------
-
-This library uses semantic versioning <http://semver.org/>.
-
-Several major versions can be installed in parallel. The shared library name,
-include directory, and pkg-config file are suffixed with the major version
-number. For example, a library named "foo" at version 1.x.y might install:
-
- /usr/include/foo-1/foo/foo.h
- /usr/lib/foo-1.so.1.x.y
- /usr/lib/pkgconfig/foo-1.pc
-
-Dependencies can check for the package "foo-1" with pkg-config.
-
-Packaging
----------
-
-Everything can be installed to a specific root directory by passing a --destdir
-option to the install stage (or setting the DESTDIR environment variable),
-which adds a prefix to all install paths. For example:
-
- ./waf configure --prefix=/usr
- ./waf
- ./waf install --destdir=/tmp/package
-
-Packages should allow parallel installation of several major versions. For
-example, the above would be packaged as "foo-1". \ No newline at end of file
diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 0000000..7109c35
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,70 @@
+Installation Instructions
+=========================
+
+Prerequisites
+-------------
+
+To build from source, you will need:
+
+ * A relatively modern C compiler (GCC, Clang, and MSVC are known to work).
+
+ * [Meson](http://mesonbuild.com/), which depends on
+ [Python](http://python.org/).
+
+This is a brief overview of building this project with meson. See the meson
+documentation for more detailed information.
+
+Configuration
+-------------
+
+The build is configured with the `setup` command, which creates a new build
+directory with the given name:
+
+ meson setup build
+
+Some environment variables are read during `setup` and stored with the
+configuration:
+
+ * `CC`: Path to C compiler.
+ * `CFLAGS`: C compiler options.
+ * `LDFLAGS`: Linker options.
+
+However, it is better to use meson options for configuration. All options can
+be inspected with the `configure` command from within the build directory:
+
+ cd build
+ meson configure
+
+Options can be set by passing C-style "define" options to `configure`:
+
+ meson configure -Dc_args="-march=native" -Dprefix="/opt/mypackage/"
+
+Building
+--------
+
+From within a configured build directory, everything can be built with the
+`compile` command:
+
+ meson compile
+
+Similarly, tests can be run with the `test` command:
+
+ meson test
+
+Meson can also generate a project for several popular IDEs, see the `backend`
+option for details.
+
+Installation
+------------
+
+A compiled project can be installed with the `install` command:
+
+ meson install
+
+You may need to acquire root permissions to install to a system-wide prefix.
+For packaging, the installation may be staged to a directory using the
+`DESTDIR` environment variable or the `--destdir` option:
+
+ DESTDIR=/tmp/mypackage/ meson install
+
+ meson install --destdir=/tmp/mypackage/
diff --git a/NEWS b/NEWS
index aa0f786..4ef15c1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
lilv (0.24.15) unstable;
* Fix fallback flock() detection on MacOS
+ * Switch to meson build system
- -- David Robillard <d@drobilla.net> Fri, 17 Jun 2022 01:12:49 +0000
+ -- David Robillard <d@drobilla.net> Sat, 09 Jul 2022 01:14:22 +0000
lilv (0.24.14) stable;
diff --git a/bindings/python/meson.build b/bindings/python/meson.build
new file mode 100644
index 0000000..350b0fe
--- /dev/null
+++ b/bindings/python/meson.build
@@ -0,0 +1,9 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+pymod = import('python')
+py = pymod.find_installation('python3', required: get_option('bindings_py'))
+
+if py.found()
+ py.install_sources(files('lilv.py'))
+endif
diff --git a/doc/c/Doxyfile b/doc/c/Doxyfile.in
index ce10524..70abb39 100644
--- a/doc/c/Doxyfile
+++ b/doc/c/Doxyfile.in
@@ -21,6 +21,8 @@ SHOW_FILES = NO
MACRO_EXPANSION = YES
PREDEFINED = LILV_API LILV_DEPRECATED
-INPUT = ../../include/lilv/lilv.h
+RECURSIVE = YES
+STRIP_FROM_PATH = @LILV_SRCDIR@
+INPUT = @LILV_SRCDIR@/include
-OUTPUT_DIRECTORY = .
+OUTPUT_DIRECTORY = @DOX_OUTPUT@
diff --git a/doc/c/api/meson.build b/doc/c/api/meson.build
new file mode 100644
index 0000000..4717825
--- /dev/null
+++ b/doc/c/api/meson.build
@@ -0,0 +1,6 @@
+c_lilv_rst = custom_target(
+ 'lilv.rst',
+ command: [dox_to_sphinx, '-f', '@INPUT0@', '@OUTDIR@'],
+ input: [c_index_xml] + c_rst_files,
+ output: 'lilv.rst',
+)
diff --git a/doc/c/meson.build b/doc/c/meson.build
new file mode 100644
index 0000000..f75dc74
--- /dev/null
+++ b/doc/c/meson.build
@@ -0,0 +1,47 @@
+config = configuration_data()
+config.set('LILV_VERSION', meson.project_version())
+
+conf_py = configure_file(configuration: config,
+ input: files('../conf.py.in'),
+ output: 'conf.py')
+
+configure_file(copy: true,
+ input: files('../summary.rst'),
+ output: 'summary.rst')
+
+c_rst_files = files(
+ 'index.rst',
+ 'overview.rst',
+ 'plugins.rst',
+ 'uis.rst',
+ 'world.rst',
+)
+
+foreach f : c_rst_files
+ configure_file(copy: true, input: f, output: '@PLAINNAME@')
+endforeach
+
+subdir('xml')
+subdir('api')
+
+docs = custom_target(
+ 'singlehtml',
+ build_by_default: true,
+ command: [sphinx_build, '-M', 'singlehtml', '@OUTDIR@', '@OUTDIR@',
+ '-E', '-q', '-t', 'singlehtml'],
+ input: [c_rst_files, c_lilv_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / 'lilv-0',
+ output: 'singlehtml',
+)
+
+docs = custom_target(
+ 'html',
+ build_by_default: true,
+ command: [sphinx_build, '-M', 'html', '@OUTDIR@', '@OUTDIR@',
+ '-E', '-q', '-t', 'html'],
+ input: [c_rst_files, c_lilv_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / 'lilv-0',
+ output: 'html',
+)
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/doc/c/xml/meson.build b/doc/c/xml/meson.build
new file mode 100644
index 0000000..6de27f9
--- /dev/null
+++ b/doc/c/xml/meson.build
@@ -0,0 +1,18 @@
+doxygen = find_program('doxygen')
+
+config = configuration_data()
+config.set('LILV_SRCDIR', lilv_src_root)
+config.set('DOX_OUTPUT', meson.current_build_dir() / '..')
+
+c_doxyfile = configure_file(
+ configuration: config,
+ input: files('../Doxyfile.in'),
+ output: 'Doxyfile',
+)
+
+c_index_xml = custom_target(
+ 'index.xml',
+ command: [doxygen, '@INPUT0@'],
+ input: [c_doxyfile] + c_headers,
+ output: 'index.xml',
+)
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..efa9d71
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,19 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+docdir = get_option('datadir') / 'doc'
+
+doxygen = find_program('doxygen', required: get_option('docs'))
+dox_to_sphinx = files('../scripts/dox_to_sphinx.py')
+sphinx_build = find_program('sphinx-build', required: get_option('docs'))
+
+build_docs = doxygen.found() and sphinx_build.found()
+
+if build_docs
+ subdir('c')
+endif
+
+if not meson.is_subproject()
+ summary('Documentation', build_docs, bool_yn: true)
+endif
+
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..f36873b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,201 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+project('lilv', ['c'],
+ version: '0.24.15',
+ license: 'ISC',
+ meson_version: '>= 0.56.0',
+ default_options: [
+ 'b_ndebug=if-release',
+ 'buildtype=release',
+ 'c_std=c99',
+ ])
+
+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
+
+#######################
+# Compilers and Flags #
+#######################
+
+# Load build tools
+pkg = import('pkgconfig')
+cc = meson.get_compiler('c')
+
+# Set global warning flags
+if get_option('strict') and not meson.is_subproject()
+ subdir('meson/warnings')
+endif
+subdir('meson/suppressions')
+
+##########################
+# Platform Configuration #
+##########################
+
+platform_defines = ['-DLILV_VERSION="@0@"'.format(meson.project_version())]
+if host_machine.system() == 'darwin'
+ platform_defines += [
+ '-D_DARWIN_C_SOURCE',
+ ]
+elif host_machine.system() in ['gnu', 'linux']
+ platform_defines += [
+ '-D_DEFAULT_SOURCE',
+ '-D_POSIX_C_SOURCE=200809L',
+ ]
+endif
+
+add_project_arguments(platform_defines, language: ['c'])
+
+################
+# Dependencies #
+################
+
+m_dep = cc.find_library('m', required: false)
+dl_dep = cc.find_library('dl', required: false)
+
+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'])
+
+###########
+# Library #
+###########
+
+c_headers = files('include/lilv/lilv.h')
+cpp_headers = files('include/lilv/lilvmm.hpp')
+
+sources = files(
+ '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',
+)
+
+# Set appropriate arguments for building against the library type
+extra_c_args = []
+subdir('meson/library')
+if get_option('default_library') == 'static'
+ extra_c_args = ['-DLILV_STATIC']
+endif
+
+# Build main shared and/or static library
+liblilv = library(
+ meson.project_name() + library_suffix,
+ sources,
+ c_args: c_suppressions + extra_c_args + ['-DLILV_INTERNAL', '-DZIX_STATIC'],
+ dependencies: [m_dep, dl_dep, lv2_dep, serd_dep, sord_dep, sratom_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_directories('include', 'src'),
+ install: true,
+ version: meson.project_version(),
+)
+
+# Declare dependency for internal meson dependants
+lilv_dep = declare_dependency(
+ compile_args: extra_c_args,
+ dependencies: [m_dep, dl_dep, lv2_dep, serd_dep, sord_dep, sratom_dep],
+ include_directories: include_directories('include'),
+ link_with: liblilv,
+)
+
+# Generage pkg-config file for external dependants
+pkg.generate(
+ liblilv,
+ description: 'Library for hosting LV2 plugins',
+ extra_cflags: extra_c_args,
+ filebase: versioned_name,
+ name: 'Lilv',
+ subdirs: [versioned_name],
+ version: meson.project_version(),
+)
+
+# Install headers to a versioned include directory
+install_headers(c_headers, subdir: versioned_name / 'lilv')
+install_headers(cpp_headers, subdir: versioned_name / 'lilv')
+
+#########
+# Tools #
+#########
+
+subdir('tools')
+
+############
+# Bindings #
+############
+
+subdir('bindings/python')
+
+###########
+# Support #
+###########
+
+if not get_option('docs').disabled()
+ subdir('doc')
+endif
+
+if not get_option('tests').disabled()
+ # Get or build a static library for linking internal tests
+ if get_option('default_library') == 'both'
+ liblilv_static = liblilv.get_static_lib()
+ elif get_option('default_library') == 'shared'
+ liblilv_static = static_library(
+ meson.project_name() + library_suffix,
+ sources,
+ include_directories: include_directories('include', 'src'),
+ c_args: c_suppressions + ['-DLILV_INTERNAL', '-DLILV_STATIC', '-DZIX_STATIC'],
+ 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(
+ compile_args: extra_c_args,
+ dependencies: [m_dep, dl_dep, lv2_dep, serd_dep, sord_dep, sratom_dep],
+ include_directories: include_directories('include'),
+ link_with: liblilv_static,
+ )
+
+ # Build and run tests against static library
+ subdir('test')
+endif
+
+if not meson.is_subproject()
+ summary('Tests', not get_option('tests').disabled(), bool_yn: true)
+ summary('Tools', not get_option('tools').disabled(), 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 not get_option('tools').disabled()
+ summary('Executables', get_option('prefix') / get_option('bindir'))
+ summary('Man pages', get_option('prefix') / get_option('mandir'))
+ endif
+endif
diff --git a/meson/library/meson.build b/meson/library/meson.build
new file mode 100644
index 0000000..fffc831
--- /dev/null
+++ b/meson/library/meson.build
@@ -0,0 +1,31 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# General definitions for building libraries.
+#
+# These are essentially workarounds for Meson/Windows/MSVC. Unfortunately,
+# Meson's default_library option doesn't support shared and static builds very
+# well. In particular, it's often necessary to define different symbols for
+# static and shared builds of libraries so that symbols can be exported. To
+# work around this, default_library=both isn't supported on Windows. On other
+# platforms with GCC-like compilers, we can support both because symbols can
+# safely be exported in the same way (giving them default visibility) in both
+# static and shared builds.
+
+default_library = get_option('default_library')
+host_system = host_machine.system()
+
+# Abort on Windows with default_library=both
+if host_system == 'windows' and default_library == 'both'
+ error('default_library=both is not supported on Windows')
+endif
+
+# Set library_suffix to the suffix for libraries
+if host_system == 'windows' and default_library == 'shared'
+ # Meson appends a version to the name only for DLLs, which leads to
+ # inconsistent library names, like `mylib-1-1`. So, provide no suffix to
+ # ultimately get the same name as on other platforms, like `mylib-1`.
+ library_suffix = ''
+else
+ library_suffix = '-@0@'.format(meson.project_version().split('.')[0])
+endif
diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build
new file mode 100644
index 0000000..d0593f2
--- /dev/null
+++ b/meson/suppressions/meson.build
@@ -0,0 +1,102 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# Project-specific warning suppressions.
+#
+# This should be used in conjunction with the generic "warnings" sibling that
+# enables all reasonable warnings for the compiler. It lives here just to keep
+# the top-level meson.build more readable.
+
+#####
+# C #
+#####
+
+if is_variable('cc')
+ c_suppressions = []
+
+ if get_option('strict')
+ if cc.get_id() == 'clang'
+ c_suppressions += [
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-declaration-after-statement',
+ '-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',
+ ]
+
+ if host_machine.system() == 'darwin'
+ c_suppressions += [
+ '-Wno-unused-macros',
+ ]
+ elif host_machine.system() == 'freebsd'
+ c_suppressions += [
+ '-Wno-c11-extensions',
+ ]
+ endif
+
+ elif cc.get_id() == 'gcc'
+ c_suppressions += [
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-conversion',
+ '-Wno-double-promotion',
+ '-Wno-float-equal',
+ '-Wno-format-nonliteral',
+ '-Wno-format-truncation',
+ '-Wno-inline',
+ '-Wno-padded',
+ '-Wno-stack-protector',
+ '-Wno-strict-overflow',
+ '-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',
+ ]
+
+ if host_machine.system() =='windows'
+ c_suppressions += [
+ '-Wno-bad-function-cast',
+ '-Wno-unused-macros',
+ ]
+ endif
+
+ elif cc.get_id() == 'msvc'
+ c_suppressions += [
+ '/wd4061', # enumerator in switch is not explicitly handled
+ '/wd4090', # different const qualifiers
+ '/wd4191', # unsafe conversion from FARPROC
+ '/wd4244', # conversion from floating point, possible loss of data
+ '/wd4267', # conversion from size_t, possible loss of data
+ '/wd4365', # signed/unsigned mismatch
+ '/wd4514', # unreferenced inline function has been removed
+ '/wd4706', # assignment within conditional expression
+ '/wd4710', # function not inlined
+ '/wd4711', # function selected for automatic inline expansion
+ '/wd4774', # format string is not a string literal
+ '/wd4800', # implicit conversion to bool
+ '/wd4820', # padding added after construct
+ '/wd4996', # POSIX name for this item is deprecated
+ '/wd5045', # will insert Spectre mitigation for memory load
+ ]
+ endif
+
+ endif
+
+ c_suppressions = cc.get_supported_arguments(c_suppressions)
+endif
diff --git a/meson/warnings/meson.build b/meson/warnings/meson.build
new file mode 100644
index 0000000..4d23ad3
--- /dev/null
+++ b/meson/warnings/meson.build
@@ -0,0 +1,175 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# General code to enable approximately all warnings in GCC 12, clang, and MSVC.
+#
+# This is trivial for clang and MSVC, but GCC doesn't have an "everything"
+# option, so we need to enable everything we want explicitly. Wall is assumed,
+# but Wextra is not, for stability.
+#
+# These are collected from common.opt and c.opt in the GCC source, and manually
+# curated with the help of the GCC documentation. Warnings that are
+# application-specific, historical, or about compatibility between specific
+# language revisions are omitted. The intent here is to have roughly the same
+# meaning as clang's Weverything: extremely strict, but general. Specifically
+# omitted are:
+#
+# General:
+#
+# 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
+#
+# Build specific:
+#
+# Wpoison-system-directories
+#
+# C Specific:
+#
+# Wc11-c2x-compat
+# Wc90-c99-compat
+# Wc99-c11-compat
+# Wdeclaration-after-statement
+# Wtraditional
+# Wtraditional-conversion
+#
+# C++ Specific:
+#
+# Wc++0x-compat
+# Wc++1z-compat
+# Wc++2a-compat
+# Wctad-maybe-unsupported
+# Wnamespaces
+# Wtemplates
+
+# GCC warnings that apply to all C-family languages
+gcc_common_warnings = [
+ '-Walloc-zero',
+ '-Walloca',
+ '-Wanalyzer-too-complex',
+ '-Warith-conversion',
+ '-Warray-bounds=2',
+ '-Wattribute-alias=2',
+ '-Wbidi-chars=ucn',
+ '-Wcast-align=strict',
+ '-Wcast-function-type',
+ '-Wcast-qual',
+ '-Wclobbered',
+ '-Wconversion',
+ '-Wdate-time',
+ '-Wdisabled-optimization',
+ '-Wdouble-promotion',
+ '-Wduplicated-branches',
+ '-Wduplicated-cond',
+ '-Wempty-body',
+ '-Wendif-labels',
+ '-Wfloat-equal',
+ '-Wformat-overflow=2',
+ '-Wformat-signedness',
+ '-Wformat-truncation=2',
+ '-Wformat=2',
+ '-Wignored-qualifiers',
+ '-Wimplicit-fallthrough=3',
+ '-Winit-self',
+ '-Winline',
+ '-Winvalid-pch',
+ '-Wlogical-op',
+ '-Wmissing-declarations',
+ '-Wmissing-field-initializers',
+ '-Wmissing-include-dirs',
+ '-Wmultichar',
+ '-Wnormalized=nfc',
+ '-Wnull-dereference',
+ '-Wopenacc-parallelism',
+ '-Woverlength-strings',
+ '-Wpacked',
+ '-Wpacked-bitfield-compat',
+ '-Wpadded',
+ '-Wpointer-arith',
+ '-Wredundant-decls',
+ '-Wshadow',
+ '-Wshift-negative-value',
+ '-Wshift-overflow=2',
+ '-Wstack-protector',
+ '-Wstrict-aliasing=3',
+ '-Wstrict-overflow=5',
+ '-Wstring-compare',
+ '-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',
+ '-Wtrampolines',
+ '-Wtrivial-auto-var-init',
+ '-Wtype-limits',
+ '-Wundef',
+ '-Wuninitialized',
+ '-Wunsafe-loop-optimizations',
+ '-Wunused',
+ '-Wunused-const-variable=2',
+ '-Wunused-macros',
+ '-Wvector-operation-performance',
+ '-Wvla',
+ '-Wwrite-strings',
+]
+
+#####
+# C #
+#####
+
+if is_variable('cc')
+ # Set all_c_warnings for the current C compiler
+ all_c_warnings = []
+
+ if cc.get_id() == 'clang'
+ all_c_warnings += ['-Weverything']
+
+ if not meson.is_cross_build()
+ all_c_warnings += [
+ '-Wno-poison-system-directories',
+ ]
+ endif
+
+ elif cc.get_id() == 'gcc'
+ all_c_warnings += gcc_common_warnings + [
+ '-Wabsolute-value',
+ '-Wbad-function-cast',
+ '-Wc++-compat',
+ '-Wenum-conversion',
+ '-Wjump-misses-init',
+ '-Wmissing-parameter-type',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wold-style-declaration',
+ '-Wold-style-definition',
+ '-Woverride-init',
+ '-Wsign-compare',
+ '-Wstrict-prototypes',
+ '-Wunsuffixed-float-constants',
+ ]
+
+ elif cc.get_id() == 'msvc'
+ all_c_warnings += [
+ '/Wall',
+ '/experimental:external',
+ '/external:W0',
+ '/external:anglebrackets',
+ ]
+ endif
+
+ all_c_warnings = cc.get_supported_arguments(all_c_warnings)
+ add_global_arguments(all_c_warnings, language: ['c'])
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..03a5a82
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,17 @@
+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('bindings_py', type: 'feature', value: 'auto', yield: true,
+ description: 'Build Python bindings')
+
+option('tests', type: 'feature', value: 'auto', yield: true,
+ description: 'Build tests')
+
+option('title', type: 'string', value: 'Lilv',
+ description: 'Project title')
+
+option('tools', type: 'feature', value: 'auto', yield: true,
+ description: 'Build command line utilities')
diff --git a/src/filesystem.c b/src/filesystem.c
index 2785cca..5e44937 100644
--- a/src/filesystem.c
+++ b/src/filesystem.c
@@ -14,14 +14,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define _POSIX_C_SOURCE 200809L /* for fileno */
-#define _BSD_SOURCE 1 /* for realpath, symlink */
-#define _DEFAULT_SOURCE 1 /* for realpath, symlink */
-
-#ifdef __APPLE__
-# define _DARWIN_C_SOURCE 1 /* for flock */
-#endif
-
#include "filesystem.h"
#include "lilv_config.h"
#include "lilv_internal.h"
diff --git a/src/util.c b/src/util.c
index 92f72b9..b2b4057 100644
--- a/src/util.c
+++ b/src/util.c
@@ -21,7 +21,6 @@
#include "serd/serd.h"
#include <sys/stat.h>
-#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
diff --git a/test/bad_syntax.lv2/meson.build b/test/bad_syntax.lv2/meson.build
new file mode 100644
index 0000000..f50b43d
--- /dev/null
+++ b/test/bad_syntax.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('bad_syntax',
+ files('bad_syntax.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('bad_syntax',
+ executable('test_bad_syntax',
+ files('test_bad_syntax.c'),
+ c_args: c_suppressions + test_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..8e95549
--- /dev/null
+++ b/test/failed_instantiation.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('failed_instantiation',
+ files('failed_instantiation.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('failed_instantiation',
+ executable('test_failed_instantiation',
+ files('test_failed_instantiation.c'),
+ c_args: c_suppressions + test_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..e4e9d76
--- /dev/null
+++ b/test/failed_lib_descriptor.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('failed_lib_descriptor',
+ files('failed_lib_descriptor.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('failed_lib_descriptor',
+ executable('test_failed_lib_descriptor',
+ files('test_failed_lib_descriptor.c'),
+ c_args: c_suppressions + test_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..5a85fe5
--- /dev/null
+++ b/test/lib_descriptor.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('lib_descriptor',
+ files('lib_descriptor.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('lib_descriptor',
+ executable('test_lib_descriptor',
+ files('test_lib_descriptor.c'),
+ c_args: c_suppressions + test_args,
+ dependencies: [lv2_dep, lilv_static_dep]),
+ args: [meson.current_build_dir() / ''],
+ suite: 'plugin')
+
diff --git a/test/lilv_test_uri_map.h b/test/lilv_test_uri_map.h
index 5f85c86..88c9107 100644
--- a/test/lilv_test_uri_map.h
+++ b/test/lilv_test_uri_map.h
@@ -23,14 +23,13 @@
#include "serd/serd.h"
#include <assert.h>
-#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
- char** uris;
- size_t n_uris;
+ char** uris;
+ uint32_t n_uris;
} LilvTestUriMap;
static inline void
@@ -43,7 +42,7 @@ lilv_test_uri_map_init(LilvTestUriMap* const map)
static inline void
lilv_test_uri_map_clear(LilvTestUriMap* const map)
{
- for (size_t i = 0; i < map->n_uris; ++i) {
+ for (uint32_t i = 0; i < map->n_uris; ++i) {
free(map->uris[i]);
}
@@ -57,7 +56,7 @@ map_uri(LV2_URID_Map_Handle handle, const char* uri)
{
LilvTestUriMap* map = (LilvTestUriMap*)handle;
- for (size_t i = 0; i < map->n_uris; ++i) {
+ for (uint32_t i = 0; i < map->n_uris; ++i) {
if (!strcmp(map->uris[i], uri)) {
return i + 1;
}
diff --git a/test/lilv_test_utils.c b/test/lilv_test_utils.c
index f658f1b..941509a 100644
--- a/test/lilv_test_utils.c
+++ b/test/lilv_test_utils.c
@@ -14,8 +14,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define _POSIX_C_SOURCE 200809L /* for setenv */
-
#include "lilv_test_utils.h"
#include "../src/filesystem.h"
@@ -47,7 +45,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..4ad7969
--- /dev/null
+++ b/test/lv2/core.lv2/meson.build
@@ -0,0 +1,8 @@
+ttl_files = files(
+ 'lv2core.ttl',
+ 'manifest.ttl',
+)
+
+foreach file : ttl_files
+ configure_file(copy: true, input: file, output: '@PLAINNAME@')
+endforeach
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..22b316b
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,80 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# Check release metadata
+autoship = find_program('autoship', required: false)
+if autoship.found()
+ test('autoship', autoship, args: ['test', lilv_src_root], suite: 'data')
+endif
+
+test_args = ['-DLILV_STATIC']
+if cc.get_id() == 'msvc'
+ test_args += [
+ '/wd4464', # relative include path contains '..'
+ ]
+endif
+
+subdir('lv2/core.lv2')
+
+################
+# Bundle Tests #
+################
+
+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 #
+##############
+
+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),
+ files('lilv_test_utils.c', 'test_@0@.c'.format(unit)),
+ c_args: define_args + test_args + c_suppressions,
+ include_directories: include_directories('../src'),
+ dependencies: [lv2_dep, lilv_static_dep]),
+ suite: 'unit')
+endforeach
+
diff --git a/test/missing_descriptor.lv2/meson.build b/test/missing_descriptor.lv2/meson.build
new file mode 100644
index 0000000..cf1d45c
--- /dev/null
+++ b/test/missing_descriptor.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('missing_descriptor',
+ files('missing_descriptor.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('missing_descriptor',
+ executable('test_missing_descriptor',
+ files('test_missing_descriptor.c'),
+ c_args: c_suppressions + test_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..3fe6ce4
--- /dev/null
+++ b/test/missing_name.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('missing_name',
+ files('missing_name.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('missing_name',
+ executable('test_missing_name',
+ files('test_missing_name.c'),
+ c_args: c_suppressions + test_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..ca6a8fe
--- /dev/null
+++ b/test/missing_plugin.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('missing_plugin',
+ files('missing_plugin.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('missing_plugin',
+ executable('test_missing_plugin',
+ files('test_missing_plugin.c'),
+ c_args: c_suppressions + test_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..f497b8c
--- /dev/null
+++ b/test/missing_port.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('missing_port',
+ files('missing_port.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('missing_port',
+ executable('test_missing_port',
+ files('test_missing_port.c'),
+ c_args: c_suppressions + test_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..07e7811
--- /dev/null
+++ b/test/missing_port_name.lv2/meson.build
@@ -0,0 +1,25 @@
+module = shared_module('missing_port_name',
+ files('missing_port_name.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
+test('missing_port_name',
+ executable('test_missing_port_name',
+ files('test_missing_port_name.c'),
+ c_args: c_suppressions + test_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..b745415
--- /dev/null
+++ b/test/new_version.lv2/meson.build
@@ -0,0 +1,17 @@
+module = shared_module('new_version',
+ files('new_version.c'),
+ c_args: c_suppressions,
+ 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: files(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..efec6e1
--- /dev/null
+++ b/test/old_version.lv2/meson.build
@@ -0,0 +1,17 @@
+module = shared_module('old_version',
+ files('old_version.c'),
+ c_args: c_suppressions,
+ 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: files(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..2a4273d
--- /dev/null
+++ b/test/test_plugin.lv2/meson.build
@@ -0,0 +1,17 @@
+module = shared_module('test_plugin',
+ files('test_plugin.c'),
+ c_args: c_suppressions,
+ 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: files(f + '.in'),
+ output: f,
+ configuration: config)
+endforeach
+
diff --git a/test/test.lv2/test.c b/test/test_plugin.lv2/test_plugin.c
index 1dc7076..9615fff 100644
--- a/test/test.lv2/test.c
+++ b/test/test_plugin.lv2/test_plugin.c
@@ -15,8 +15,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define _POSIX_C_SOURCE 200809L
-
#include "lv2/atom/atom.h"
#include "lv2/core/lv2.h"
#include "lv2/state/state.h"
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
diff --git a/test/test_string.c b/test/test_string.c
index dcfd894..4b718b5 100644
--- a/test/test_string.c
+++ b/test/test_string.c
@@ -14,8 +14,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define _POSIX_C_SOURCE 200809L /* for setenv */
-
#undef NDEBUG
#include "../src/lilv_internal.h"
diff --git a/utils/bench.h b/tools/bench.h
index 505631f..33e37f6 100644
--- a/utils/bench.h
+++ b/tools/bench.h
@@ -21,8 +21,6 @@
#ifndef BENCH_H
#define BENCH_H
-#define _POSIX_C_SOURCE 200809L
-
#include <time.h>
typedef struct timespec BenchmarkTime;
diff --git a/utils/lilv.bash_completion b/tools/lilv.bash_completion
index 4a553a7..4a553a7 100644
--- a/utils/lilv.bash_completion
+++ b/tools/lilv.bash_completion
diff --git a/utils/lv2apply.c b/tools/lv2apply.c
index e042999..e042999 100644
--- a/utils/lv2apply.c
+++ b/tools/lv2apply.c
diff --git a/utils/lv2bench.c b/tools/lv2bench.c
index 26f52d1..f0746cb 100644
--- a/utils/lv2bench.c
+++ b/tools/lv2bench.c
@@ -14,8 +14,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define _POSIX_C_SOURCE 200809L
-
#include "lilv/lilv.h"
#include "lv2/atom/atom.h"
#include "lv2/core/lv2.h"
diff --git a/utils/lv2info.c b/tools/lv2info.c
index 81a3ed4..81a3ed4 100644
--- a/utils/lv2info.c
+++ b/tools/lv2info.c
diff --git a/utils/lv2ls.c b/tools/lv2ls.c
index 9226b89..9226b89 100644
--- a/utils/lv2ls.c
+++ b/tools/lv2ls.c
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..59249f2
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,83 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+include_dirs = include_directories('../src')
+
+#############################
+# "Basic" (Lilv-Only) Tools #
+#############################
+
+basic_tools = [
+ 'lv2info',
+ 'lv2ls',
+]
+
+foreach tool : basic_tools
+ executable(
+ tool,
+ files(tool + '.c'),
+ c_args: c_suppressions,
+ dependencies: lilv_dep,
+ include_directories: include_dirs,
+ install: true,
+ )
+
+ install_man(files('..' / 'doc' / tool + '.1'))
+endforeach
+
+install_data(
+ files('lilv.bash_completion'),
+ install_dir: get_option('sysconfdir') / 'bash_completion.d',
+ rename: 'lilv',
+)
+
+###########################
+# lv2apply (uses sndfile) #
+###########################
+
+sndfile_dep = dependency(
+ 'sndfile',
+ version: '>= 1.0.0',
+ required: get_option('tools'),
+)
+
+if sndfile_dep.found()
+ executable(
+ 'lv2apply',
+ files('lv2apply.c'),
+ c_args: c_suppressions,
+ dependencies: [lilv_dep, sndfile_dep],
+ include_directories: include_dirs,
+ install: true,
+ )
+
+ install_man(files('..' / 'doc' / 'lv2apply.1'))
+endif
+
+#################################
+# lv2bench (uses clock_gettime) #
+#################################
+
+if host_machine.system() != 'windows'
+ rt_dep = cc.find_library('rt', required: false)
+
+ clock_gettime_code = '''#include <time.h>
+int main(void) { struct timespec t; return clock_gettime(CLOCK_MONOTONIC, &t); }
+'''
+
+ if cc.compiles(clock_gettime_code,
+ args: platform_defines,
+ dependencies: [rt_dep],
+ name: 'clock_gettime')
+ executable(
+ 'lv2bench',
+ files('lv2bench.c'),
+ c_args: c_suppressions,
+ dependencies: [lilv_dep, rt_dep, sndfile_dep],
+ include_directories: include_dirs,
+ install: true,
+ )
+
+ install_man(files('..' / 'doc' / 'lv2bench.1'))
+ endif
+endif
diff --git a/utils/uri_table.h b/tools/uri_table.h
index 5a337a3..5a337a3 100644
--- a/utils/uri_table.h
+++ b/tools/uri_table.h
diff --git a/utils/lilv-bench.c b/utils/lilv-bench.c
deleted file mode 100644
index 56b7fee..0000000
--- a/utils/lilv-bench.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Copyright 2007-2012 David Robillard <d@drobilla.net>
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#include "lilv/lilv.h"
-
-int
-main(void)
-{
- LilvWorld* world = lilv_world_new();
- lilv_world_load_all(world);
-
- const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
- LILV_FOREACH (plugins, p, plugins) {
- const LilvPlugin* plugin = lilv_plugins_get(plugins, p);
- lilv_plugin_get_class(plugin);
- }
-
- lilv_world_free(world);
-
- return 0;
-}
diff --git a/waf b/waf
deleted file mode 100755
index 887215c..0000000
--- a/waf
+++ /dev/null
@@ -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 13a0fbb..0000000
--- a/wscript
+++ /dev/null
@@ -1,643 +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.15'
-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.LILV_MAJOR_VERSION = LILV_MAJOR_VERSION
-
- 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([tst.env.PYTHON[0], '-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)