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 694153 - srcdir != builddir, automake, and vala
srcdir != builddir, automake, and vala
Status: RESOLVED DUPLICATE of bug 725497
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
: 760478 (view as bug list)
Depends on:
Blocks: 414139
 
 
Reported: 2013-02-19 10:23 UTC by Colin Walters
Modified: 2016-09-20 14:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Colin Walters 2013-02-19 10:23:46 UTC
This "bug" may not conceptually be in vala, but it's most convenient to discuss here I think.

In the gnome-ostree build system, it uses srcdir != builddir, but note here that srcdir is a git checkout, so the .[ch] files aren't pregenerated.  

Recently I tracked down a bug where caribou stopped building in gnome-ostree, and it turned out to be because it uses --vapidir=$(top_srcdir), but the problem is that automake's generated vala rules include a "cd $(srcdir)" before the build command.

From sub lang_vala_finish_target of automake 1.12.3:

  $output_rules .=
    "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n".
# Since the C files generated from the vala sources depend on the
# ${derived}_vala.stamp file, we must ensure its timestamp is older than
# those of the C files generated by the valac invocation below (this is
# especially important on systems with sub-second timestamp resolution).
# Thus we need to create the stamp file *before* invoking valac, and to
# move it to its final location only after valac has been invoked.
    "\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n".
    "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n".
    "\t${silent}mv -f \$\@-t \$\@\n";

I guess all the vala rules are designed under the model that one is shipping pregenerated .[ch] in tarballs, so here the intention is that we compile the output into srcdir.  But I personally always want to build from source code.

Is there a vala change that could be made so automake didn't have to cd to srcdir?
Comment 1 Colin Walters 2013-02-19 10:25:20 UTC
The workaround I've been using so far is like this:

http://git.gnome.org/browse/caribou/commit/?id=9a57b567b4753d948a0c3027d0ff26debd7c7314

But it's kind of unfortunate to just endlessly mark all vala-using modules as not supporting this form of srcdir != builddir, so I'd like to use this bug to figure out a long term plan.
Comment 2 Debarshi Ray 2016-01-11 16:30:04 UTC
*** Bug 760478 has been marked as a duplicate of this bug. ***
Comment 3 Debarshi Ray 2016-01-11 16:30:56 UTC
(In reply to Colin Walters from comment #1)
> The workaround I've been using so far is like this:
> 
> http://git.gnome.org/browse/caribou/commit/
> ?id=9a57b567b4753d948a0c3027d0ff26debd7c7314

That is not enough since distcheck also uses srcdir != builddir.
Comment 4 Rico Tzschichholz 2016-09-20 14:43:51 UTC

*** This bug has been marked as a duplicate of bug 725497 ***