From 76e946465f03d79568f9fe202c27ec83e1276321 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 11 Oct 2016 01:14:50 +0200 Subject: [PATCH] Add meson as a submodule for now Allowing us to control the meson version in use so that it just works. --- .gitmodules | 3 +++ README.md | 9 +++++++++ common.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ configure | 36 ++++++++++-------------------------- git-update | 43 +++---------------------------------------- gst-uninstalled.py | 1 + meson | 1 + 7 files changed, 71 insertions(+), 66 deletions(-) create mode 100644 .gitmodules create mode 100644 common.py create mode 160000 meson diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..f601ecb48b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "meson"] + path = meson + url = https://github.com/mesonbuild/meson.git diff --git a/README.md b/README.md index 04c154d96e..c7b4eaa974 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,15 @@ GStreamer [meson](http://mesonbuild.com/) based repositories aggregrator You can build GStreamer and all its component at once using meson and its "subproject" feature. +## Getting started + +We have an helper script to get started, will get the right [meson](http://mesonbuild.com/) +version and get you ready to build. You can just get all GStreamer built running: + +``` +./configure && ninja -C build/ +``` + ## GStreamer uninstalled gst-all also contains a special `uninstalled` target that lets you enter diff --git a/common.py b/common.py new file mode 100644 index 0000000000..65d5b2da75 --- /dev/null +++ b/common.py @@ -0,0 +1,44 @@ +import argparse +import subprocess + +class Colors: + HEADER = '\033[95m' + OKBLUE = '\033[94m' + OKGREEN = '\033[92m' + WARNING = '\033[93m' + FAIL = '\033[91m' + ENDC = '\033[0m' + + force_disable = False + + @classmethod + def disable(cls): + cls.HEADER = '' + cls.OKBLUE = '' + cls.OKGREEN = '' + cls.WARNING = '' + cls.FAIL = '' + cls.ENDC = '' + + @classmethod + def enable(cls): + if cls.force_disable: + return + + cls.HEADER = '\033[95m' + cls.OKBLUE = '\033[94m' + cls.OKGREEN = '\033[92m' + cls.WARNING = '\033[93m' + cls.FAIL = '\033[91m' + cls.ENDC = '\033[0m' + + + +def git(args, repository_path): + if not isinstance(args, list): + args = [args] + + return subprocess.check_output(["git"] + args, cwd=repository_path, + stderr=subprocess.STDOUT).decode() + + diff --git a/configure b/configure index 3629804646..9d9a7e14c9 100755 --- a/configure +++ b/configure @@ -7,26 +7,22 @@ import sys import shutil import subprocess +from common import git +from common import Colors + PROJECTNAME = "GStreamer 'all'" ROOTDIR = os.path.abspath(os.path.dirname(__file__)) -MAKEFILE_TMPL = """all: -%(tab)scd %(build_dir)s && %(ninja)s -k 100; %(ninja)s -install: -%(tab)scd %(build_dir)s && DESTDIR="${DESTDIR}" %(ninja)s install -check: -%(tab)scd %(build_dir)s && %(ninja)s test +def get_meson(): + print("Updating meson submodule...", end='') + sys.stdout.flush() + git(['submodule', 'update', '--init'], ROOTDIR) + print("DONE") -uninstalled: -%(tab)scd %(build_dir)s && %(ninja)s uninstalled - -clean: -%(tab)srm -Rf %(build_dir)s -%(tab)srm Makefile -""" + return os.path.join(ROOTDIR, 'meson', 'meson.py') def accept_command(commands): @@ -42,19 +38,12 @@ def accept_command(commands): def get_configs(meson): - meson_version = subprocess.check_output([meson, '--version']).decode().strip() - if meson_version <= '0.33.0': - print("Disabling the introspection as support for the introspection with subproject was introduced in 0.34") - return ['-Dgstreamer:disable_introspection=true', - '-Dgst-editing-services:disable_introspection=true', - '-Dgst-devtools:disable_introspection=true'] - return ['-Dwerror=true'] def configure_meson(args): """Configures meson and generate the Makefile.""" - meson = accept_command(["meson", "meson.py"]) + meson = get_meson() if not meson: print("Install mesonbuild to build %s: http://mesonbuild.com/\n" "You can simply install it with:\n" @@ -78,11 +67,6 @@ def configure_meson(args): print("EXIT meson return %s" % e.returncode) exit(1) - with open(os.path.join(ROOTDIR, "Makefile"), "w") as makefile: - makefile.write(MAKEFILE_TMPL % - {"build_dir": build_dir, - "ninja": ninja, - "tab": " "}) if __name__ == "__main__": parser = argparse.ArgumentParser(description='Process some integers.') diff --git a/git-update b/git-update index e0919b22d7..163574f570 100755 --- a/git-update +++ b/git-update @@ -4,49 +4,12 @@ import os import subprocess import xml.etree.ElementTree as ET +from common import git +from common import Colors + SCRIPTDIR = os.path.dirname(__file__) -class Colors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - - force_disable = False - - @classmethod - def disable(cls): - cls.HEADER = '' - cls.OKBLUE = '' - cls.OKGREEN = '' - cls.WARNING = '' - cls.FAIL = '' - cls.ENDC = '' - - @classmethod - def enable(cls): - if cls.force_disable: - return - - cls.HEADER = '\033[95m' - cls.OKBLUE = '\033[94m' - cls.OKGREEN = '\033[92m' - cls.WARNING = '\033[93m' - cls.FAIL = '\033[91m' - cls.ENDC = '\033[0m' - - - -def git(args, repository_path): - if not isinstance(args, list): - args = [args] - - return subprocess.check_output(["git"] + args, cwd=repository_path, - stderr=subprocess.STDOUT).decode() - def manifest_get_commits(manifest): res = {} diff --git a/gst-uninstalled.py b/gst-uninstalled.py index 84ba61e5b9..17b8f11487 100755 --- a/gst-uninstalled.py +++ b/gst-uninstalled.py @@ -65,6 +65,7 @@ def get_subprocess_env(options): "%s/subprojects/gst-editing-services/tests/validate" % SCRIPTDIR) prepend_env_var(env, "PATH", os.path.normpath( "%s/subprojects/gst-devtools/validate/tools" % options.builddir)) + prepend_env_var(env, "PATH", os.path.join(SCRIPTDIR, 'meson')) env["PATH"] += os.pathsep + PATH env["GST_VERSION"] = options.gst_version env["GST_PLUGIN_SYSTEM_PATH"] = "" diff --git a/meson b/meson new file mode 160000 index 0000000000..a513bcfde6 --- /dev/null +++ b/meson @@ -0,0 +1 @@ +Subproject commit a513bcfde613f2a0403f7b0cd34d4bd62674c1d8