2 """Script for generating the Makefiles."""
10 from common import git
11 from common import Colors
14 PROJECTNAME = "GStreamer build"
16 ROOTDIR = os.path.abspath(os.path.dirname(__file__))
20 meson = os.path.join(ROOTDIR, 'meson', 'meson.py')
21 if os.path.exists(meson):
24 return accept_command(["meson.py", "meson"])
27 def accept_command(commands):
28 """Checks if @command --version works."""
29 for command in commands:
31 subprocess.check_output([command, "--version"])
33 except FileNotFoundError:
39 def get_configs(meson):
40 return ['-D', 'werror=true']
43 def configure_meson(args, options):
44 """Configures meson and generate the Makefile."""
47 print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
48 "You can simply install it with:\n"
49 " $ sudo pip3 install meson" % PROJECTNAME)
52 ninja = accept_command(["ninja", "ninja-build"])
54 print("Install ninja-build to build %s: https://ninja-build.org/"
58 build_dir = os.path.join(ROOTDIR, "build")
59 shutil.rmtree(build_dir, True)
63 subprocess.check_call([sys.executable, meson, "../"] + args, cwd=build_dir)
64 subprocess.check_call([sys.executable, os.path.join(ROOTDIR, 'meson', 'mesonconf.py')]
65 + get_configs(meson), cwd=build_dir)
66 print("You can now build GStreamer and its various subprojects running:\n"
67 " $ ninja -C %s" % build_dir)
68 except subprocess.CalledProcessError as e:
69 print("EXIT meson return %s" % e.returncode)
73 if __name__ == "__main__":
74 parser = argparse.ArgumentParser(description='Process some integers.')
75 parser.add_argument("--no-reconfigure", action='store_true',
76 default=False, help='Avoid removing the build dir'
78 options, args = parser.parse_known_args()
79 if options.no_reconfigure:
81 ROOTDIR + "/build/build.ninja") and os.path.exists(
82 ROOTDIR + "/Makefile"):
83 print("Not reconfiguring")
86 configure_meson(args, options)