2 """Script for generating the Makefiles."""
10 from common import git
11 from common import Colors
14 PROJECTNAME = "GStreamer 'all'"
16 ROOTDIR = os.path.abspath(os.path.dirname(__file__))
20 print("Updating meson submodule...", end='')
22 git(['submodule', 'update', '--init'], ROOTDIR)
25 return os.path.join(ROOTDIR, 'meson', 'meson.py')
28 def accept_command(commands):
29 """Checks if @command --version works."""
30 for command in commands:
32 subprocess.check_output([command, "--version"])
34 except FileNotFoundError:
40 def get_configs(meson):
41 return ['-Dwerror=true']
44 def configure_meson(args):
45 """Configures meson and generate the Makefile."""
48 print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
49 "You can simply install it with:\n"
50 " $ sudo pip3 install meson" % PROJECTNAME)
53 ninja = accept_command(["ninja", "ninja-build"])
55 print("Install ninja-build to build %s: https://ninja-build.org/"
59 build_dir = os.path.join(ROOTDIR, "build")
60 shutil.rmtree(build_dir, True)
65 subprocess.check_call([meson, "../"] + args + get_configs(meson))
66 except subprocess.CalledProcessError as e:
67 print("EXIT meson return %s" % e.returncode)
71 if __name__ == "__main__":
72 parser = argparse.ArgumentParser(description='Process some integers.')
73 parser.add_argument("--no-reconfigure", action='store_true',
74 default=False, help='Avoid removing the build dir'
76 options, args = parser.parse_known_args()
77 if options.no_reconfigure:
79 ROOTDIR + "/build/build.ninja") and os.path.exists(
80 ROOTDIR + "/Makefile"):
81 print("Not reconfiguring")