summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@osg.samsung.com>2016-11-19 10:18:33 -0300
committerThibault Saunier <tsaunier@gnome.org>2016-12-13 14:48:34 -0300
commit1c46eb2751f20f933a5772d09e64a120176ea2d6 (patch)
tree521a66a4e589f43b664bc45aaf1a81c29aa60026 /setup.py
parent954c27641d77339db7d90aa69099d6a89727e2ba (diff)
Add a script to setup a developement environment based on msys2
This environment is meant to be setup in a Visual Studio 'Native X64 tools' terminal, and takes for granted that msys2 has been installed, Visual Studio has C(++) support has been installed and python3 is installed and is present in PATH. https://bugzilla.gnome.org/show_bug.cgi?id=775281
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..a05e6ed
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+"""Script for generating the Makefiles."""
+
+import argparse
+import os
+import sys
+import shutil
+import subprocess
+
+from common import get_meson
+from common import accept_command
+
+
+PROJECTNAME = "GStreamer build"
+
+ROOTDIR = os.path.abspath(os.path.dirname(__file__))
+
+
+class GstBuildConfigurer:
+
+ def __init__(self, options, args):
+ self.options = options
+ self.args = args
+
+ def get_configs(self):
+ return ['--werror']
+
+ def configure_meson(self):
+ if not self.options.reconfigure:
+ if os.path.exists(ROOTDIR + "/build/build.ninja"):
+ print("Not reconfiguring")
+ return True
+
+ meson, mesonconf, mesonintrospect = get_meson()
+ if not meson:
+ print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
+ "You can simply install it with:\n"
+ " $ sudo pip3 install meson" % PROJECTNAME)
+ return False
+
+ ninja = accept_command(["ninja", "ninja-build"])
+ if not ninja:
+ print("Install ninja-build to build %s: https://ninja-build.org/"
+ % PROJECTNAME)
+ return False
+
+ build_dir = os.path.join(ROOTDIR, "build")
+ shutil.rmtree(build_dir, True)
+ os.mkdir(build_dir)
+
+ try:
+ subprocess.check_call(
+ [sys.executable, meson, "../"] + self.args + self.get_configs(), cwd=build_dir)
+ print("\nYou can now build GStreamer and its various subprojects running:\n"
+ " $ ninja -C %s" % build_dir)
+ except subprocess.CalledProcessError:
+ return False
+
+ return True
+
+ def setup(self):
+ return self.configure_meson()
+
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description='Process some integers.')
+ parser.add_argument("--reconfigure", action='store_true',
+ default=False, help='Force a full reconfiguration'
+ ' meaning the build/ folder is removed.'
+ ' You can also use `ninja reconfigure` to just'
+ ' make sure meson is rerun but the build folder'
+ ' is kept.')
+
+ options, args = parser.parse_known_args()
+ configurer = GstBuildConfigurer(options, args)
+ exit(not configurer.setup())