You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:39:15 UTC

[buildstream] 01/17: Add Meson build instructions

This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 8ae7319ca7901803bb491d1ceb58a7b81edb3ee8
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Wed Dec 13 17:11:08 2017 +0000

    Add Meson build instructions
    
    The goal is to replace setuptools, primarily driven by the performance
    problems we get from the pkg_resources module at import time[1].
    
    1. See https://github.com/pypa/setuptools/issues/510
---
 buildstream/_artifactcache/meson.build   | 11 ++++++++
 buildstream/_frontend/meson.build        | 12 ++++++++
 buildstream/_fuse/meson.build            | 10 +++++++
 buildstream/_options/meson.build         | 14 ++++++++++
 buildstream/_platform/meson.build        | 10 +++++++
 buildstream/_scheduler/meson.build       | 15 ++++++++++
 buildstream/data/meson.build             |  9 ++++++
 buildstream/main.py.in                   | 30 ++++++++++++++++++++
 buildstream/meson.build                  | 47 ++++++++++++++++++++++++++++++++
 buildstream/plugins/elements/meson.build | 31 +++++++++++++++++++++
 buildstream/plugins/sources/meson.build  | 15 ++++++++++
 buildstream/sandbox/meson.build          | 12 ++++++++
 meson.build                              | 18 ++++++++++++
 13 files changed, 234 insertions(+)

