[nautilus-python/wip/jtojnar/meson: 1/3] build: Add meson build system
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-python/wip/jtojnar/meson: 1/3] build: Add meson build system
- Date: Thu, 11 Aug 2022 23:55:00 +0000 (UTC)
commit 2622a8d0aca92a57788b1dd1504e7d6b4f7c654f
Author: Jan Tojnar <jtojnar gmail com>
Date: Wed Aug 10 15:01:12 2022 +0200
build: Add meson build system
docs/reference/meson.build | 14 ++++++++++
examples/meson.build | 15 ++++++++++
meson.build | 68 ++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 5 ++++
src/meson.build | 20 ++++++++++++++
5 files changed, 122 insertions(+)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..cd0fddb
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,14 @@
+configure_file(
+ input: 'entities.docbook.in',
+ output: 'entities.docbook',
+ configuration: {
+ 'VERSION': meson.project_version(),
+ },
+)
+
+gnome.gtkdoc(
+ 'nautilus-python',
+ main_xml: 'nautilus-python-ref.xml',
+ src_dir: 'src',
+ install: true,
+)
diff --git a/examples/meson.build b/examples/meson.build
new file mode 100644
index 0000000..7550655
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,15 @@
+install_data(
+ 'README',
+ install_dir: docdir,
+)
+
+install_data(
+ 'background-image.py',
+ 'block-size-column.py',
+ 'location-widget-provider.py',
+ 'open-terminal.py',
+ 'md5sum-property-page.py',
+ 'submenu.py',
+ 'update-file-info-async.py',
+ install_dir: docdir / 'examples',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..22547fc
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,68 @@
+project(
+ 'nautilus-python',
+ 'c',
+ version: '1.2.3',
+ meson_version: '>= 0.59.0',
+)
+
+gnome = import('gnome', required: get_option('docs'))
+pkg = import('pkgconfig')
+python = import('python')
+
+prefix = get_option('prefix')
+libdir = get_option('libdir')
+# Needs to be absolute for C constant.
+datadir = prefix / get_option('datadir')
+docdir = datadir / 'doc' / meson.project_name()
+
+python3 = python.find_installation('python3')
+pygobject_major_version = 3
+pygobject_minor_version = 0
+pygobject_micro_version = 0
+pygobject = dependency('pygobject-3.0', version: f'>=
@pygobject_major_version@.@pygobject_minor_version@.@pygobject_micro_version@')
+libnautilus_extension = dependency('libnautilus-extension', version: '>= 3.27.90')
+python_dep = python3.dependency(embed: true)
+
+nautilus_extension_dir = libnautilus_extension.get_variable('extensiondir', pkgconfig_define: ['libdir',
libdir])
+
+py_so_filename = python3.get_variable('INSTSONAME')
+python_libpath = python3.get_variable('LIBDIR') / py_so_filename
+
+conf = configuration_data()
+conf.set_quoted('DATADIR', datadir)
+conf.set('PYGOBJECT_MAJOR_VERSION', pygobject_major_version)
+conf.set('PYGOBJECT_MINOR_VERSION', pygobject_minor_version)
+conf.set('PYGOBJECT_MICRO_VERSION', pygobject_micro_version)
+conf.set_quoted('PYTHON_LIBPATH', python_libpath)
+
+configure_file(
+ output: 'config.h',
+ configuration: conf,
+)
+
+root_incdir = include_directories('.')
+
+if get_option('docs').enabled()
+ subdir('docs/reference')
+endif
+subdir('examples')
+subdir('src')
+
+pkg.generate(
+ name: 'nautilus-python',
+ description: 'Nautilus-Python Components',
+ variables: [
+ # TODO: Remove when bumping minimum Meson version to 0.62
+ #
https://mesonbuild.com/Release-notes-for-0-62-0.html#pkgconfiggenerate-will-now-include-variables-for-builtin-directories-when-referenced
+ f'prefix=@prefix@',
+ 'datadir=${prefix}/share',
+ 'pythondir=${datadir}/nautilus-python/extensions',
+ ],
+ dataonly: true,
+)
+
+summary({
+ 'PyGObject Version': 'pygobject-3.0',
+ 'Python Library': python_libpath,
+ 'Documentation': get_option('docs'),
+})
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..00aa079
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option(
+ 'docs',
+ type: 'feature',
+ description: 'Generate and install API docs',
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..e8e1563
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,20 @@
+nautilus_python = shared_module(
+ 'nautilus-python',
+ sources: [
+ 'nautilus-python.c',
+ 'nautilus-python-object.c',
+ ],
+ c_args: [
+ '-DHAVE_CONFIG_H'
+ ],
+ dependencies: [
+ libnautilus_extension,
+ pygobject,
+ python_dep,
+ ],
+ include_directories: [
+ root_incdir,
+ ],
+ install: true,
+ install_dir: nautilus_extension_dir,
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]