package/wayland: tweak wayland-scanner.pc after installation to fix SDL2 build issue
Some packages such as SDL2 do this: WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` to find the path to the wayland-scanner tool. Of course, since SDL2 is compiled for the target, it does that using the pkg-config configured for cross-compilation, which looks at $(STAGING_DIR)/usr/lib/pkgconfig/wayland-scanner.pc. Since it looks at the variable wayland_scanner, which doesn't get prefixed by PKG_CONFIG_SYSROOT_DIR, the SDL2 configure script is told that wayland-scanner is in /usr/bin/wayland-scanner causing this kind of build failure: /bin/bash: line 1: /usr/bin/wayland-scanner: No such file or directory /bin/bash: line 1: /usr/bin/wayland-scanner: No such file or directory when building SDL2. The target wayland package depends on host-wayland, which most notably is responsible for installing wayland-scanner in $(HOST_DIR)/bin. So in order to fix the SDL2 build issue but in a global way (possibly helping other packages), what this patch does is tweak the wayland-scanner.pc installed by the target wayland so that its wayland_scanner variable points to the host wayland-scanner executable. We find this a better solution than passing a WAYLAND_SCANNER variable to each and every package that needs wayland-scanner. The issue is not visible in the autobuilders, but can be reproduced using the following defconfig: BR2_arm=y BR2_cortex_a9=y BR2_ARM_ENABLE_VFP=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_INIT_NONE=y BR2_SYSTEM_BIN_SH_NONE=y # BR2_PACKAGE_BUSYBOX is not set BR2_PACKAGE_SDL2=y BR2_PACKAGE_SDL2_WAYLAND=y BR2_PACKAGE_SDL2_OPENGLES=y BR2_PACKAGE_RPI_USERLAND=y BR2_PACKAGE_WAYLAND=y # BR2_TARGET_ROOTFS_TAR is not set Note: Make sure that wayland-scanner is not be installed on the build host to reproduce the issue. The issue probably exists since WAYLAND_SCANNER was retrieved using pkg-config in SDL2's configure.ac script, in upstream commit 19d3500ae19636f3f410e270f12e0bc5e83410d4, which got first introduced in release-2.0.5 of SDL2. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [Romain: add a comment about wayland-scanner to reproduce the issue] Signed-off-by: Romain Naour <romain.naour@smile.fr>
This commit is contained in:
committed by
Romain Naour
parent
0f20d9a9b8
commit
b1b3aab60d
@@ -23,5 +23,17 @@ define WAYLAND_TARGET_CLEANUP
|
||||
endef
|
||||
WAYLAND_POST_INSTALL_TARGET_HOOKS += WAYLAND_TARGET_CLEANUP
|
||||
|
||||
# The wayland-scanner.pc installed by the target wayland package is
|
||||
# used to find the wayland-scanner tool, which in a cross-compilation
|
||||
# context is compiled for the host (and in Buildroot, compiled by
|
||||
# host-wayland). Below, we tweak the target wayland-scanner.pc so that
|
||||
# when the wayland_scanner variable is requested through pkg-config,
|
||||
# it points to the host wayland_scanner tool.
|
||||
define WAYLAND_TWEAK_WAYLAND_SCANNER_PATH
|
||||
$(SED) 's%^wayland_scanner=.*%wayland_scanner=$(HOST_DIR)/bin/wayland-scanner%' \
|
||||
$(STAGING_DIR)/usr/lib/pkgconfig/wayland-scanner.pc
|
||||
endef
|
||||
WAYLAND_POST_INSTALL_TARGET_HOOKS += WAYLAND_TWEAK_WAYLAND_SCANNER_PATH
|
||||
|
||||
$(eval $(meson-package))
|
||||
$(eval $(host-meson-package))
|
||||
|
||||
Reference in New Issue
Block a user