On 17/03/2025 22:26, Jon Turney via Cygwin-apps wrote:
On 17/03/2025 09:02, Carlo B. via Cygwin-apps wrote:
[...]
Thanks very much for the simple test case!
This is pretty weird. The meson-log.txt file says that running '/usr/
bin/x86_64-w64-mingw32-pkg-config --modversion glib-2.0' is failing, but
that works fine when run from the command line.
After poking at it for a bit, I discovered that the presence of a
'x86_64-w64-mingw32' directory in the working directory seems to be the
thing which makes it fail.
(So I'm guessing pkgconf does something like look there, rather than in
the sysroot, if it exists, although I can't find that documented
anywhere, and I don't have time to go diving through the source right now)
I guess maybe a fix/workaround would be to change the name of the
subdirectory used for the meson build from '${CHOST}' to 'build.
${CHOST}' or similar.
So something like the attached (which appears to fix things for your
testcase)...
From c090bc5bf4f11d5e6eb2e2709c508b7e62352c56 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.tur...@dronecode.org.uk>
Date: Tue, 18 Mar 2025 17:06:22 +0000
Subject: [PATCH cygport] meson: Use '_build.${CHOST}' rather than '${CHOST}'
as builddir
Use '_build.${CHOST}' rather than '${CHOST}' as the name of the build
directory.
It seems that a cross-pkgconf will try to use a directory named after
the target triple as the sysroot, if it finds one in the working
directory, which we definitely don't want!
Based on a patch by Carlo Bramini.
https://cygwin.com/pipermail/cygwin-apps/2025-March/044077.html
---
cygclass/meson.cygclass | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/cygclass/meson.cygclass b/cygclass/meson.cygclass
index 20df7532..9aa51209 100644
--- a/cygclass/meson.cygclass
+++ b/cygclass/meson.cygclass
@@ -93,7 +93,7 @@ cygmeson() {
--sysconfdir=$(__host_sysconfdir) \
--buildtype=plain --wrap-mode=nodownload \
--auto-features=enabled \
- ${crossargs} ${CYGMESON_ARGS} "${@}" ${CHOST} \
+ ${crossargs} ${CYGMESON_ARGS} "${@}" _build.${CHOST} \
|| error "meson failed"
}
@@ -108,7 +108,7 @@ cygmeson() {
#****
meson_compile() {
cygmeson ${@}
- cygninja -C ${CHOST}
+ cygninja -C _build.${CHOST}
}
#****T* meson.cygclass/meson_test
@@ -116,11 +116,9 @@ meson_compile() {
# meson_test
# DESCRIPTION
# Calls ninja test to run the package's testsuite.
-# NOTE
-# meson_test should be run in the directory containing the top-level
meson.build.
#****
meson_test() {
- ninja_test -C ${CHOST}
+ ninja_test -C _build.${CHOST}
}
#****I* meson.cygclass/meson_install
@@ -128,11 +126,9 @@ meson_test() {
# meson_install
# DESCRIPTION
# Runs ninja install to install the package into D.
-# NOTE
-# meson_install should be run in the directory containing the top-level
meson.build.
#****
meson_install() {
- ninja_install -C ${CHOST}
+ ninja_install -C _build.${CHOST}
}
#****o* meson.cygclass/src_compile (meson)
--
2.45.1