diff mbox series

wayland: consider pkgconfig sysroot for pkgdatadir

Message ID 20231001102818.797907-1-cordlandwehr@kde.org
State Accepted, archived
Commit 428ffec520ff25b2a29d506d7af9e6ba8a150d8f
Headers show
Series wayland: consider pkgconfig sysroot for pkgdatadir | expand

Commit Message

Andreas Cord-Landwehr Oct. 1, 2023, 10:28 a.m. UTC
Fix pkgconfig find calls to find wayland protocol XML files.
See discussion in:
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/102

Signed-off-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
---
 ...der-pkgconfig-sysroot-for-pkgdatadir.patch | 46 +++++++++++++++++++
 .../wayland/wayland_1.22.0.bb                 |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch

Comments

Alexander Kanavin Oct. 5, 2023, 8:53 a.m. UTC | #1
Can you show where this is causing problems for you? We're not seeing
the issue in CI builds, so the problem this is solving needs to be
better explained.

Also upstream has a point: we should migrate away from a long
unmaintained freedesktop pkg-config.

Alex

On Sun, 1 Oct 2023 at 12:28, Andreas Cord-Landwehr <cordlandwehr@kde.org> wrote:
>
> Fix pkgconfig find calls to find wayland protocol XML files.
> See discussion in:
> https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/102
>
> Signed-off-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
> ---
>  ...der-pkgconfig-sysroot-for-pkgdatadir.patch | 46 +++++++++++++++++++
>  .../wayland/wayland_1.22.0.bb                 |  1 +
>  2 files changed, 47 insertions(+)
>  create mode 100644 meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
>
> diff --git a/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
> new file mode 100644
> index 0000000000..4573bb635a
> --- /dev/null
> +++ b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
> @@ -0,0 +1,46 @@
> +From ff8ecbe8891d592e645927659318720f9e190054 Mon Sep 17 00:00:00 2001
> +From: Andreas Cord-Landwehr <cordlandwehr@kde.org>
> +Date: Sun, 6 Feb 2022 17:23:46 +0100
> +Subject: [PATCH] Consider pkgconfig sysroot for pkgdatadir
> +
> +For libs/cflags this is done automatically, but not for manually accessed
> +variables. This matches what wayland-protocols does.
> +
> +Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/272]
> +---
> + src/meson.build | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/src/meson.build b/src/meson.build
> +index a8a1d2b..721e151 100644
> +--- a/src/meson.build
> ++++ b/src/meson.build
> +@@ -65,7 +65,7 @@ if get_option('scanner')
> +               version: meson.project_version(),
> +               variables: [
> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name()),
> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name()),
> +                       'bindir=' + join_paths('${prefix}', get_option('bindir')),
> +                       'wayland_scanner=${bindir}/wayland-scanner'
> +               ],
> +@@ -211,7 +211,7 @@ if get_option('libraries')
> +               filebase: 'wayland-server',
> +               variables: [
> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
> +               ]
> +       )
> +
> +@@ -250,7 +250,7 @@ if get_option('libraries')
> +               filebase: 'wayland-client',
> +               variables: [
> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
> +               ]
> +       )
> +
> +--
> +2.37.2
> diff --git a/meta/recipes-graphics/wayland/wayland_1.22.0.bb b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
> index 26bad580eb..17e4a0cd98 100644
> --- a/meta/recipes-graphics/wayland/wayland_1.22.0.bb
> +++ b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
> @@ -15,6 +15,7 @@ DEPENDS = "expat libffi wayland-native"
>  SRC_URI = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/${PV}/downloads/${BPN}-${PV}.tar.xz \
>             file://run-ptest \
>             file://0001-build-Fix-strndup-detection-on-MinGW.patch \
> +           file://0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch \
>             "
>  SRC_URI[sha256sum] = "1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842"
>
> --
> 2.39.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#188480): https://lists.openembedded.org/g/openembedded-core/message/188480
> Mute This Topic: https://lists.openembedded.org/mt/101689465/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Andreas Cord-Landwehr Oct. 5, 2023, 7:18 p.m. UTC | #2
Hi Alex,

this patch is needed for building kwin and layer-shell-qt from meta-kde 
layer. Right now, we carry this patch for Wayland to fix essentially 
pkg-config's call "pkg-config --variable=pkgdatadir wayland-client" to 
locate the folder with wayland.xml, which is needed during code 
generation of the C & C++ API with wayland-scanner and qtwaylandscanner.
Without the patch the pkgdatadir location is reported, and I think that 
is the biggest issue here, to be "/usr/share/wayland/" as an absolute 
path and thus breaks out of the recipe-sysroot and leaks the host 
system's wayland.xml in the build process.

