2 """Script for generating the Makefiles."""
10 from common import get_meson
11 from common import accept_command
14 PROJECTNAME = "GStreamer build"
16 ROOTDIR = os.path.abspath(os.path.dirname(__file__))
19 class GstBuildConfigurer:
21 def __init__(self, options, args):
22 self.options = options
25 def get_configs(self):
26 if self.options.no_error:
30 def configure_meson(self):
31 if not self.options.reconfigure:
32 if os.path.exists(ROOTDIR + "/build/build.ninja"):
33 print("Not reconfiguring")
38 print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
39 "You can simply install it with:\n"
40 " $ sudo pip3 install meson" % PROJECTNAME)
43 ninja = accept_command(["ninja", "ninja-build"])
45 print("Install ninja-build to build %s: https://ninja-build.org/"
49 build_dir = os.path.join(ROOTDIR, "build")
50 shutil.rmtree(build_dir, True)
54 subprocess.check_call(
55 [sys.executable, meson, "../"] + self.args + self.get_configs(), cwd=build_dir)
56 print("\nYou can now build GStreamer and its various subprojects running:\n"
57 " $ {} -C {!r}".format(os.path.basename(ninja), build_dir))
58 except subprocess.CalledProcessError:
64 return self.configure_meson()
68 if __name__ == "__main__":
69 parser = argparse.ArgumentParser(description='Process some integers.')
70 parser.add_argument("--reconfigure", action='store_true',
71 default=False, help='Force a full reconfiguration'
72 ' meaning the build/ folder is removed.'
73 ' You can also use `ninja reconfigure` to just'
74 ' make sure meson is rerun but the build folder'
76 parser.add_argument("--no-error", action='store_true',
77 default=False, help="Do not error out on warnings")
79 options, args = parser.parse_known_args()
80 configurer = GstBuildConfigurer(options, args)
81 exit(not configurer.setup())