After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 781883 - Add Meson running from source support to package.js
Add Meson running from source support to package.js
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2017-04-28 08:57 UTC by Patrick Griffis (tingping)
Modified: 2017-05-02 05:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
package: Support running Meson projects from source (1.86 KB, patch)
2017-04-28 08:57 UTC, Patrick Griffis (tingping)
none Details | Review
package: Support running Meson projects from source (2.03 KB, patch)
2017-05-01 10:13 UTC, Patrick Griffis (tingping)
committed Details | Review

Description Patrick Griffis (tingping) 2017-04-28 08:57:14 UTC
Created attachment 350619 [details] [review]
package: Support running Meson projects from source

This allows easily running a Meson project from source similar to the Autotools support.
Comment 1 Philip Chimento 2017-04-29 21:33:47 UTC
Review of attachment 350619 [details] [review]:

This seems fine, but could you give some more background about why it's needed? Who defines the MESON_BUILD_ROOT and MESON_SOURCE_ROOT variables?

::: modules/package.js
@@ +61,3 @@
 
+function _runningFromMesonSource() {
+    return (

Minor nitpick: parentheses not necessary

@@ +142,3 @@
+    } else if (_runningFromMesonSource()) {
+        log('Running from Meson, using local files');
+        let _bld = GLib.getenv('MESON_BUILD_ROOT');

Minor nitpick: underscores not necessary - those were only needed for module-level private variables
Comment 2 Patrick Griffis (tingping) 2017-04-30 07:05:48 UTC
(In reply to Philip Chimento from comment #1)
> Review of attachment 350619 [details] [review] [review]:
> 
> This seems fine, but could you give some more background about why it's
> needed? Who defines the MESON_BUILD_ROOT and MESON_SOURCE_ROOT variables?

It is needed because unlike Autotools Meson always builds out of tree, so you can't just use
relative paths to the script for everything. These env vars are set by Meson itself when
you use the `run_target()` function in Meson.

An example of this is here: https://github.com/TingPing/gjs-meson-template/blob/master/src/meson.build

So you can just do `ninja run` and it will run out of tree.
Comment 3 Philip Chimento 2017-04-30 19:14:26 UTC
OK, `ninja run` was the piece of the puzzle I was missing, thanks. It would be good if you could add that context to the commit message.
Comment 4 Patrick Griffis (tingping) 2017-05-01 10:13:38 UTC
Created attachment 350793 [details] [review]
package: Support running Meson projects from source
Comment 5 Philip Chimento 2017-05-02 04:11:02 UTC
Review of attachment 350793 [details] [review]:

+1, thanks for the changes.
Comment 6 Philip Chimento 2017-05-02 05:52:47 UTC
Attachment 350793 [details] pushed as d083e39 - package: Support running Meson projects from source