Regarding a switch away from pkg-config, I like to let others comment 
with more insights into that topic :)

Best regards,
Andreas

On 05.10.23 10:53, Alexander Kanavin wrote:
> Can you show where this is causing problems for you? We're not seeing
> the issue in CI builds, so the problem this is solving needs to be
> better explained.
> 
> Also upstream has a point: we should migrate away from a long
> unmaintained freedesktop pkg-config.
> 
> Alex
> 
> On Sun, 1 Oct 2023 at 12:28, Andreas Cord-Landwehr <cordlandwehr@kde.org> wrote:
>>
>> Fix pkgconfig find calls to find wayland protocol XML files.
>> See discussion in:
>> https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/102
>>
>> Signed-off-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
>> ---
>>   ...der-pkgconfig-sysroot-for-pkgdatadir.patch | 46 +++++++++++++++++++
>>   .../wayland/wayland_1.22.0.bb                 |  1 +
>>   2 files changed, 47 insertions(+)
>>   create mode 100644 meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
>>
>> diff --git a/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
>> new file mode 100644
>> index 0000000000..4573bb635a
>> --- /dev/null
>> +++ b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
>> @@ -0,0 +1,46 @@
>> +From ff8ecbe8891d592e645927659318720f9e190054 Mon Sep 17 00:00:00 2001
>> +From: Andreas Cord-Landwehr <cordlandwehr@kde.org>
>> +Date: Sun, 6 Feb 2022 17:23:46 +0100
>> +Subject: [PATCH] Consider pkgconfig sysroot for pkgdatadir
>> +
>> +For libs/cflags this is done automatically, but not for manually accessed
>> +variables. This matches what wayland-protocols does.
>> +
>> +Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/272]
>> +---
>> + src/meson.build | 6 +++---
>> + 1 file changed, 3 insertions(+), 3 deletions(-)
>> +
>> +diff --git a/src/meson.build b/src/meson.build
>> +index a8a1d2b..721e151 100644
>> +--- a/src/meson.build
>> ++++ b/src/meson.build
>> +@@ -65,7 +65,7 @@ if get_option('scanner')
>> +               version: meson.project_version(),
>> +               variables: [
>> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
>> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name()),
>> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name()),
>> +                       'bindir=' + join_paths('${prefix}', get_option('bindir')),
>> +                       'wayland_scanner=${bindir}/wayland-scanner'
>> +               ],
>> +@@ -211,7 +211,7 @@ if get_option('libraries')
>> +               filebase: 'wayland-server',
>> +               variables: [
>> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
>> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
>> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
>> +               ]
>> +       )
>> +
>> +@@ -250,7 +250,7 @@ if get_option('libraries')
>> +               filebase: 'wayland-client',
>> +               variables: [
>> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
>> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
>> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
>> +               ]
>> +       )
>> +
>> +--
>> +2.37.2
>> diff --git a/meta/recipes-graphics/wayland/wayland_1.22.0.bb b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
>> index 26bad580eb..17e4a0cd98 100644
>> --- a/meta/recipes-graphics/wayland/wayland_1.22.0.bb
>> +++ b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
>> @@ -15,6 +15,7 @@ DEPENDS = "expat libffi wayland-native"
>>   SRC_URI = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/${PV}/downloads/${BPN}-${PV}.tar.xz \
>>              file://run-ptest \
>>              file://0001-build-Fix-strndup-detection-on-MinGW.patch \
>> +           file://0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch \
>>              "
>>   SRC_URI[sha256sum] = "1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842"
>>
>> --
>> 2.39.2
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#188480): https://lists.openembedded.org/g/openembedded-core/message/188480
>> Mute This Topic: https://lists.openembedded.org/mt/101689465/1686489
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Alexander Kanavin Oct. 11, 2023, 7:48 a.m. UTC | #3
Hello Andreas,

thanks for the explanation, this s fine, but can you add it to the
commit message so it's preserved in history?

I'd say we do need to switch to a maintained implementation of
pkgconfig, and align with regular distros on that, Ross, do you know
if something's holding that back (other than the usual lack of
time/people/patience with chasing corner cases etc).

Alex

