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 672541 - glib-compile-resources prepends --sourcedir to absolute paths
glib-compile-resources prepends --sourcedir to absolute paths
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.31.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-03-21 12:00 UTC by Martin Pitt
Modified: 2012-03-29 15:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
resources: compiler: Respect absolute paths (968 bytes, patch)
2012-03-22 13:03 UTC, Christian Persch
accepted-commit_now Details | Review

Description Martin Pitt 2012-03-21 12:00:00 UTC
When building a project using glib-compile-resources in a separate source tree, I get a build failure. This e. g. happens with current vte:

$ mkdir /tmp/build
$ cd /tmp/build
$ ~/upstream/vte/configure
$ make
[...]
/usr/bin/glib-compile-resources --target vteresources.c --sourcedir . --generate --c-name vte vte.gresource.xml
vte.gresource.xml: Error on line 21 char 1: Failed to locate '/home/martin/upstream/vte/termcaps/xterm' in any source directory.

vte.gresource.xml has

<gresources>
  <gresource prefix="/org/gnome/vte/2.91/termcap">
    <file alias="xterm">/home/martin/upstream/vte/termcaps/xterm</file>
  </gresource>
</gresources>

I. e. specifies an absolute path. Stracing shows that it does not actually look for /home/..., but for 

access("./home/martin/upstream/vte/termcaps/xterm", F_OK) = -1 ENOENT (No such file or directory)

i. e. it prepends "--sourcedir ." even to paths which are absolute. I think it should not do that, and only prepend it to relative paths, like you get when you e. g. do "mkdir build; cd build; ../configure".
Comment 1 Christian Persch 2012-03-21 13:14:37 UTC
You appear to be doing something weird with vte... its .gresource.xml.in uses @top_srcdir@ not @abs_top_srcdir@; how come top_srcdir is an absolute path for you?
Comment 2 Martin Pitt 2012-03-21 13:24:36 UTC
I find the difference is if you call the source tree's configure with an absolute vs. relative path. If I call it with an absolute path, then both abs_top_srcdir and top_srcdir are the absolute path.

I worked around this by dropping the "--sourcedir ." option from vte's configure.ac in the Debian packages (it's not really needed anyway), but it seems this could be handled better by glib-compile-resources, so I filed this bug.
Comment 3 Christian Persch 2012-03-22 13:03:25 UTC
Created attachment 210332 [details] [review]
resources: compiler: Respect absolute paths

When a <file> already has an absolute path, use it directly instead of trying to
locate it in the --sourcedir directories.
Comment 4 Martin Pitt 2012-03-22 13:08:49 UTC
That looks perfect, thanks!
Comment 5 Colin Walters 2012-03-22 14:37:49 UTC
Review of attachment 210332 [details] [review]:

Looks correct.
Comment 6 Christian Persch 2012-03-29 15:44:23 UTC
Pushed to master.