GNOME Bugzilla – Bug 672541
glib-compile-resources prepends --sourcedir to absolute paths
Last modified: 2012-03-29 15:44:23 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".
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?
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.
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.
That looks perfect, thanks!
Review of attachment 210332 [details] [review]: Looks correct.
Pushed to master.