On Thu, 5 Oct 2023 at 21:18, Andreas Cord-Landwehr <cordlandwehr@kde.org> wrote:
>
> Hi Alex,
>
> this patch is needed for building kwin and layer-shell-qt from meta-kde
> layer. Right now, we carry this patch for Wayland to fix essentially
> pkg-config's call "pkg-config --variable=pkgdatadir wayland-client" to
> locate the folder with wayland.xml, which is needed during code
> generation of the C & C++ API with wayland-scanner and qtwaylandscanner.
> Without the patch the pkgdatadir location is reported, and I think that
> is the biggest issue here, to be "/usr/share/wayland/" as an absolute
> path and thus breaks out of the recipe-sysroot and leaks the host
> system's wayland.xml in the build process.
>
> Regarding a switch away from pkg-config, I like to let others comment
> with more insights into that topic :)
>
> Best regards,
> Andreas
>
> On 05.10.23 10:53, Alexander Kanavin wrote:
> > Can you show where this is causing problems for you? We're not seeing
> > the issue in CI builds, so the problem this is solving needs to be
> > better explained.
> >
> > Also upstream has a point: we should migrate away from a long
> > unmaintained freedesktop pkg-config.
> >
> > Alex
> >
> > On Sun, 1 Oct 2023 at 12:28, Andreas Cord-Landwehr <cordlandwehr@kde.org> wrote:
> >>
> >> Fix pkgconfig find calls to find wayland protocol XML files.
> >> See discussion in:
> >> https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/102
> >>
> >> Signed-off-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
> >> ---
> >>   ...der-pkgconfig-sysroot-for-pkgdatadir.patch | 46 +++++++++++++++++++
> >>   .../wayland/wayland_1.22.0.bb                 |  1 +
> >>   2 files changed, 47 insertions(+)
> >>   create mode 100644 meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
> >>
> >> diff --git a/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
> >> new file mode 100644
> >> index 0000000000..4573bb635a
> >> --- /dev/null
> >> +++ b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
> >> @@ -0,0 +1,46 @@
> >> +From ff8ecbe8891d592e645927659318720f9e190054 Mon Sep 17 00:00:00 2001
> >> +From: Andreas Cord-Landwehr <cordlandwehr@kde.org>
> >> +Date: Sun, 6 Feb 2022 17:23:46 +0100
> >> +Subject: [PATCH] Consider pkgconfig sysroot for pkgdatadir
> >> +
> >> +For libs/cflags this is done automatically, but not for manually accessed
> >> +variables. This matches what wayland-protocols does.
> >> +
> >> +Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/272]
> >> +---
> >> + src/meson.build | 6 +++---
> >> + 1 file changed, 3 insertions(+), 3 deletions(-)
> >> +
> >> +diff --git a/src/meson.build b/src/meson.build
> >> +index a8a1d2b..721e151 100644
> >> +--- a/src/meson.build
> >> ++++ b/src/meson.build
> >> +@@ -65,7 +65,7 @@ if get_option('scanner')
> >> +               version: meson.project_version(),
> >> +               variables: [
> >> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
> >> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name()),
> >> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name()),
> >> +                       'bindir=' + join_paths('${prefix}', get_option('bindir')),
> >> +                       'wayland_scanner=${bindir}/wayland-scanner'
> >> +               ],
> >> +@@ -211,7 +211,7 @@ if get_option('libraries')
> >> +               filebase: 'wayland-server',
> >> +               variables: [
> >> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
> >> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
> >> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
> >> +               ]
> >> +       )
> >> +
> >> +@@ -250,7 +250,7 @@ if get_option('libraries')
> >> +               filebase: 'wayland-client',
> >> +               variables: [
> >> +                       'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
> >> +-                      'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
> >> ++                      'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
> >> +               ]
> >> +       )
> >> +
> >> +--
> >> +2.37.2
> >> diff --git a/meta/recipes-graphics/wayland/wayland_1.22.0.bb b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
> >> index 26bad580eb..17e4a0cd98 100644
> >> --- a/meta/recipes-graphics/wayland/wayland_1.22.0.bb
> >> +++ b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
> >> @@ -15,6 +15,7 @@ DEPENDS = "expat libffi wayland-native"
> >>   SRC_URI = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/${PV}/downloads/${BPN}-${PV}.tar.xz \
> >>              file://run-ptest \
> >>              file://0001-build-Fix-strndup-detection-on-MinGW.patch \
> >> +           file://0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch \
> >>              "
> >>   SRC_URI[sha256sum] = "1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842"
> >>
> >> --
> >> 2.39.2
> >>
> >>
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >> Links: You receive all messages sent to this group.
> >> View/Reply Online (#188480): https://lists.openembedded.org/g/openembedded-core/message/188480
> >> Mute This Topic: https://lists.openembedded.org/mt/101689465/1686489
> >> Group Owner: openembedded-core+owner@lists.openembedded.org
> >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >>
Richard Purdie Oct. 11, 2023, 7:59 a.m. UTC | #4
On Wed, 2023-10-11 at 09:48 +0200, Alexander Kanavin wrote:
> Hello Andreas,
> 
> thanks for the explanation, this s fine, but can you add it to the
> commit message so it's preserved in history?
> 
> I'd say we do need to switch to a maintained implementation of
> pkgconfig, and align with regular distros on that, Ross, do you know
> if something's holding that back (other than the usual lack of
> time/people/patience with chasing corner cases etc).

