[nautilus-python/wip/jtojnar/meson: 1/2] 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/2] build: Add meson build system
- Date: Thu, 11 Aug 2022 20:40:22 +0000 (UTC)
commit b94c48b44bc79d5ec75e74f3429310a97b30259a
Author: Jan Tojnar <jtojnar gmail com>
Date: Wed Aug 10 15:01:12 2022 +0200
build: Add meson build system
docs/reference/meson.build | 6 ++++
examples/meson.build | 15 ++++++++++
meson.build | 74 ++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 5 ++++
src/meson.build | 20 +++++++++++++
5 files changed, 120 insertions(+)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..2e56eb3
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,6 @@
+gnome.gtkdoc(
+ 'nautilus-python',
+ main_xml: 'nautilus-python-ref.xml',
+ src_dir: meson.project_source_root() / '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..5ee797c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,74 @@
+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])
+
+version_array = python_dep.version().split('.')
+ret = run_command('python3-config', '--abiflags', check: true)
+
+py_so_filename = 'libpython@0@.@1@@2@.so.1.0'.format(
+ version_array[0],
+ version_array[1],
+ ret.stdout().strip(),
+)
+
+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: [
+ 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]