[PATCH wayland-protocols] sysroot prefix

Quentin Glidic sardemff7+wayland at sardemff7.net
Thu Jul 20 09:14:13 UTC 2017

On 7/6/17 11:02 AM, Tomek Bury wrote:
> Hi,
> I've attached a trivial patch we discussed yesterday on #wayland 
> channel. The patch adds a sysroot prefix to the "pkgdatadir" variable. 
> The pkg-config automatically adds sysroot to paths returned by --cflags 
> and --libs but *NOT* to --variable.
> The "pkgdatadir" in wayland-protocols.pc is actually a path pointing to 
> the protocol installation directory on the target system but in a 
> cross-compilation scenario we need pkg-config to return a temporary 
> location in the staging area on the build system just as it does for 
> --cflags and --libs.
> The change only influences builds with PKG_CONFIG_SYSROOT_DIR 
> environment variable set.
> There's another pkg-confing variable containing a path to the 
> wayland-scanner tool but I'm not sure how to handle that one correctly 
> in cross-compilation scenario.  The cross-compiled wayland-scanner is 
> likely to be useless on the build system. The pre-existing 
> wayland-scanner on the build system, if any, is also likely to be 
> useless. The only scanner that would actually work is the scanner 
> compiled from wayland sources for the build system architecture and 
> installed somewhere with its own .pc file. This implies that libs using 
> scanner would need 2 independent pkg-config setups.
> My call would be to get rid of that variable and add 
> --with-wayland-scanner=/path/to/the/right/wayland-scanner config 
> variable to xkbcommon, wayland, weston and whatever uses wayland-scanner.
> Cheers,
> Tomek

Nit: please use git send-email to send patches, so we can comment on 
them inline in the email.

 > -pkgdatadir=@datadir@/@PACKAGE@
 > +pkgdatadir=${pc_sysrootdir}/@datadir@/@PACKAGE@

Using ${pc_sysrootdir} sounds like the correct thing to do. However, 
your patch introduces a triple / when PKG_CONFIG_SYSROOT_DIR is not set.
Having two / is already trouble on some platform (though the one we 
currently work on should be fine, I think), three / would break even more.
Please just use "${pc_sysrootdir}@datadir@".

Also, using this variable should be in prefix=, IMO, since all the paths 
should be fixed.
But that would break builds where you directly specify --datadir, so we 
probably want to do that for now. (Until we use Meson *and* Meson 
pkg-config module gets proper custom variables support.)



Quentin “Sardem FF7” Glidic

More information about the wayland-devel mailing list