[nautilus-python/wip/jtojnar/meson: 9/10] build: Add meson build system




commit 2886d66216a481af24479ab7dced297e278b6846
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       | 19 ++++++++++++
 meson.build                | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 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..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..5c79afc
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,19 @@
+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..6d6d937
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,72 @@
+project(
+  'nautilus-python',
+  'c',
+  version: '1.2.3',
+  meson_version: '>= 0.58.0',
+)
+
+fs = import('fs')
+gnome = import('gnome')
+pkg = import('pkgconfig')
+python = import('python')
+
+prefix = get_option('prefix')
+libdir = prefix / get_option('libdir')
+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')
+
+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('gtk_doc').enabled()
+  subdir('docs/reference')
+endif
+subdir('examples')
+subdir('src')
+
+pkg.generate(
+  nautilus_python,
+  description: 'Nautilus-Python Components',
+  variables: [
+    'pythondir=${datadir}/nautilus-python/extensions',
+  ],
+  install_dir: libdir / 'pkgconfig',
+)
+
+summary({
+  'PyGObject Version': 'pygobject-3.0',
+  'Python Library': python_libpath,
+  'Documentation': get_option('gtk_doc'),
+})
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..e4cc440
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option(
+  'gtk_doc',
+  type: 'feature',
+  description: '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]