# Development environment
+## Uninstalled environment
+
gst-build also contains a special `uninstalled` target that lets you enter an
-uninstalled development environment where you will be able to work on GStreamer easily.
-You can get into that environment running:
+uninstalled development environment where you will be able to work on GStreamer
+easily. You can get into that environment running:
```
ninja -C build/ uninstalled
```
-If your operating system handles symlinks, built modules source code will be available
-at the root of `gst-build/` for example GStreamer core will be in `gstreamer/`. Otherwise
-they will be present in `subprojects/`. You can simply hack in there and to rebuild you
-just need to rerun `ninja -C build/`.
+If your operating system handles symlinks, built modules source code will be
+available at the root of `gst-build/` for example GStreamer core will be in
+`gstreamer/`. Otherwise they will be present in `subprojects/`. You can simply
+hack in there and to rebuild you just need to rerun `ninja -C build/`.
+
+## Update git subprojects
+
+We added a special `update` target to update subprojects (it uses `git pull
+--rebase` meaning you should always make sure the branches you work on are
+following the right upstream branch, you can set it with `git branch
+--set-upstream-to origin/master` if you are working on `gst-build` master
+branch).
+
+Update all GStreamer modules and rebuild:
+
+```
+ninja -C build/ update
+```
+
+Update all GStreamer modules without rebuilding:
+
+```
+ninja -C build/ git-update
+```
## Add information about GStreamer development environment in your prompt line
import argparse
+import shutil
import subprocess
class Colors:
def git(*args, repository_path='.'):
return subprocess.check_output(["git"] + list(args), cwd=repository_path,
stderr=subprocess.STDOUT).decode()
+
+def accept_command(commands):
+ """Search @commands and returns the first found absolute path."""
+ for command in commands:
+ command = shutil.which(command)
+ if command:
+ return command
+
+ return None
from common import git
from common import Colors
+from common import accept_command
SCRIPTDIR = os.path.dirname(__file__)
out = getattr(e, "output", b"").decode()
if not no_interaction:
print("====================================="
- "\n%sEntering a shell in %s to fix that"
- " just `exit 0` once done` or `exit 255`"
+ "\n%s\nEntering a shell in %s to fix that"
+ " just `exit 0` once done, or `exit 255`"
" to skip update for that repository"
"\n=====================================" % (
out, repo_dir))
default=False,
action='store_true',
help="Do not output ansi colors.")
+ parser.add_argument("--builddir",
+ default=None,
+ help="Specifies the build directory where to"
+ " invoke ninja after updating.")
parser.add_argument("--no-interaction",
default=False,
action='store_true',
if not update_repo('gst-build', SCRIPTDIR, None, options.no_interaction):
exit(1)
- exit(not update_subprojects(options.manifest,
- options.no_interaction))
+ if not update_subprojects(options.manifest, options.no_interaction):
+ exit(1)
+
+ if options.builddir:
+ ninja = accept_command(["ninja", "ninja-build"])
+ if not ninja:
+ print("Can't find ninja, other backends are not supported for rebuilding")
+ exit(1)
+
+ if not os.path.exists(os.path.join (options.builddir, 'build.ninja')):
+ print("Can't rebuild in %s as no build.ninja file found." % options.builddir)
+
+ print("Rebuilding all GStreamer modules.")
+ exit(subprocess.call([ninja, '-C', options.builddir]))
setenv = find_program('gst-uninstalled.py')
run_target('uninstalled', command : [setenv, '--builddir=@0@'.format(meson.current_build_dir()),
'--gst-version=@0@'.format(gst_branch)])
+
+update = find_program('git-update')
+run_target('git-update', command : [update])
+run_target('update', command : [update,
+ '--builddir=@0@'.format(meson.current_build_dir())])
from common import git
from common import Colors
+from common import accept_command
PROJECTNAME = "GStreamer build"
return accept_command(["meson.py", "meson"]), accept_command(["mesonconf.py", "mesonconf"])
-def accept_command(commands):
- """Search @commands and returns the first found absolute path."""
- for command in commands:
- command = shutil.which(command)
- if command:
- return command
-
- return None
-
-
def get_configs(meson):
return ['-D', 'werror=true']