GNOME Bugzilla – Bug 795802
gdbus-codegen doesn't accept --output-directory with --output for --body and --header
Last modified: 2018-05-04 16:20:24 UTC
See: https://github.com/mesonbuild/meson/issues/3488#issuecomment-386582140, pasting comment here: Earlier we used to use --generate-c-code which would output both foo.c and foo.h in the same command. We used --output-directory to set the 'base directory' to set the correct #include line for foo.h in foo.c. With 0.46.0 we started to use --body | --header to generate foo.c and foo.h in separate custom targets. However, --body requires --output, and --output is incompatible with --output-directory. So this is a glib bug. CCing @inigomartinez We need --output-directory subdir --output subdir/foo.c to mean that foo.c should #include "foo.h".
(In reply to Nirbheek Chauhan from comment #0) > However, --body requires --output, and --output is incompatible with > --output-directory. So this is a glib bug. CCing @inigomartinez This behaviour is correct. `--output` needs the full path while `--output-directory` needs only the directory where the files are going to be created, so they are mutally exclusive. > We need --output-directory subdir --output subdir/foo.c to mean that foo.c > should #include "foo.h". `--output-directory subdir` is not necessary because `--output` already includes it. [0] https://developer.gnome.org/gio/stable/gdbus-codegen.html
Created attachment 371672 [details] [review] gdbus-codegen: Fix header include in the body file After having spoken with nirbheek in the IRC, I have figured out what was happening. When body file is generated, the header name to be included is built by using the path passed by `--output` directory. If this includes the subdirectory where the file is generated, the include also uses the subdirectory, which is not correct. This patch fixes this issue.
Review of attachment 371672 [details] [review]: lgtm thanks! Could we get this into the next glib stable release? A bunch of projects are broken, and Meson will have to disable --body/header till 2.28 otherwise.
Review of attachment 371672 [details] [review]: LGTM too.
Pushed to master. I will backport to glib-2-56 shortly. Attachment 371672 [details] pushed as 5faac84 - gdbus-codegen: Fix header include in the body file
Pushed to glib-2-56 too: cd1f82d8f (HEAD -> glib-2-56, origin/glib-2-56) gdbus-codegen: Fix header include in the body file