The two options have incompatible behaviour and it wasn't clear that
either have a good maintenance path last time we looked. Most software
is aligned with the version we have which is the standard.

pkg-config is relatively stable, it doesn't change much and that is a
good thing due to the way it is used. The question is whether the "lack
of maintenance" is causing us a problem, I'm not sure it is. I suspect
we're better focusing on other areas.

Cheers,

Richard
Khem Raj Oct. 11, 2023, 3:23 p.m. UTC | #5
On Wed, Oct 11, 2023 at 12:59 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Wed, 2023-10-11 at 09:48 +0200, Alexander Kanavin wrote:
> > Hello Andreas,
> >
> > thanks for the explanation, this s fine, but can you add it to the
> > commit message so it's preserved in history?
> >
> > I'd say we do need to switch to a maintained implementation of
> > pkgconfig, and align with regular distros on that, Ross, do you know
> > if something's holding that back (other than the usual lack of
> > time/people/patience with chasing corner cases etc).
>
> The two options have incompatible behaviour and it wasn't clear that
> either have a good maintenance path last time we looked. Most software
> is aligned with the version we have which is the standard.
>

There were some missing aspects w.r.t sysroot as well which is useful for
cross compilation maybe that’s working now I haven’t looked at it for a
long time


> pkg-config is relatively stable, it doesn't change much and that is a
> good thing due to the way it is used. The question is whether the "lack
> of maintenance" is causing us a problem, I'm not sure it is. I suspect
> we're better focusing on other areas.
>
> Cheers,
>
> Richard
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#188944):
> https://lists.openembedded.org/g/openembedded-core/message/188944
> Mute This Topic: https://lists.openembedded.org/mt/101689465/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
new file mode 100644
index 0000000000..4573bb635a
--- /dev/null
+++ b/meta/recipes-graphics/wayland/wayland/0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch
@@ -0,0 +1,46 @@ 
+From ff8ecbe8891d592e645927659318720f9e190054 Mon Sep 17 00:00:00 2001
+From: Andreas Cord-Landwehr <cordlandwehr@kde.org>
+Date: Sun, 6 Feb 2022 17:23:46 +0100
+Subject: [PATCH] Consider pkgconfig sysroot for pkgdatadir
+
+For libs/cflags this is done automatically, but not for manually accessed
+variables. This matches what wayland-protocols does.
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/272]
+---
+ src/meson.build | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/meson.build b/src/meson.build
+index a8a1d2b..721e151 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -65,7 +65,7 @@ if get_option('scanner')
+ 		version: meson.project_version(),
+ 		variables: [
+ 			'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
+-			'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name()),
++			'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name()),
+ 			'bindir=' + join_paths('${prefix}', get_option('bindir')),
+ 			'wayland_scanner=${bindir}/wayland-scanner'
+ 		],
+@@ -211,7 +211,7 @@ if get_option('libraries')
+ 		filebase: 'wayland-server',
+ 		variables: [
+ 			'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
+-			'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
++			'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
+ 		]
+ 	)
+
+@@ -250,7 +250,7 @@ if get_option('libraries')
+ 		filebase: 'wayland-client',
+ 		variables: [
+ 			'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
+-			'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
++			'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', meson.project_name())
+ 		]
+ 	)
+
+--
+2.37.2
diff --git a/meta/recipes-graphics/wayland/wayland_1.22.0.bb b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
index 26bad580eb..17e4a0cd98 100644
--- a/meta/recipes-graphics/wayland/wayland_1.22.0.bb
+++ b/meta/recipes-graphics/wayland/wayland_1.22.0.bb
@@ -15,6 +15,7 @@  DEPENDS = "expat libffi wayland-native"
 SRC_URI = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/${PV}/downloads/${BPN}-${PV}.tar.xz \
            file://run-ptest \
            file://0001-build-Fix-strndup-detection-on-MinGW.patch \
+           file://0002-Consider-pkgconfig-sysroot-for-pkgdatadir.patch \
            "
 SRC_URI[sha256sum] = "1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842"