summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy8
-rw-r--r--.gitignore5
-rw-r--r--.gitmodules3
-rw-r--r--.reuse/dep515
-rw-r--r--COPYING16
-rw-r--r--INSTALL59
-rw-r--r--INSTALL.md80
-rw-r--r--LICENSES/0BSD.txt12
l---------LICENSES/ISC.txt1
-rw-r--r--NEWS68
-rw-r--r--PACKAGING49
-rw-r--r--PACKAGING.md34
-rw-r--r--README.md3
-rw-r--r--doc/c/Doxyfile.in (renamed from doc/c/Doxyfile)11
-rw-r--r--doc/c/api/meson.build9
-rw-r--r--doc/c/index.rst13
-rw-r--r--doc/c/meson.build51
-rw-r--r--doc/c/overview.rst4
-rw-r--r--doc/c/reference.rst4
-rw-r--r--doc/c/wscript39
-rw-r--r--doc/c/xml/meson.build21
-rw-r--r--doc/conf.py.in3
-rw-r--r--doc/meson.build18
-rw-r--r--doc/summary.rst (renamed from doc/suil.rst)6
-rw-r--r--include/suil/suil.h17
-rw-r--r--meson.build368
-rw-r--r--meson/library/meson.build31
-rw-r--r--meson/suppressions/meson.build106
-rw-r--r--meson/warnings/meson.build245
-rw-r--r--meson_options.txt29
-rwxr-xr-xscripts/dox_to_sphinx.py13
-rw-r--r--src/cocoa_in_gtk2.mm19
-rw-r--r--src/cocoa_in_qt5.mm17
-rw-r--r--src/dylib.h18
-rw-r--r--src/gtk2_in_qt5.cpp22
-rw-r--r--src/host.c19
-rw-r--r--src/instance.c42
-rw-r--r--src/qt5_in_gtk.cpp21
-rw-r--r--src/suil_config.h17
-rw-r--r--src/suil_internal.h49
-rw-r--r--src/warnings.h17
-rw-r--r--src/win_in_gtk2.cpp17
-rw-r--r--src/x11.c19
-rw-r--r--src/x11_in_gtk2.c17
-rw-r--r--src/x11_in_gtk3.c30
-rw-r--r--src/x11_in_qt5.cpp32
-rw-r--r--suil.pc.in11
-rw-r--r--suil.ttl29
-rwxr-xr-xwaf27
m---------waflib0
-rw-r--r--wscript472
51 files changed, 1224 insertions, 1012 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 86f28da..ab9957e 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,3 +1,6 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
Checks: >
*,
-*-magic-numbers,
@@ -8,9 +11,9 @@ Checks: >
-altera-*,
-bugprone-easily-swappable-parameters,
-bugprone-suspicious-string-compare,
+ -cert-err33-c,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
- -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-concurrency-mt-unsafe,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-macro-usage,
@@ -27,8 +30,9 @@ Checks: >
-modernize-use-trailing-return-type,
-performance-no-int-to-ptr,
-readability-function-cognitive-complexity,
+ -readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-non-const-parameter,
WarningsAsErrors: '*'
-HeaderFilterRegex: '.*'
+HeaderFilterRegex: ''
FormatStyle: file
diff --git a/.gitignore b/.gitignore
index 204c242..c8766d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
+# Copyright 2017-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
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/.reuse/dep5 b/.reuse/dep5
new file mode 100644
index 0000000..f08dd19
--- /dev/null
+++ b/.reuse/dep5
@@ -0,0 +1,15 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: suil
+Upstream-Contact: David Robillard <d@drobilla.net>
+Source: https://gitlab.com/drobilla/suil
+
+Files: AUTHORS NEWS suil.ttl
+Copyright: 2011-2022 David Robillard <d@drobilla.net>
+Comment: Contributed to the Commons as a representation of simple facts
+License: 0BSD OR ISC
+
+Files: .clant.json .includes.imp
+Copyright: 2020 David Robillard <d@drobilla.net>
+Comment: Contributed to the Commons as a tool configuration
+License: 0BSD OR ISC
+
diff --git a/COPYING b/COPYING
index 51201cb..7923e98 100644
--- a/COPYING
+++ b/COPYING
@@ -1,13 +1,13 @@
-Copyright 2007-2020 David Robillard <d@drobilla.net>
+Copyright 2007-2022 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.
+THE 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.
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 623cddd..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,59 +0,0 @@
-Installation Instructions
-=========================
-
-Basic Installation
-------------------
-
-Building this software requires only Python. To install with default options:
-
- ./waf configure
- ./waf
- ./waf install
-
-You may need to become root for the install stage, for example:
-
- 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
-
-Installation Directories
-------------------------
-
-The --prefix option (or the PREFIX environment variable) can be used to change
-the prefix which all files are installed under. There are also several options
-allowing for more fine-tuned control, see the --help output for details.
-
-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
diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 0000000..fcba723
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,80 @@
+<!-- Copyright 2022 David Robillard <d@drobilla.net> -->
+<!-- SPDX-License-Identifier: ISC -->
+
+Installation Instructions
+=========================
+
+Prerequisites
+-------------
+
+To build from source, you will need:
+
+ * A relatively modern C and optionally 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.
+ * `CXX`: Path to C++ compiler.
+ * `CXXFLAGS`: 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/"
+
+Note that some options, such as `strict` and `werror` are for
+developer/maintainer use only. Please don't file issues about anything that
+happens when they are enabled.
+
+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/LICENSES/0BSD.txt b/LICENSES/0BSD.txt
new file mode 100644
index 0000000..7d3e0ca
--- /dev/null
+++ b/LICENSES/0BSD.txt
@@ -0,0 +1,12 @@
+Copyright 2007-2022 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.
+
+THE 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.
diff --git a/LICENSES/ISC.txt b/LICENSES/ISC.txt
new file mode 120000
index 0000000..012065c
--- /dev/null
+++ b/LICENSES/ISC.txt
@@ -0,0 +1 @@
+../COPYING \ No newline at end of file
diff --git a/NEWS b/NEWS
index 097500d..1f70b3f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,28 @@
-suil (0.10.12) stable;
+suil (0.10.18) stable; urgency=medium
+
+ * Add project metadata
+ * Adopt REUSE machine-readable licensing standard
+ * Fix MacOS build when Gtk3 and Qt5 are present without X11
+ * Fix opening wrapped UIs multiple times in Gtk
+
+ -- David Robillard <d@drobilla.net> Fri, 09 Sep 2022 17:29:12 +0000
+
+suil (0.10.16) stable; urgency=medium
+
+ * Fix wrapper module installation path
+
+ -- David Robillard <d@drobilla.net> Fri, 12 Aug 2022 22:17:10 +0000
+
+suil (0.10.14) stable; urgency=medium
+
+ * Fix MacOS build
+ * Fix documentation install path
+ * Remove dead Qt4 support code
+ * Switch to meson build system
+
+ -- David Robillard <d@drobilla.net> Tue, 19 Jul 2022 01:14:05 +0000
+
+suil (0.10.12) stable; urgency=medium
* Fix build issues with newer toolchains
* Fix some compiler warnings
@@ -6,14 +30,14 @@ suil (0.10.12) stable;
-- David Robillard <d@drobilla.net> Fri, 27 May 2022 01:43:47 +0000
-suil (0.10.10) stable;
+suil (0.10.10) stable; urgency=medium
* Clean up minor code issues
* Remove the need for a generated configuration header
-- David Robillard <d@drobilla.net> Thu, 07 Jan 2021 21:40:54 +0000
-suil (0.10.8) stable;
+suil (0.10.8) stable; urgency=medium
* Fix X11 in Gtk size regressions (thanks Robin Gareus)
* Fix compilation on MacOS older than 10.12
@@ -22,21 +46,21 @@ suil (0.10.8) stable;
-- David Robillard <d@drobilla.net> Sun, 27 Sep 2020 12:22:08 +0000
-suil (0.10.6) stable;
+suil (0.10.6) stable; urgency=medium
* Add no-cocoa configure flag
* Update build system
-- David Robillard <d@drobilla.net> Sun, 10 Nov 2019 21:35:59 +0000
-suil (0.10.4) stable;
+suil (0.10.4) stable; urgency=medium
* Add support for Qt5 in Gtk3
* Add support for min/base size hints for X11 in Gtk (thanks Hermann Meyer)
-- David Robillard <d@drobilla.net> Thu, 06 Jun 2019 19:02:47 +0000
-suil (0.10.2) stable;
+suil (0.10.2) stable; urgency=medium
* Add support for Cocoa in Qt5
* Fix resizing and add idle and update rate support for Qt5 in Gtk2
@@ -44,7 +68,7 @@ suil (0.10.2) stable;
-- David Robillard <d@drobilla.net> Thu, 20 Dec 2018 17:22:19 +0000
-suil (0.10.0) stable;
+suil (0.10.0) stable; urgency=medium
* Add suil_init() to support early initialization and passing any necessary
information that may be needed in the future (thanks Stefan Westerfeld)
@@ -56,7 +80,7 @@ suil (0.10.0) stable;
-- David Robillard <d@drobilla.net> Tue, 03 Oct 2017 20:11:49 +0000
-suil (0.8.4) stable;
+suil (0.8.4) stable; urgency=medium
* Add Cocoa in Gtk wrapper (patch from Robin Gareus)
* Add Gtk2 and X11 in Qt5 wrappers (patch from Rui Nuno Capela)
@@ -73,7 +97,7 @@ suil (0.8.4) stable;
-- David Robillard <d@drobilla.net> Tue, 20 Sep 2016 02:47:44 +0000
-suil (0.8.2) stable;
+suil (0.8.2) stable; urgency=medium
* Add configure options to disable all Gtk or Qt support
* Fix embedding several Qt UIs in Gtk
@@ -81,7 +105,7 @@ suil (0.8.2) stable;
-- David Robillard <d@drobilla.net> Fri, 08 Aug 2014 22:18:00 +0000
-suil (0.8.0) stable;
+suil (0.8.0) stable; urgency=medium
* Add suil_instance_get_handle (patch from Rui Nuno Capela)
* Fix compilation errors on some systems
@@ -89,14 +113,14 @@ suil (0.8.0) stable;
-- David Robillard <d@drobilla.net> Sat, 04 Jan 2014 21:06:56 +0000
-suil (0.6.16) stable;
+suil (0.6.16) stable; urgency=medium
* Fix crashes and resizing for X11 in Qt (patch from Rui Nuno Capela)
* Fix suil_instance_extension_data() for UIs with NULL extension_data
-- David Robillard <d@drobilla.net> Tue, 17 Sep 2013 03:48:57 +0000
-suil (0.6.14) stable;
+suil (0.6.14) stable; urgency=medium
* Add support for new LV2 idle interface
* Lower dependency from Gtk 2.24 introduced in 0.6.12
@@ -106,7 +130,7 @@ suil (0.6.14) stable;
-- David Robillard <d@drobilla.net> Fri, 09 Aug 2013 04:16:48 +0000
-suil (0.6.12) stable;
+suil (0.6.12) stable; urgency=medium
* Fix compilation on BSD
* Fix crash when a broken UI returns a NULL descriptor
@@ -114,14 +138,14 @@ suil (0.6.12) stable;
-- David Robillard <d@drobilla.net> Fri, 22 Feb 2013 18:03:48 +0000
-suil (0.6.10) stable;
+suil (0.6.10) stable; urgency=medium
* Downgrade to waf 1.7.5, previous version does not build modules due to
package check breakage in waf 1.7.6
-- David Robillard <d@drobilla.net> Sun, 23 Dec 2012 04:08:06 +0000
-suil (0.6.8) stable;
+suil (0.6.8) stable; urgency=medium
* Fix crash in x11_in_gtk2 when event_filter fires before widget is realized
* Update to waf 1.7.8 and autowaf r90 (install docs to versioned directory)
@@ -130,7 +154,7 @@ suil (0.6.8) stable;
-- David Robillard <d@drobilla.net> Sun, 23 Dec 2012 02:11:23 +0000
-suil (0.6.6) stable;
+suil (0.6.6) stable; urgency=medium
* Disable timestamps in HTML documentation for reproducible build
* Fix embedding Gtk in Qt as a child widget (support reparenting)
@@ -141,14 +165,14 @@ suil (0.6.6) stable;
-- David Robillard <d@drobilla.net> Wed, 14 Nov 2012 16:17:03 +0000
-suil (0.6.4) stable;
+suil (0.6.4) stable; urgency=medium
* Correctly handle resizing for Gtk2 in Qt4
* Improve documentation
-- David Robillard <d@drobilla.net> Mon, 09 Jul 2012 19:11:06 +0000
-suil (0.6.2) stable;
+suil (0.6.2) stable; urgency=medium
* Allow run-time configuration of module directory via environment variable
SUIL_MODULE_DIR
@@ -158,7 +182,7 @@ suil (0.6.2) stable;
-- David Robillard <d@drobilla.net> Fri, 25 May 2012 03:18:18 +0000
-suil (0.6.0) stable;
+suil (0.6.0) stable; urgency=medium
* Add support for embedding X11 UIs (ui:X11UI)
* Support new LV2 UI features automatically if provided by host
@@ -166,20 +190,20 @@ suil (0.6.0) stable;
-- David Robillard <d@drobilla.net> Wed, 18 Apr 2012 23:32:43 +0000
-suil (0.4.4) stable;
+suil (0.4.4) stable; urgency=medium
* Fix embedding Gtk2 Qt4 UIs in Qt4 hosts that do not link to Gtk2
-- David Robillard <d@drobilla.net> Sat, 11 Jun 2011 15:20:11 +0000
-suil (0.4.2) stable;
+suil (0.4.2) stable; urgency=medium
* Fix build system Python 3 compatibility
* Fix compilation issues on some systems
-- David Robillard <d@drobilla.net> Wed, 25 May 2011 23:00:00 +0000
-suil (0.4.0) stable;
+suil (0.4.0) stable; urgency=medium
* Initial release
diff --git a/PACKAGING b/PACKAGING
deleted file mode 100644
index 735a1c6..0000000
--- a/PACKAGING
+++ /dev/null
@@ -1,49 +0,0 @@
-These are generic guidelines, but please see below for important Suil specific
-information.
-
-This library is designed to allow parallel installation of different major
-versions. To facilitate this, the shared library name, include directory, and
-pkg-config file are suffixed with the major version number of the library.
-
-For example, if this library was named "foo" and at version 1.x.y:
-
-/usr/include/foo-1/foo/foo.h
-/usr/lib/foo-1.so.1.x.y
-/usr/lib/pkgconfig/foo-1.pc
-
-Dependencies check for pkg-config name "foo-1" and will build
-against a compatible version 1, regardless any other installed versions.
-
-*** IMPORTANT GUIDELINES FOR PACKAGERS ***
-
-Packages should follow the same conventions as above, i.e. include the major
-version (and only the major version) in the name of the package. Continuing the
-example above, the package(s) would be named foo-1 and foo-1-dev. This way,
-if/when version 2 comes out, it may be installed at the same time as version 1
-without breaking anything.
-
-Please do not create packages of this library that do not follow these
-guidelines, you will break things and cause unnecessary headaches. Please do
-not use any number as a suffix other than the actual major version number of the
-upstream source package.
-
-Because program and documentation names are not versioned, these should be
-included in separate packages which may replace previous versions, since
-there is little use in having parallel installations of them.
-
-*** IMPORTANT GUIDELINES FOR PACKAGING SUIL ***
-
-The purpose of Suil is to abstract plugin UI toolkits away from host code. To
-achieve this, Suil performs its magic by dynamically loading modules for each
-toolkit. The main Suil library does NOT depend on any toolkit libraries, and
-thus neither should your package. Please package the individual modules
-(e.g. libsuil_gtk2_in_qt4.so) as separate packages, which themselves depend on
-the involved toolkits. These packages should also be versioned as described
-above to support parallel installation.
-
-Please do not make the main Suil package depend on any toolkit package, this
-defeats the purpose of Suil and will severely irritate those who for whatever
-reason do not want a particular toolkit dependency. The main Suil package may
-have a weak dependency (e.g. "recommends") on the individual wrapper modules,
-and it's fine if these are installed by default, but it must be possible to
-install Suil without installing them if the user explicitly wishes to do so.
diff --git a/PACKAGING.md b/PACKAGING.md
new file mode 100644
index 0000000..4702379
--- /dev/null
+++ b/PACKAGING.md
@@ -0,0 +1,34 @@
+<!-- Copyright 2011-2022 David Robillard <d@drobilla.net> -->
+<!-- SPDX-License-Identifier: ISC -->
+
+Packaging Suil
+==============
+
+This library is designed to allow parallel installation of different major
+versions. To facilitate this, the shared library name, include directory, and
+pkg-config file are suffixed with the major version number of the library.
+
+Dependencies check for the pkg-config package `suil-0` and will build against a
+compatible version 0, regardless any other installed versions.
+
+Packages should follow the same conventions as above, that is, include the
+major version (and only the major version) in the name of the package so that
+it can be installed in parallel with future major versions.
+
+Dependencies
+------------
+
+The purpose of Suil is to abstract plugin UI toolkits away from host code. To
+achieve this, Suil dynamically loads modules for the toolkits in use. The main
+Suil library does NOT depend on any toolkit libraries, and its package
+shouldn't either (otherwise, for example, every LV2 host in the distribution
+would depend directly on Gtk and Qt). Individual modules (like
+`libsuil_gtk2_in_qt5.so`) should be packaged separately and themselves depend
+on the involved toolkits. These packages should also be versioned as described
+above to support parallel installation.
+
+Please do not make the main Suil package strongly depend on any toolkit
+package, this defeats the purpose of Suil and will irritate users who want to
+avoid a particular toolkit dependency for whatever reason. "Weak" or
+"recommended" dependencies are fine, the important thing is that users are able
+to avoid particular toolkits if they choose.
diff --git a/README.md b/README.md
index bdfc668..2273095 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
+<!-- Copyright 2011-2019 David Robillard <d@drobilla.net> -->
+<!-- SPDX-License-Identifier: ISC -->
+
Suil
====
diff --git a/doc/c/Doxyfile b/doc/c/Doxyfile.in
index ee7a427..0d787bc 100644
--- a/doc/c/Doxyfile
+++ b/doc/c/Doxyfile.in
@@ -1,3 +1,6 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
PROJECT_NAME = Suil
PROJECT_BRIEF = "A library for loading LV2 plugin UIs"
@@ -19,8 +22,10 @@ XML_PROGRAMLISTING = NO
SHOW_FILES = NO
MACRO_EXPANSION = YES
-PREDEFINED = SUIL_API \
+PREDEFINED = SUIL_API
-INPUT = ../../include/suil/suil.h
+RECURSIVE = YES
+STRIP_FROM_PATH = @SUIL_SRCDIR@
+INPUT = @SUIL_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..6463f7c
--- /dev/null
+++ b/doc/c/api/meson.build
@@ -0,0 +1,9 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+c_suil_rst = custom_target(
+ 'suil.rst',
+ command: [dox_to_sphinx, '-f', '@INPUT0@', '@OUTDIR@'],
+ input: [c_index_xml] + c_rst_files,
+ output: 'suil.rst',
+)
diff --git a/doc/c/index.rst b/doc/c/index.rst
index b616761..7f8eb92 100644
--- a/doc/c/index.rst
+++ b/doc/c/index.rst
@@ -1,5 +1,14 @@
+..
+ Copyright 2020-2022 David Robillard <d@drobilla.net>
+ SPDX-License-Identifier: ISC
+
+####
+Suil
+####
+
+.. include:: summary.rst
+
.. toctree::
- suil
overview
- reference
+ api/suil
diff --git a/doc/c/meson.build b/doc/c/meson.build
new file mode 100644
index 0000000..2786139
--- /dev/null
+++ b/doc/c/meson.build
@@ -0,0 +1,51 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+config = configuration_data()
+config.set('SUIL_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',
+)
+
+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_suil_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / 'suil-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_suil_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / 'suil-0',
+ output: 'html',
+)
diff --git a/doc/c/overview.rst b/doc/c/overview.rst
index e8d61b1..71937b2 100644
--- a/doc/c/overview.rst
+++ b/doc/c/overview.rst
@@ -1,3 +1,7 @@
+..
+ Copyright 2020-2022 David Robillard <d@drobilla.net>
+ SPDX-License-Identifier: ISC
+
########
Overview
########
diff --git a/doc/c/reference.rst b/doc/c/reference.rst
index 893bc4f..1512f42 100644
--- a/doc/c/reference.rst
+++ b/doc/c/reference.rst
@@ -1,3 +1,7 @@
+..
+ Copyright 2020-2022 David Robillard <d@drobilla.net>
+ SPDX-License-Identifier: ISC
+
#############
API Reference
#############
diff --git a/doc/c/wscript b/doc/c/wscript
deleted file mode 100644
index ae074bc..0000000
--- a/doc/c/wscript
+++ /dev/null
@@ -1,39 +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 = [
- ("../suil.rst", "sphinx/suil.rst"),
- ("index.rst", "sphinx/index.rst"),
- ("overview.rst", "sphinx/overview.rst"),
- ("reference.rst", "sphinx/reference.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",
- SERD_VERSION=bld.env.SERD_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/")
-
- # Run Sphinx to generate HTML documentation
- doc_dir = bld.env.DOCDIR + "/suil-%s/" % bld.env.SUIL_MAJOR_VERSION
- bld(features="sphinx",
- sphinx_source=bld.path.get_bld().make_node("sphinx"),
- sphinx_output_format="singlehtml",
- sphinx_options=["-E", "-q", "-t", "singlehtml"],
- install_path=doc_dir + "c/singlehtml/")
diff --git a/doc/c/xml/meson.build b/doc/c/xml/meson.build
new file mode 100644
index 0000000..bbbf130
--- /dev/null
+++ b/doc/c/xml/meson.build
@@ -0,0 +1,21 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+doxygen = find_program('doxygen')
+
+config = configuration_data()
+config.set('SUIL_SRCDIR', suil_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/conf.py.in b/doc/conf.py.in
index 423bbea..3193610 100644
--- a/doc/conf.py.in
+++ b/doc/conf.py.in
@@ -1,3 +1,6 @@
+# Copyright 2020-2021 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: ISC
+
# Project information
project = "Suil"
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..7e447d5
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,18 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD 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/doc/suil.rst b/doc/summary.rst
index c5dc5ab..57c101e 100644
--- a/doc/suil.rst
+++ b/doc/summary.rst
@@ -1,6 +1,6 @@
-####
-Suil
-####
+..
+ Copyright 2020-2022 David Robillard <d@drobilla.net>
+ SPDX-License-Identifier: ISC
Suil is a library for loading and wrapping LV2 plugin UIs.
diff --git a/include/suil/suil.h b/include/suil/suil.h
index ec2ea5e..c821641 100644
--- a/include/suil/suil.h
+++ b/include/suil/suil.h
@@ -1,18 +1,5 @@
-/*
- Copyright 2011-2017 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.
-*/
+// Copyright 2011-2017 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
/// @file suil.h Public API for Suil
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..e6467c1
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,368 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+project('suil', ['c', 'cpp'],
+ version: '0.10.18',
+ license: 'ISC',
+ meson_version: '>= 0.56.0',
+ default_options: [
+ 'b_ndebug=if-release',
+ 'buildtype=release',
+ 'c_std=c99',
+ 'cpp_std=c++14',
+ ])
+
+suil_src_root = meson.current_source_dir()
+major_version = meson.project_version().split('.')[0]
+version_suffix = '-@0@'.format(major_version)
+versioned_name = 'suil' + version_suffix
+suil_module_dir = get_option('libdir') / versioned_name
+
+#######################
+# Compilers and Flags #
+#######################
+
+# Load build tools
+pkg = import('pkgconfig')
+cc = meson.get_compiler('c')
+cpp = meson.get_compiler('cpp')
+
+# Enable Objective C support if we're building for MacOS
+if host_machine.system() == 'darwin'
+ add_languages(['objcpp'], native: false)
+ objcpp = meson.get_compiler('objcpp')
+endif
+
+# Set global warning flags
+if get_option('strict') and not meson.is_subproject()
+ subdir('meson/warnings')
+endif
+subdir('meson/suppressions')
+
+##########################
+# Platform Configuration #
+##########################
+
+suil_abs_module_dir = get_option('prefix') / suil_module_dir
+platform_defines = ['-DSUIL_MODULE_DIR="@0@"'.format(suil_abs_module_dir)]
+
+nodelete_c_link_args = cc.get_supported_link_arguments(['-Wl,-z,nodelete'])
+nodelete_cpp_link_args = cpp.get_supported_link_arguments(['-Wl,-z,nodelete'])
+
+################
+# Dependencies #
+################
+
+dl_dep = cc.find_library('dl', required: false)
+
+lv2_dep = dependency(
+ 'lv2',
+ version: '>= 1.18.3',
+ fallback: ['lv2', 'lv2_dep'],
+)
+
+x11_dep = dependency(
+ 'x11',
+ required: get_option('x11'),
+)
+
+gtk2_dep = dependency(
+ 'gtk+-2.0',
+ include_type: 'system',
+ version: '>=2.18.0',
+ required: get_option('gtk2').enabled(),
+)
+
+gtk2_x11_dep = dependency(
+ 'gtk+-x11-2.0',
+ include_type: 'system',
+ required: get_option('gtk2').enabled() and get_option('x11').enabled(),
+)
+
+gtk2_quartz_dep = dependency(
+ 'gtk+-quartz-2.0',
+ include_type: 'system',
+ required: get_option('gtk2').enabled() and get_option('cocoa').enabled(),
+)
+
+gtk3_dep = dependency(
+ 'gtk+-3.0',
+ include_type: 'system',
+ version: '>=3.14.0',
+ required: get_option('gtk3'),
+)
+
+gtk3_x11_dep = dependency(
+ 'gtk+-x11-3.0',
+ include_type: 'system',
+ version: '>=3.14.0',
+ required: get_option('gtk3').enabled() and get_option('x11').enabled(),
+)
+
+qt5_dep = dependency(
+ 'Qt5Widgets',
+ include_type: 'system',
+ version: '>=5.1.0',
+ required: get_option('qt5'),
+)
+
+qt5_x11_dep = dependency(
+ 'Qt5X11Extras',
+ include_type: 'system',
+ version: '>=5.1.0',
+ required: get_option('qt5').enabled() and get_option('x11').enabled(),
+)
+
+if host_machine.system() == 'darwin' and not get_option('cocoa').disabled()
+ objcpp.has_header(
+ 'QMacCocoaViewContainer',
+ dependencies: qt5_dep,
+ required: get_option('qt5').enabled() and get_option('cocoa').enabled(),
+ )
+endif
+
+###########
+# Library #
+###########
+
+include_dirs = include_directories('include')
+c_headers = files('include/suil/suil.h')
+
+sources = files(
+ 'src/host.c',
+ 'src/instance.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 = ['-DSUIL_STATIC']
+endif
+
+# Build shared and/or static library
+libsuil = library(
+ meson.project_name() + library_suffix,
+ sources,
+ c_args: c_suppressions + extra_c_args + platform_defines + ['-DSUIL_INTERNAL'],
+ dependencies: [dl_dep, lv2_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ version: meson.project_version(),
+)
+
+# Declare dependency for internal meson dependants
+suil_dep = declare_dependency(
+ compile_args: extra_c_args,
+ dependencies: [dl_dep],
+ include_directories: include_dirs,
+ link_with: libsuil,
+)
+
+# Generage pkg-config file for external dependants
+pkg.generate(
+ libsuil,
+ description: 'Library for loading and wrapping LV2 plugin UIs',
+ extra_cflags: extra_c_args,
+ filebase: versioned_name,
+ name: 'Suil',
+ subdirs: [versioned_name],
+ version: meson.project_version(),
+)
+
+# Install header to a versioned include directory
+install_headers(c_headers, subdir: versioned_name / 'suil')
+
+#####################
+# Host Init Modules #
+#####################
+
+if x11_dep.found()
+ shared_module(
+ 'suil_x11',
+ files('src/x11.c'),
+ c_args: c_suppressions + platform_defines,
+ dependencies: [lv2_dep, x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+###################
+# Wrapper Modules #
+###################
+
+gtk_args = []
+if cc.get_id() == 'clang'
+ gtk_args += [
+ '-Wno-reserved-identifier',
+ ]
+endif
+
+gtk_c_args = cc.get_supported_arguments(gtk_args)
+gtk_cpp_args = cpp.get_supported_arguments(gtk_args)
+
+if gtk2_dep.found() and qt5_dep.found()
+ shared_module(
+ 'suil_gtk2_in_qt5',
+ files('src/gtk2_in_qt5.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args + platform_defines,
+ dependencies: [gtk2_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+
+ shared_module(
+ 'suil_qt5_in_gtk2',
+ files('src/qt5_in_gtk.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args + platform_defines,
+ dependencies: [gtk2_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ link_args: nodelete_cpp_link_args,
+ )
+endif
+
+if gtk2_dep.found() and gtk2_x11_dep.found() and x11_dep.found()
+ shared_module(
+ 'suil_x11_in_gtk2',
+ files('src/x11_in_gtk2.c'),
+ c_args: c_suppressions + gtk_c_args + platform_defines,
+ dependencies: [gtk2_dep, gtk2_x11_dep, lv2_dep, x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ link_args: nodelete_c_link_args,
+ )
+endif
+
+if gtk3_dep.found() and gtk3_x11_dep.found() and x11_dep.found()
+ shared_module(
+ 'suil_x11_in_gtk3',
+ files('src/x11_in_gtk3.c'),
+ c_args: c_suppressions + gtk_c_args + platform_defines,
+ dependencies: [gtk3_dep, gtk3_x11_dep, lv2_dep, x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ link_args: nodelete_c_link_args,
+ )
+endif
+
+if gtk3_dep.found() and gtk3_x11_dep.found() and qt5_dep.found()
+ shared_module(
+ 'suil_qt5_in_gtk3',
+ files('src/qt5_in_gtk.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args + platform_defines,
+ dependencies: [gtk3_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ link_args: nodelete_cpp_link_args,
+ )
+endif
+
+if gtk2_dep.found() and gtk2_quartz_dep.found()
+ shared_module(
+ 'suil_cocoa_in_gtk2',
+ files('src/cocoa_in_gtk2.mm'),
+ dependencies: [gtk2_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ objcpp_args: objcpp_suppressions + gtk_cpp_args + platform_defines,
+ )
+endif
+
+if gtk2_dep.found() and host_machine.system() == 'windows'
+ shared_module(
+ 'suil_win_in_gtk2',
+ files('src/win_in_gtk2.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args + platform_defines,
+ dependencies: [gtk2_dep, lv2_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ link_args: nodelete_cpp_link_args,
+ )
+endif
+
+if qt5_dep.found() and qt5_x11_dep.found()
+ shared_module(
+ 'suil_x11_in_qt5',
+ files('src/x11_in_qt5.cpp'),
+ cpp_args: cpp_suppressions + platform_defines,
+ dependencies: [lv2_dep, qt5_dep, qt5_x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+if host_machine.system() == 'darwin'
+ if qt5_dep.found() and not get_option('cocoa').disabled()
+ cocoa_suppressions = [
+ '-Wno-deprecated-declarations',
+ ]
+
+ shared_module(
+ 'suil_cocoa_in_qt5',
+ files('src/cocoa_in_qt5.mm'),
+ dependencies: [lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ objcpp_args: cocoa_suppressions + objcpp_suppressions + platform_defines,
+ )
+ endif
+endif
+
+#########
+# Tests #
+#########
+
+if get_option('strict')
+ # Check release metadata
+ if not meson.is_subproject()
+ autoship = find_program('autoship', required: false)
+ if autoship.found()
+ test('autoship', autoship, args: ['test', suil_src_root], suite: 'data')
+ endif
+ endif
+
+ # Check licensing metadata
+ reuse = find_program('reuse', required: false)
+ if reuse.found()
+ test('REUSE', reuse,
+ args: ['--root', suil_src_root, 'lint'],
+ suite: 'data')
+ endif
+endif
+
+#################
+# Documentation #
+#################
+
+if not get_option('docs').disabled()
+ subdir('doc')
+endif
+
+if not meson.is_subproject()
+ summary('Install prefix', get_option('prefix'))
+ summary('Headers', get_option('prefix') / get_option('includedir'))
+ summary('Libraries', get_option('prefix') / get_option('libdir'))
+endif
diff --git a/meson/library/meson.build b/meson/library/meson.build
new file mode 100644
index 0000000..756a222
--- /dev/null
+++ b/meson/library/meson.build
@@ -0,0 +1,31 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD 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..0ee8230
--- /dev/null
+++ b/meson/suppressions/meson.build
@@ -0,0 +1,106 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD 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-atomic-implicit-seq-cst',
+ '-Wno-cast-qual',
+ '-Wno-declaration-after-statement',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ '-Wno-variadic-macros',
+ ]
+
+ elif cc.get_id() == 'gcc'
+ c_suppressions += [
+ '-Wno-padded',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=pure',
+ ]
+
+ elif cc.get_id() == 'msvc'
+ c_suppressions += [
+ '/wd4191', # unsafe function conversion
+ '/wd4514', # unreferenced inline function has been removed
+ '/wd4710', # function not inlined
+ '/wd4820', # padding added after construct
+ '/wd4996', # function or variable may be unsafe
+ '/wd5045', # will insert Spectre mitigation for memory load
+ ]
+ endif
+
+ endif
+
+ c_suppressions = cc.get_supported_arguments(c_suppressions)
+endif
+
+#######
+# C++ #
+#######
+
+if is_variable('cpp')
+ cpp_suppressions = []
+
+ if get_option('strict')
+ if cpp.get_id() == 'clang'
+ cpp_suppressions += [
+ '-Wno-atomic-implicit-seq-cst',
+ '-Wno-cast-qual',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-old-style-cast',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ '-Wno-variadic-macros',
+ '-Wno-zero-as-null-pointer-constant',
+ ]
+
+ elif cpp.get_id() == 'gcc'
+ cpp_suppressions += [
+ '-Wno-arith-conversion',
+ '-Wno-cast-qual',
+ '-Wno-padded',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=pure',
+ '-Wno-useless-cast',
+ '-Wno-volatile',
+ ]
+ endif
+ endif
+
+ cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions)
+endif
+
+#################
+# Objective C++ #
+#################
+
+if is_variable('objcpp')
+ objcpp_suppressions = []
+
+ if objcpp.get_id() == 'clang'
+ c_suppressions += [
+ '-Wno-deprecated-declarations',
+ ]
+ elif objcpp.get_id() == 'gcc'
+ objcpp_suppressions = gcc_common_warnings + [
+ '-Wno-direct-ivar-access',
+ ]
+ endif
+
+ objcpp_suppressions = objcpp.get_supported_arguments(objcpp_suppressions)
+endif
diff --git a/meson/warnings/meson.build b/meson/warnings/meson.build
new file mode 100644
index 0000000..858dc7b
--- /dev/null
+++ b/meson/warnings/meson.build
@@ -0,0 +1,245 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD 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_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')
+ all_c_warnings = []
+
+ if cc.get_id() == 'clang'
+ all_c_warnings += ['-Weverything']
+
+ 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']
+ endif
+
+ all_c_warnings = cc.get_supported_arguments(all_c_warnings)
+ add_global_arguments(all_c_warnings, language: ['c'])
+endif
+
+#######
+# C++ #
+#######
+
+if is_variable('cpp')
+ all_cpp_warnings = []
+
+ 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',
+ '-Wdelete-non-virtual-dtor',
+ '-Wdeprecated',
+ '-Wdeprecated-copy',
+ '-Wdeprecated-copy-dtor',
+ '-Wdeprecated-enum-enum-conversion',
+ '-Wdeprecated-enum-float-conversion',
+ '-Weffc++',
+ '-Wexpansion-to-defined',
+ '-Wextra-semi',
+ '-Wimport',
+ '-Winvalid-imported-macros',
+ '-Wmismatched-tags',
+ '-Wmultiple-inheritance',
+ '-Wnoexcept',
+ '-Wnoexcept-type',
+ '-Wnon-virtual-dtor',
+ '-Wold-style-cast',
+ '-Woverloaded-virtual',
+ '-Wplacement-new=2',
+ '-Wredundant-move',
+ '-Wredundant-tags',
+ '-Wregister',
+ '-Wsign-compare',
+ '-Wsign-promo',
+ '-Wsized-deallocation',
+ '-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']
+ endif
+
+ all_cpp_warnings = cpp.get_supported_arguments(all_cpp_warnings)
+ add_global_arguments(all_cpp_warnings, language: ['cpp'])
+endif
+
+#################
+# Objective C++ #
+#################
+
+if is_variable('objcpp')
+ all_objcpp_warnings = []
+
+ if objcpp.get_id() == 'clang'
+ all_objcpp_warnings += ['-Weverything']
+
+ elif objpp.get_id() == 'gcc'
+ all_objcpp_warnings = gcc_common_warnings
+ endif
+
+ all_objcpp_warnings = objcpp.get_supported_arguments(all_objcpp_warnings)
+ add_global_arguments(all_objcpp_warnings, language: ['objcpp'])
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..620747b
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,29 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+option('cocoa', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Cocoa wrappers')
+
+option('docs', type: 'feature', value: 'auto', yield: true,
+ description: 'Build documentation')
+
+option('gtk2', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Gtk2 wrappers')
+
+option('gtk3', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Gtk3 wrappers')
+
+option('qt5', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Qt5 wrappers')
+
+option('strict', type: 'boolean', value: false, yield: true,
+ description: 'Enable ultra-strict warnings')
+
+option('tests', type: 'feature', value: 'auto', yield: true,
+ description: 'Build tests')
+
+option('title', type: 'string', value: 'Suil',
+ description: 'Project title')
+
+option('x11', type: 'feature', value: 'auto', yield: true,
+ description : 'Build X11 wrappers')
diff --git a/scripts/dox_to_sphinx.py b/scripts/dox_to_sphinx.py
index c9d401c..06cfbdb 100755
--- a/scripts/dox_to_sphinx.py
+++ b/scripts/dox_to_sphinx.py
@@ -1,18 +1,7 @@
#!/usr/bin/env python3
# Copyright 2020 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.
+# SPDX-License-Identifier: ISC
"""
Write Sphinx markup from Doxygen XML.
diff --git a/src/cocoa_in_gtk2.mm b/src/cocoa_in_gtk2.mm
index 204976b..8a505ed 100644
--- a/src/cocoa_in_gtk2.mm
+++ b/src/cocoa_in_gtk2.mm
@@ -1,19 +1,6 @@
-/*
- Copyright 2011-2017 David Robillard <d@drobilla.net>
- Copyright 2014 Robin Gareus <robin@gareus.org>
-
- 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.
-*/
+// Copyright 2011-2022 David Robillard <d@drobilla.net>
+// Copyright 2014 Robin Gareus <robin@gareus.org>
+// SPDX-License-Identifier: ISC
#include "suil_internal.h"
#include "warnings.h"
diff --git a/src/cocoa_in_qt5.mm b/src/cocoa_in_qt5.mm
index 4f2e699..e0ac4e6 100644
--- a/src/cocoa_in_qt5.mm
+++ b/src/cocoa_in_qt5.mm
@@ -1,18 +1,5 @@
-/*
- Copyright 2017 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.
-*/
+// Copyright 2011-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#include "suil_config.h"
#include "suil_internal.h"
diff --git a/src/dylib.h b/src/dylib.h
index 3ea98ef..65bbc1a 100644
--- a/src/dylib.h
+++ b/src/dylib.h
@@ -1,18 +1,5 @@
-/*
- Copyright 2020 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.
-*/
+// Copyright 2020-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#ifndef SUIL_DYLIB_H
#define SUIL_DYLIB_H
@@ -30,6 +17,7 @@ enum DylibFlags {
static inline void*
dylib_open(const char* const filename, const int flags)
{
+ (void)flags;
return LoadLibrary(filename);
}
diff --git a/src/gtk2_in_qt5.cpp b/src/gtk2_in_qt5.cpp
index a5c98f1..705f119 100644
--- a/src/gtk2_in_qt5.cpp
+++ b/src/gtk2_in_qt5.cpp
@@ -1,19 +1,6 @@
-/*
- Copyright 2011-2015 David Robillard <d@drobilla.net>
- Copyright 2015 Rui Nuno Capela <rncbc@rncbc.org>
-
- 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.
-*/
+// Copyright 2011-2022 David Robillard <d@drobilla.net>
+// Copyright 2015 Rui Nuno Capela <rncbc@rncbc.org>
+// SPDX-License-Identifier: ISC
#include "dylib.h"
#include "suil_config.h" // IWYU pragma: keep
@@ -95,8 +82,7 @@ wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
gtk_container_add(GTK_CONTAINER(plug), widget);
gtk_widget_show_all(plug);
- const WId wid =
- static_cast<WId>(gtk_plug_get_id(reinterpret_cast<GtkPlug*>(plug)));
+ const WId wid = (WId)gtk_plug_get_id(GTK_PLUG(plug));
QWindow* window = QWindow::fromWinId(wid);
QWidget* container =
diff --git a/src/host.c b/src/host.c
index 1e64160..d53b8c3 100644
--- a/src/host.c
+++ b/src/host.c
@@ -1,19 +1,6 @@
-/*
- Copyright 2011-2017 David Robillard <d@drobilla.net>
- Copyright 2017 Stefan Westerfeld <stefan@space.twc.de>
-
- 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.
-*/
+// Copyright 2011-2021 David Robillard <d@drobilla.net>
+// Copyright 2017 Stefan Westerfeld <stefan@space.twc.de>
+// SPDX-License-Identifier: ISC
#include "dylib.h"
#include "suil_config.h"
diff --git a/src/instance.c b/src/instance.c
index 05357b2..a2e478a 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -1,18 +1,5 @@
-/*
- Copyright 2007-2017 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.
-*/
+// Copyright 2007-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#include "dylib.h"
#include "suil_internal.h"
@@ -29,7 +16,6 @@
#define GTK2_UI_URI LV2_UI__GtkUI
#define GTK3_UI_URI LV2_UI__Gtk3UI
-#define QT4_UI_URI LV2_UI__Qt4UI
#define QT5_UI_URI LV2_UI__Qt5UI
#define X11_UI_URI LV2_UI__X11UI
#define WIN_UI_URI LV2_UI_PREFIX "WindowsUI"
@@ -50,11 +36,7 @@ suil_ui_supported(const char* host_type_uri, const char* ui_type_uri)
}
if ((!strcmp(host_type_uri, GTK2_UI_URI) &&
- !strcmp(ui_type_uri, QT4_UI_URI)) ||
- (!strcmp(host_type_uri, GTK2_UI_URI) &&
!strcmp(ui_type_uri, QT5_UI_URI)) ||
- (!strcmp(host_type_uri, QT4_UI_URI) &&
- !strcmp(ui_type_uri, GTK2_UI_URI)) ||
(!strcmp(host_type_uri, QT5_UI_URI) &&
!strcmp(ui_type_uri, GTK2_UI_URI)) ||
(!strcmp(host_type_uri, GTK2_UI_URI) &&
@@ -67,8 +49,6 @@ suil_ui_supported(const char* host_type_uri, const char* ui_type_uri)
!strcmp(ui_type_uri, WIN_UI_URI)) ||
(!strcmp(host_type_uri, GTK2_UI_URI) &&
!strcmp(ui_type_uri, COCOA_UI_URI)) ||
- (!strcmp(host_type_uri, QT4_UI_URI) &&
- !strcmp(ui_type_uri, X11_UI_URI)) ||
(!strcmp(host_type_uri, QT5_UI_URI) &&
!strcmp(ui_type_uri, X11_UI_URI)) ||
(!strcmp(host_type_uri, QT5_UI_URI) &&
@@ -88,24 +68,11 @@ open_wrapper(SuilHost* host,
{
const char* module_name = NULL;
- if (!strcmp(container_type_uri, QT4_UI_URI) &&
- !strcmp(ui_type_uri, GTK2_UI_URI)) {
- module_name = "suil_gtk2_in_qt4";
- }
-
-
if (!strcmp(container_type_uri, QT5_UI_URI) &&
!strcmp(ui_type_uri, GTK2_UI_URI)) {
module_name = "suil_gtk2_in_qt5";
}
-
- if (!strcmp(container_type_uri, GTK2_UI_URI) &&
- !strcmp(ui_type_uri, QT4_UI_URI)) {
- module_name = "suil_qt4_in_gtk2";
- }
-
-
if (!strcmp(container_type_uri, GTK2_UI_URI) &&
!strcmp(ui_type_uri, QT5_UI_URI)) {
module_name = "suil_qt5_in_gtk2";
@@ -136,11 +103,6 @@ open_wrapper(SuilHost* host,
module_name = "suil_cocoa_in_gtk2";
}
- if (!strcmp(container_type_uri, QT4_UI_URI) &&
- !strcmp(ui_type_uri, X11_UI_URI)) {
- module_name = "suil_x11_in_qt4";
- }
-
if (!strcmp(container_type_uri, QT5_UI_URI) &&
!strcmp(ui_type_uri, X11_UI_URI)) {
module_name = "suil_x11_in_qt5";
diff --git a/src/qt5_in_gtk.cpp b/src/qt5_in_gtk.cpp
index 6277daa..1b3f31d 100644
--- a/src/qt5_in_gtk.cpp
+++ b/src/qt5_in_gtk.cpp
@@ -1,19 +1,6 @@
-/*
- Copyright 2011-2017 David Robillard <d@drobilla.net>
- Copyright 2018 Rui Nuno Capela <rncbc@rncbc.org>
-
- 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.
-*/
+// Copyright 2011-2022 David Robillard <d@drobilla.net>
+// Copyright 2018 Rui Nuno Capela <rncbc@rncbc.org>
+// SPDX-License-Identifier: ISC
#include "suil_internal.h"
#include "warnings.h"
@@ -125,7 +112,7 @@ suil_qt_wrapper_realize(GtkWidget* w, gpointer)
{
SuilQtWrapper* const wrap = SUIL_QT_WRAPPER(w);
GtkSocket* const s = GTK_SOCKET(w);
- const WId id = static_cast<WId>(gtk_socket_get_id(s));
+ const WId id = (WId)gtk_socket_get_id(s);
wrap->qembed->winId();
wrap->qembed->windowHandle()->setParent(QWindow::fromWinId(id));
diff --git a/src/suil_config.h b/src/suil_config.h
index d4a740c..ce0fe33 100644
--- a/src/suil_config.h
+++ b/src/suil_config.h
@@ -1,18 +1,5 @@
-/*
- Copyright 2021 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.
-*/
+// Copyright 2021 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
/*
Configuration header that defines reasonable defaults at compile time.
diff --git a/src/suil_internal.h b/src/suil_internal.h
index ac6e563..b6640c3 100644
--- a/src/suil_internal.h
+++ b/src/suil_internal.h
@@ -1,18 +1,5 @@
-/*
- Copyright 2007-2017 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.
-*/
+// Copyright 2007-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#ifndef SUIL_INTERNAL_H
#define SUIL_INTERNAL_H
@@ -113,21 +100,25 @@ suil_host_init(void);
static inline void*
suil_open_module(const char* module_name)
{
+#define N_SLICES 4
+
const char* const env_dir = getenv("SUIL_MODULE_DIR");
const char* const mod_dir = env_dir ? env_dir : SUIL_MODULE_DIR;
- const size_t path_len =
- strlen(mod_dir) + strlen(SUIL_DIR_SEP SUIL_MODULE_PREFIX SUIL_MODULE_EXT) +
- strlen(module_name) + 2;
-
- char* const path = (char*)calloc(path_len, 1);
- snprintf(path,
- path_len,
- "%s%s%s%s%s",
- mod_dir,
- SUIL_DIR_SEP,
- SUIL_MODULE_PREFIX,
- module_name,
- SUIL_MODULE_EXT);
+
+ const char* const slices[N_SLICES] = {
+ mod_dir, SUIL_DIR_SEP SUIL_MODULE_PREFIX, module_name, SUIL_MODULE_EXT};
+
+ const size_t lengths[N_SLICES] = {
+ strlen(slices[0]), strlen(slices[1]), strlen(slices[2]), strlen(slices[3])};
+
+ const size_t path_len = lengths[0] + lengths[1] + lengths[2] + lengths[3];
+ char* const path = (char*)calloc(path_len + 1, 1);
+
+ size_t offset = 0;
+ for (size_t i = 0; i < N_SLICES; ++i) {
+ memcpy(path + offset, slices[i], lengths[i]);
+ offset += lengths[i];
+ }
dylib_error();
void* lib = dylib_open(path, DYLIB_NOW);
@@ -137,6 +128,8 @@ suil_open_module(const char* module_name)
free(path);
return lib;
+
+#undef N_SLICES
}
typedef void (*SuilVoidFunc)(void);
diff --git a/src/warnings.h b/src/warnings.h
index b7a03aa..0622397 100644
--- a/src/warnings.h
+++ b/src/warnings.h
@@ -1,18 +1,5 @@
-/*
- Copyright 2021 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.
-*/
+// Copyright 2021 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#ifndef SUIL_WARNINGS_H
#define SUIL_WARNINGS_H
diff --git a/src/win_in_gtk2.cpp b/src/win_in_gtk2.cpp
index 14b82e8..cd5ead9 100644
--- a/src/win_in_gtk2.cpp
+++ b/src/win_in_gtk2.cpp
@@ -1,18 +1,5 @@
-/*
- Copyright 2011-2015 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.
-*/
+// Copyright 2011-2021 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#include "suil_internal.h"
#include "warnings.h"
diff --git a/src/x11.c b/src/x11.c
index 0580817..40e3289 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -1,19 +1,6 @@
-/*
- Copyright 2017 David Robillard <d@drobilla.net>
- Copyright 2017 Stefan Westerfeld <stefan@space.twc.de>
-
- 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.
-*/
+// Copyright 2017-2021 David Robillard <d@drobilla.net>
+// Copyright 2017 Stefan Westerfeld <stefan@space.twc.de>
+// SPDX-License-Identifier: ISC
#include "suil_internal.h"
diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c
index 80eef1a..78164c0 100644
--- a/src/x11_in_gtk2.c
+++ b/src/x11_in_gtk2.c
@@ -1,18 +1,5 @@
-/*
- Copyright 2011-2020 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.
-*/
+// Copyright 2011-2021 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#include "suil_internal.h"
#include "warnings.h"
diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c
index c93f3dd..bd0ee3b 100644
--- a/src/x11_in_gtk3.c
+++ b/src/x11_in_gtk3.c
@@ -1,18 +1,5 @@
-/*
- Copyright 2011-2020 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.
-*/
+// Copyright 2011-2021 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#include "suil_internal.h"
#include "warnings.h"
@@ -50,6 +37,7 @@ typedef struct {
const LV2UI_Idle_Interface* idle_iface;
guint idle_id;
guint idle_ms;
+ guint idle_size_request_id;
int initial_width;
int initial_height;
int req_width;
@@ -114,6 +102,11 @@ on_plug_removed(GtkSocket* sock, gpointer data)
self->idle_id = 0;
}
+ if (self->idle_size_request_id) {
+ g_source_remove(self->idle_size_request_id);
+ self->idle_size_request_id = 0;
+ }
+
if (self->instance->handle) {
self->instance->descriptor->cleanup(self->instance->handle);
self->instance->handle = NULL;
@@ -207,8 +200,11 @@ forward_key_event(SuilX11Wrapper* socket, GdkEvent* gdk_event)
static gboolean
idle_size_request(gpointer user_data)
{
- GtkWidget* w = GTK_WIDGET(user_data);
+ SuilX11Wrapper* socket = (SuilX11Wrapper*)user_data;
+ GtkWidget* w = GTK_WIDGET(socket->plug);
+
gtk_widget_queue_resize(w);
+ socket->idle_size_request_id = 0;
return FALSE;
}
@@ -264,7 +260,7 @@ forward_size_request(SuilX11Wrapper* socket, GtkAllocation* allocation)
} else {
/* Child has not been realized, so unable to resize now.
Queue an idle resize. */
- g_idle_add(idle_size_request, socket->plug);
+ socket->idle_size_request_id = g_idle_add(idle_size_request, socket);
}
}
diff --git a/src/x11_in_qt5.cpp b/src/x11_in_qt5.cpp
index a288319..89323d7 100644
--- a/src/x11_in_qt5.cpp
+++ b/src/x11_in_qt5.cpp
@@ -1,19 +1,6 @@
-/*
- Copyright 2011-2020 David Robillard <d@drobilla.net>
- Copyright 2015 Rui Nuno Capela <rncbc@rncbc.org>
-
- 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.
-*/
+// Copyright 2011-2022 David Robillard <d@drobilla.net>
+// Copyright 2015 Rui Nuno Capela <rncbc@rncbc.org>
+// SPDX-License-Identifier: ISC
#include "suil_internal.h"
#include "warnings.h"
@@ -34,7 +21,6 @@ SUIL_DISABLE_QT_WARNINGS
#include <X11/Xutil.h>
SUIL_RESTORE_WARNINGS
-#include <cstdint>
#include <cstdlib>
#undef signals
@@ -46,10 +32,6 @@ class SuilQX11Widget : public QWidget
public:
SuilQX11Widget(QWidget* parent, Qt::WindowFlags wflags)
: QWidget(parent, wflags)
- , _instance(nullptr)
- , _idle_iface(nullptr)
- , _window(0)
- , _ui_timer(0)
{}
SuilQX11Widget(const SuilQX11Widget&) = delete;
@@ -130,10 +112,10 @@ protected:
}
private:
- SuilInstance* _instance;
- const LV2UI_Idle_Interface* _idle_iface;
- Window _window;
- int _ui_timer;
+ SuilInstance* _instance{};
+ const LV2UI_Idle_Interface* _idle_iface{};
+ Window _window{};
+ int _ui_timer{};
};
SuilQX11Widget::~SuilQX11Widget() = default;
diff --git a/suil.pc.in b/suil.pc.in
deleted file mode 100644
index 66810a6..0000000
--- a/suil.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
-
-Name: Suil
-Version: @SUIL_VERSION@
-Description: LV2 plugin UI hosting library
-Requires: @SUIL_PKG_DEPS@
-Libs: -L${libdir} -l@LIB_SUIL@
-Cflags: -I${includedir}/suil-@SUIL_MAJOR_VERSION@
diff --git a/suil.ttl b/suil.ttl
new file mode 100644
index 0000000..8ee0388
--- /dev/null
+++ b/suil.ttl
@@ -0,0 +1,29 @@
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+<http://drobilla.net/drobilla#me>
+ a foaf:Person ;
+ rdfs:seeAlso <http://drobilla.net/drobilla> ;
+ foaf:mbox <mailto:d@drobilla.net> ;
+ foaf:name "David Robillard" ;
+ foaf:nick "drobilla" .
+
+<http://drobilla.net/software/suil>
+ a doap:Project ;
+ doap:blog <https://drobilla.net/category/suil/> ;
+ doap:bug-database <https://gitlab.com/lv2/suil/issues> ;
+ doap:description "Library for loading and wrapping LV2 plugin UIs" ;
+ doap:developer <http://drobilla.net/drobilla#me> ;
+ doap:download-page <http://download.drobilla.net/> ;
+ doap:homepage <http://drobilla.net/software/suil> ;
+ doap:implements <http://lv2plug.in/ns/extensions/ui> ;
+ doap:license <http://opensource.org/licenses/isc> ;
+ doap:maintainer <http://drobilla.net/drobilla#me> ;
+ doap:name "Suil" ;
+ doap:programming-language "C" ;
+ doap:repository [
+ a doap:GitBranch ;
+ doap:location <https://gitlab.com/lv2/suil.git>
+ ] .
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 f7cdddf..0000000
--- a/wscript
+++ /dev/null
@@ -1,472 +0,0 @@
-#!/usr/bin/env python
-
-from waflib import Build, Logs, Options, TaskGen
-from waflib.extras import autowaf
-
-# Semver package/library version
-SUIL_VERSION = '0.10.12'
-SUIL_MAJOR_VERSION = SUIL_VERSION[0:SUIL_VERSION.find('.')]
-
-# Mandatory waf variables
-APPNAME = 'suil' # Package name for waf dist
-VERSION = SUIL_VERSION # Package version for waf dist
-top = '.' # Source directory
-out = 'build' # Build directory
-
-# Release variables
-uri = 'http://drobilla.net/sw/suil'
-dist_pattern = 'http://download.drobilla.net/suil-%d.%d.%d.tar.bz2'
-post_tags = ['Hacking', 'LAD', 'LV2', 'Suil']
-
-
-def options(ctx):
- ctx.load('compiler_c')
- ctx.load('compiler_cxx')
- opt = ctx.configuration_options()
-
- opt.add_option('--gtk2-lib-name', type='string', dest='gtk2_lib_name',
- default="libgtk-x11-2.0.so.0",
- help="Gtk2 library name [Default: libgtk-x11-2.0.so.0]")
- opt.add_option('--gtk3-lib-name', type='string', dest='gtk3_lib_name',
- default="libgtk-x11-3.0.so.0",
- help="Gtk3 library name [Default: libgtk-x11-3.0.so.0]")
-
- ctx.add_flags(
- opt,
- {'static': 'build static library',
- 'no-shared': 'do not build shared library',
- 'no-cocoa': 'do not build support for Cocoa/Quartz',
- 'no-gtk': 'do not build support for Gtk',
- 'no-qt': 'do not build support for Qt (any version)',
- 'no-qt5': 'do not build support for Qt5',
- 'no-x11': 'do not build support for X11'})
-
-
-def configure(conf):
- conf.load('compiler_c', cache=True)
- conf.load('compiler_cxx', cache=True)
- conf.load('autowaf', cache=True)
- autowaf.set_c_lang(conf, 'c99')
- autowaf.set_cxx_lang(conf, 'c++11')
-
- conf.env.BUILD_SHARED = not conf.options.no_shared
- conf.env.BUILD_STATIC = conf.options.static
-
- if not conf.env.BUILD_SHARED and not conf.env.BUILD_STATIC:
- conf.fatal('Neither a shared nor a static build requested')
-
- if conf.env.DOCS:
- conf.load('sphinx')
-
- 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, '*', {
- 'gcc': [
- '-Wno-padded',
- '-Wno-suggest-attribute=const',
- '-Wno-suggest-attribute=pure',
- ],
- 'clang': [
- '-Wno-cast-qual',
- '-Wno-deprecated-declarations', # Mac
- '-Wno-disabled-macro-expansion',
- '-Wno-padded',
- '-Wno-reserved-id-macro', # Mac
- '-Wno-switch-enum', # Mac
- ]
- })
-
- autowaf.add_compiler_flags(conf.env, 'c', {
- 'msvc': [
- '/wd4514', # unreferenced inline function has been removed
- '/wd4820', # padding added after construct
- '/wd4191', # unsafe function conversion
- '/wd5045', # will insert Spectre mitigation for memory load
- ],
- })
-
- conf.env.NODELETE_FLAGS = []
- if (not conf.env.MSVC_COMPILER and
- conf.check(linkflags = ['-Wl,-z,nodelete'],
- msg = 'Checking for link flags -Wl,-z,-nodelete',
- mandatory = False)):
- conf.env.NODELETE_FLAGS = ['-Wl,-z,nodelete']
-
- conf.check_pkg('lv2 >= 1.16.0', uselib_store='LV2')
-
- if not conf.options.no_x11:
- conf.check_pkg('x11', uselib_store='X11', system=True, mandatory=False)
-
- def enable_module(var_name):
- conf.env[var_name] = 1
-
- if not conf.options.no_gtk:
- conf.check_pkg('gtk+-2.0 >= 2.18.0',
- uselib_store='GTK2',
- system=True,
- mandatory=False)
- if not conf.env.HAVE_GTK2:
- conf.check_pkg('gtk+-2.0',
- uselib_store='GTK2',
- system=True,
- mandatory=False)
- if conf.env.HAVE_GTK2:
- conf.define('SUIL_OLD_GTK', 1)
-
- if not conf.options.no_x11:
- conf.check_pkg('gtk+-x11-2.0',
- uselib_store='GTK2_X11',
- system=True,
- mandatory=False)
-
- if not conf.options.no_cocoa:
- conf.check_pkg('gtk+-quartz-2.0',
- uselib_store='GTK2_QUARTZ',
- system=True,
- mandatory=False)
-
- conf.check_pkg('gtk+-3.0 >= 3.14.0',
- uselib_store='GTK3',
- system=True,
- mandatory=False)
-
- if not conf.options.no_x11:
- conf.check_pkg('gtk+-x11-3.0 >= 3.14.0',
- uselib_store='GTK3_X11',
- system=True,
- mandatory=False)
-
- if not conf.options.no_qt:
- if not conf.options.no_qt5:
- conf.check_pkg('Qt5Widgets >= 5.1.0',
- uselib_store='QT5',
- system=True,
- mandatory=False)
-
- if not conf.options.no_x11:
- conf.check_pkg('Qt5X11Extras >= 5.1.0',
- uselib_store='QT5_X11',
- system=True,
- mandatory=False)
-
- if not conf.options.no_cocoa:
- if conf.check_cxx(header_name = 'QMacCocoaViewContainer',
- uselib = 'QT5_COCOA',
- system=True,
- mandatory = False):
- enable_module('SUIL_WITH_COCOA_IN_QT5')
-
- conf.check_cc(define_name = 'HAVE_LIBDL',
- lib = 'dl',
- mandatory = False)
-
- conf.define('SUIL_MODULE_DIR',
- conf.env.LIBDIR + '/suil-' + SUIL_MAJOR_VERSION)
-
- conf.define('SUIL_GTK2_LIB_NAME', conf.options.gtk2_lib_name)
- conf.define('SUIL_GTK3_LIB_NAME', conf.options.gtk3_lib_name)
-
- if conf.env.HAVE_GTK2 and conf.env.HAVE_QT5:
- enable_module('SUIL_WITH_GTK2_IN_QT5')
- enable_module('SUIL_WITH_QT5_IN_GTK2')
-
- if conf.env.HAVE_GTK2 and conf.env.HAVE_GTK2_X11:
- enable_module('SUIL_WITH_X11_IN_GTK2')
-
- if conf.env.HAVE_GTK3 and conf.env.HAVE_GTK3_X11:
- enable_module('SUIL_WITH_X11_IN_GTK3')
-
- if conf.env.HAVE_GTK3 and conf.env.HAVE_GTK3_X11 and conf.env.HAVE_QT5:
- enable_module('SUIL_WITH_QT5_IN_GTK3')
-
- if conf.env.HAVE_GTK2 and conf.env.HAVE_GTK2_QUARTZ:
- enable_module('SUIL_WITH_COCOA_IN_GTK2')
-
- if conf.env.HAVE_GTK2 and conf.env.DEST_OS == 'win32':
- enable_module('SUIL_WITH_WIN_IN_GTK2')
-
- if conf.env.HAVE_QT5 and conf.env.HAVE_QT5_X11:
- enable_module('SUIL_WITH_X11_IN_QT5')
-
- if conf.env.HAVE_X11:
- enable_module('SUIL_WITH_X11')
-
- conf.run_env.append_unique('SUIL_MODULE_DIR', [conf.build_path()])
-
- # Set up environment for building/using as a subproject
- autowaf.set_lib_env(conf, 'suil', SUIL_VERSION,
- include_path=str(conf.path.find_node('include')))
-
- conf.define('SUIL_NO_DEFAULT_CONFIG', 1)
-
- autowaf.display_summary(
- conf,
- {'Static library': bool(conf.env.BUILD_STATIC),
- 'Shared library': bool(conf.env.BUILD_SHARED)})
-
- if conf.env.HAVE_GTK2:
- autowaf.display_msg(conf, "Gtk2 Library Name",
- conf.get_define('SUIL_GTK2_LIB_NAME'))
- if conf.env.HAVE_GTK3:
- autowaf.display_msg(conf, "Gtk3 Library Name",
- conf.get_define('SUIL_GTK3_LIB_NAME'))
-
- # Print summary message for every potentially supported wrapper
- wrappers = [('cocoa', 'gtk2'),
- ('gtk2', 'qt5'),
- ('qt5', 'gtk2'),
- ('win', 'gtk2'),
- ('x11', 'gtk2'),
- ('x11', 'gtk3'),
- ('qt5', 'gtk3'),
- ('x11', 'qt5'),
- ('cocoa', 'qt5')]
- for w in wrappers:
- var = 'SUIL_WITH_%s_IN_%s' % (w[0].upper(), w[1].upper())
- autowaf.display_msg(conf, 'Support for %s in %s' % (w[0], w[1]),
- bool(conf.env[var]))
-
-
-def build(bld):
- # C Headers
- includedir = '${INCLUDEDIR}/suil-%s/suil' % SUIL_MAJOR_VERSION
- bld.install_files(includedir, bld.path.ant_glob('include/suil/*.h'))
- TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
-
- # Pkgconfig file
- autowaf.build_pc(bld, 'SUIL', SUIL_VERSION, SUIL_MAJOR_VERSION, [],
- {'SUIL_MAJOR_VERSION': SUIL_MAJOR_VERSION,
- 'SUIL_PKG_DEPS': 'lv2'})
-
- cflags = []
- lib = []
- modlib = []
- if bld.env.DEST_OS == 'win32':
- modlib += ['user32']
- else:
- cflags += ['-fvisibility=hidden']
- if bld.is_defined('HAVE_LIBDL'):
- lib += ['dl']
- modlib += ['dl']
-
- module_dir = '${LIBDIR}/suil-' + SUIL_MAJOR_VERSION
-
- # Shared Library
- if bld.env.BUILD_SHARED:
- bld(features = 'c cshlib',
- export_includes = ['include'],
- source = 'src/host.c src/instance.c',
- target = 'suil-%s' % SUIL_MAJOR_VERSION,
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- name = 'libsuil',
- vnum = SUIL_VERSION,
- install_path = '${LIBDIR}',
- cflags = cflags,
- lib = lib,
- uselib = 'LV2')
-
- # Static library
- if bld.env.BUILD_STATIC:
- bld(features = 'c cstlib',
- export_includes = ['include'],
- source = 'src/host.c src/instance.c',
- target = 'suil-%s' % SUIL_MAJOR_VERSION,
- includes = ['.', 'include'],
- defines = ['SUIL_STATIC', 'SUIL_INTERNAL'],
- name = 'libsuil_static',
- vnum = SUIL_VERSION,
- install_path = '${LIBDIR}',
- cflags = cflags,
- lib = lib,
- uselib = 'LV2')
-
- if bld.env.SUIL_WITH_GTK2_IN_QT5:
- bld(features = 'cxx cxxshlib',
- source = 'src/gtk2_in_qt5.cpp',
- target = 'suil_gtk2_in_qt5',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cxxflags = cflags,
- lib = modlib,
- uselib = 'GTK2 QT5 LV2')
-
- if bld.env.SUIL_WITH_QT5_IN_GTK2:
- bld(features = 'cxx cxxshlib',
- source = 'src/qt5_in_gtk.cpp',
- target = 'suil_qt5_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cxxflags = cflags,
- lib = modlib,
- uselib = 'GTK2 QT5 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_X11_IN_GTK2:
- bld(features = 'c cshlib',
- source = 'src/x11_in_gtk2.c',
- target = 'suil_x11_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib + ['X11'],
- uselib = 'GTK2 GTK2_X11 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_X11_IN_GTK3:
- bld(features = 'c cshlib',
- source = 'src/x11_in_gtk3.c',
- target = 'suil_x11_in_gtk3',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib + ['X11'],
- uselib = 'GTK3 GTK3_X11 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_QT5_IN_GTK3:
- bld(features = 'cxx cxxshlib',
- source = 'src/qt5_in_gtk.cpp',
- target = 'suil_qt5_in_gtk3',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'GTK3 QT5 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_COCOA_IN_GTK2:
- bld(features = 'cxx cshlib',
- source = 'src/cocoa_in_gtk2.mm',
- target = 'suil_cocoa_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'GTK2 LV2',
- linkflags = ['-framework', 'Cocoa'])
-
- if bld.env.SUIL_WITH_WIN_IN_GTK2:
- bld(features = 'cxx cxxshlib',
- source = 'src/win_in_gtk2.cpp',
- target = 'suil_win_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'GTK2 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_X11_IN_QT5:
- bld(features = 'cxx cxxshlib',
- source = 'src/x11_in_qt5.cpp',
- target = 'suil_x11_in_qt5',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'QT5 QT5_X11 LV2 X11')
-
- if bld.env.SUIL_WITH_COCOA_IN_QT5:
- bld(features = 'cxx cxxshlib',
- source = 'src/cocoa_in_qt5.mm',
- target = 'suil_cocoa_in_qt5',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'QT5 QT5_COCOA LV2',
- linkflags = ['-framework', 'Cocoa'])
-
- if bld.env.SUIL_WITH_X11:
- bld(features = 'c cshlib',
- source = 'src/x11.c',
- target = 'suil_x11',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'X11 LV2')
-
- # Documentation
- if bld.env.DOCS:
- bld.recurse('doc/c')
-
- bld.add_post_fun(autowaf.run_ldconfig)
-
-
-class LintContext(Build.BuildContext):
- fun = cmd = 'lint'
-
-
-def lint(ctx):
- "checks code for style issues"
- import glob
- import os
- import subprocess
- import sys
-
- 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")
-
- qt_mapping_file = "/usr/share/include-what-you-use/qt5_11.imp"
- extra_args = []
- if os.path.exists(qt_mapping_file):
- extra_args += ["--", "-Xiwyu", "--mapping_file=" + qt_mapping_file]
-
- cmd = [ctx.env.IWYU_TOOL[0], "-o", "clang", "-p", "build"] + extra_args
- 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)
-
-
-def dist(ctx):
- ctx.base_path = ctx.path
- ctx.excl = ctx.get_excl() + ' .gitmodules'