diff --git a/buildstream/_artifactcache/meson.build b/buildstream/_artifactcache/meson.build
new file mode 100644
index 0000000..0c9b2d3
--- /dev/null
+++ b/buildstream/_artifactcache/meson.build
@@ -0,0 +1,11 @@
+sources = [
+    '__init__.py',
+    'artifactcache.py',
+    'ostreecache.py',
+    'pushreceive.py',
+    'tarcache.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_artifactcache'))
diff --git a/buildstream/_frontend/meson.build b/buildstream/_frontend/meson.build
new file mode 100644
index 0000000..b02ddd8
--- /dev/null
+++ b/buildstream/_frontend/meson.build
@@ -0,0 +1,12 @@
+sources = [
+    '__init__.py',
+    'complete.py',
+    'main.py',
+    'profile.py',
+    'status.py',
+    'widget.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_frontend'))
diff --git a/buildstream/_fuse/meson.build b/buildstream/_fuse/meson.build
new file mode 100644
index 0000000..d176dbd
--- /dev/null
+++ b/buildstream/_fuse/meson.build
@@ -0,0 +1,10 @@
+sources = [
+    '__init__.py',
+    'fuse.py',
+    'hardlinks.py',
+    'mount.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_fuse'))
diff --git a/buildstream/_options/meson.build b/buildstream/_options/meson.build
new file mode 100644
index 0000000..bd36ae2
--- /dev/null
+++ b/buildstream/_options/meson.build
@@ -0,0 +1,14 @@
+sources = [
+    '__init__.py',
+    'optionarch.py',
+    'optionbool.py',
+    'optioneltmask.py',
+    'optionenum.py',
+    'optionflags.py',
+    'optionpool.py',
+    'option.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_options'))
diff --git a/buildstream/_platform/meson.build b/buildstream/_platform/meson.build
new file mode 100644
index 0000000..eec17f0
--- /dev/null
+++ b/buildstream/_platform/meson.build
@@ -0,0 +1,10 @@
+sources = [
+    '__init__.py',
+    'linux.py',
+    'platform.py',
+    'unix.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_platform'))
diff --git a/buildstream/_scheduler/meson.build b/buildstream/_scheduler/meson.build
new file mode 100644
index 0000000..3400f35
--- /dev/null
+++ b/buildstream/_scheduler/meson.build
@@ -0,0 +1,15 @@
+sources = [
+    '__init__.py',
+    'buildqueue.py',
+    'fetchqueue.py',
+    'job.py',
+    'pullqueue.py',
+    'pushqueue.py',
+    'queue.py',
+    'scheduler.py',
+    'trackqueue.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_scheduler'))
diff --git a/buildstream/data/meson.build b/buildstream/data/meson.build
new file mode 100644
index 0000000..758445c
--- /dev/null
+++ b/buildstream/data/meson.build
@@ -0,0 +1,9 @@
+data = [
+    'build-all.sh.in',
+    'build-module.sh.in',
+    'projectconfig.yaml',
+    'userconfig.yaml',
+]
+
+install_data(data,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'data'))
diff --git a/buildstream/main.py.in b/buildstream/main.py.in
new file mode 100755
index 0000000..b4902a8
--- /dev/null
+++ b/buildstream/main.py.in
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+#
+#  Copyright (C) 2017 Codethink Limited
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2 of the License, or (at your option) any later version.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
+#
+#  Authors:
+#        Sam Thursfield <sa...@codethink.co.uk>
+
+
+import sys
+
+PYTHON_SITE_PACKAGES_DIR = '@pythondir@'
+
+sys.path.insert(1, PYTHON_SITE_PACKAGES_DIR)
+
+import buildstream._frontend
+
+sys.exit(buildstream._frontend.cli())
diff --git a/buildstream/meson.build b/buildstream/meson.build
new file mode 100644
index 0000000..b7c7683
--- /dev/null
+++ b/buildstream/meson.build
@@ -0,0 +1,47 @@
+subdir('_artifactcache')
+subdir('data')
+subdir('_frontend')
+subdir('_fuse')
+subdir('_options')
+subdir('_platform')
+subdir('plugins/elements')
+subdir('plugins/sources')
+subdir('sandbox')
+subdir('_scheduler')
+
+sources = [
+    '__init__.py',
+    'buildelement.py',
+    '_context.py',
+    '_elementfactory.py',
+    'element.py',
+    '_exceptions.py',
+    '_loader.py',
+    '_message.py',
+    '_metaelement.py',
+    '_metasource.py',
+    '_ostree.py',
+    '_pipeline.py',
+    '_plugincontext.py',
+    'plugin.py',
+    '_profile.py',
+    '_project.py',
+    'scriptelement.py',
+    '_signals.py',
+    '_site.py',
+    '_sourcefactory.py',
+    'source.py',
+    'utils.py',
+    '_variables.py',
+    '_yaml.py',
+]
+
+main = configure_file(
+    input: 'main.py.in',
+    output: 'bst',
+    configuration: cdata,
+    install_dir: get_option('bindir'))
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream'))
diff --git a/buildstream/plugins/elements/meson.build b/buildstream/plugins/elements/meson.build
new file mode 100644
index 0000000..472a3f8
--- /dev/null
+++ b/buildstream/plugins/elements/meson.build
@@ -0,0 +1,31 @@
+sources = [
+    '__init__.py',
+    'autotools.py',
+    'autotools.yaml',
+    'cmake.py',
+    'cmake.yaml',
+    'compose.py',
+    'compose.yaml',
+    'distutils.py',
+    'distutils.yaml',
+    'import.py',
+    'import.yaml',
+    'makemaker.py',
+    'makemaker.yaml',
+    'manual.py',
+    'manual.yaml',
+    'meson.py',
+    'meson.yaml',
+    'modulebuild.py',
+    'modulebuild.yaml',
+    'pip.py',
+    'pip.yaml',
+    'qmake.py',
+    'qmake.yaml',
+    'script.py',
+    'script.yaml',
+    'stack.py',
+]
+
+install_data(sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'plugins', 'elements'))
diff --git a/buildstream/plugins/sources/meson.build b/buildstream/plugins/sources/meson.build
new file mode 100644
index 0000000..a8cc88a
--- /dev/null
+++ b/buildstream/plugins/sources/meson.build
@@ -0,0 +1,15 @@
+sources = [
+    '__init__.py',
+    'bzr.py',
+    '_downloadablefilesource.py',
+    'git.py',
+    'local.py',
+    'meson.build',
+    'ostree.py',
+    'patch.py',
+    'tar.py',
+    'zip.py',
+]
+
+install_data(sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'plugins', 'sources'))
diff --git a/buildstream/sandbox/meson.build b/buildstream/sandbox/meson.build
new file mode 100644
index 0000000..a8f3724
--- /dev/null
+++ b/buildstream/sandbox/meson.build
@@ -0,0 +1,12 @@
+sources = [
+    '__init__.py',
+    '_mounter.py',
+    '_mount.py',
+    '_sandboxbwrap.py',
+    '_sandboxchroot.py',
+    'sandbox.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'sandbox'))
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..66a6b44
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,18 @@
+project('buildstream', version: '0.1')
+
+
+python = find_program('python3', required: true)
+
+python_version_check = run_command(python, '-c', 'import sys; sys.stdout.write("%d.%d" % (sys.version_info[0], sys.version_info[1]))')
+if python_version_check.returncode() != 0
+  error('Unable to detect Python version: ' + result.stdout() + result.stderr())
+endif
+python_version = python_version_check.stdout()
+
+python_name = 'python' + python_version
+python_site_packages_dir = join_paths(get_option('prefix'), get_option('libdir'), python_name, 'site-packages')
+
+cdata = configuration_data()
+cdata.set('pythondir', python_site_packages_dir)
+
+subdir('buildstream')