[gjs] package: Support running Meson projects from source
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] package: Support running Meson projects from source
- Date: Tue, 2 May 2017 05:52:35 +0000 (UTC)
commit d083e39038aca8de1b84ed3cb09c2ed880df1f88
Author: Patrick Griffis <tingping tingping se>
Date: Fri Apr 28 04:54:18 2017 -0400
package: Support running Meson projects from source
The run_target() function in Meson sets these variables allowing
you to simply create a target that can be ran with ninja.
See also: http://mesonbuild.com/Reference-manual.html#run_target
https://bugzilla.gnome.org/show_bug.cgi?id=781883
modules/package.js | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/modules/package.js b/modules/package.js
index fa1d5a8..ca167c2 100644
--- a/modules/package.js
+++ b/modules/package.js
@@ -59,6 +59,11 @@ function _runningFromSource() {
return binary.equal(sourceBinary);
}
+function _runningFromMesonSource() {
+ return GLib.getenv('MESON_BUILD_ROOT') &&
+ GLib.getenv('MESON_SOURCE_ROOT');
+}
+
function _makeNamePath(name) {
return '/' + name.replace('.', '/', 'g');
}
@@ -132,6 +137,23 @@ function init(params) {
pkgdatadir = GLib.build_filenamev([_base, 'data']);
localedir = GLib.build_filenamev([_base, 'po']);
moduledir = GLib.build_filenamev([_base, 'src']);
+ } else if (_runningFromMesonSource()) {
+ log('Running from Meson, using local files');
+ let bld = GLib.getenv('MESON_BUILD_ROOT');
+ let src = GLib.getenv('MESON_SOURCE_ROOT');
+
+ pkglibdir = libpath = girpath = GLib.build_filenamev([bld, 'lib']);
+ pkgdatadir = GLib.build_filenamev([bld, 'data']);
+ localedir = GLib.build_filenamev([bld, 'po']);
+
+ try {
+ let resource = Gio.Resource.load(GLib.build_filenamev([bld, 'src',
+ name + '.src.gresource']));
+ resource._register();
+ moduledir = 'resource://' + _makeNamePath(name) + '/js';
+ } catch(e) {
+ moduledir = GLib.build_filenamev([src, 'src']);
+ }
} else {
_base = prefix;
pkglibdir = GLib.build_filenamev([libdir, _pkgname]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]