Fwd: [PATCH] Cygport: generate object files into {B} instead of ${S}/*_w64-mingw32

Jon Turney jon.turney@dronecode.org.uk
Wed Mar 19 19:25:34 GMT 2025


On 19/03/2025 09:33, Carlo B. via Cygwin-apps wrote:
> Hello,
> Thank you very much, I applied your patch and I tried to build one of
> tha packages that I made.

Thanks for testing!

> Now the libraries are correctly detected when it does the configuration.
> Unfortunately, it seems that it has the same defect that I got with my
> patch, because the debuginfo files are not created. The process prints
> on the console:

Oh, that's a bit disappointing. :(

> Unfortunately, something new happened after applying your patch.
> When executing the "package" command, cygport puts inside the source
> archive a gigantic patch file with the files created by "compile"
> command.

Yeah, this is my mistake, the new '_build.${CHOST}' directory should be 
automatically excluded from consideration for this patch generation.

Revised patch attached.

[...]
> 
> You can get the source archive by using the usual download command:
> 
> cygport rubberband.cygport download
> 
> and then start the creation of the package with the also usual:
> 
> cygport rubberband.cygport all
> 
> for creating the packages.
> These packages use the x86_64-w64-mingw32 cross compiler.

Thanks for this sample.

So, after looking at this a bit, the reason why a debuginfo package 
isn't generated is because none of the files are compiled with debug info.

This is due to this line in the cygport:

CXXFLAGS=-D_GNU_SOURCE

Which has the effect of overwriting the "-g" flag (and others) that 
cygport wants to supply to the compiler.

This is probably under-documented, but usually you want to append to, 
rather than overwrite the compiler flags, e.g.:

CXXFLAGS="${CXXFLAGS} -D_GNU_SOURCE"

With this change, the debuginfo package seems to be generated correctly!


(BTW: It would also be helpful if this cygport has 
BUILD_REQUIRES="mingw64-x86_64-fftw3 mingw64-x86_64-libsamplerate", so I 
know what packages to install to build it)
-------------- next part --------------
From 1a719c0433038cd60e74fc685faddd211c1c73ad Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@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 | 8 ++++----
 lib/pkg_pkg.cygpart     | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cygclass/meson.cygclass b/cygclass/meson.cygclass
index 20df7532..6fc448bc 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
@@ -120,7 +120,7 @@ meson_compile() {
 #  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
@@ -132,7 +132,7 @@ meson_test() {
 #  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)
diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 1ddef6ac..fb0805eb 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -335,7 +335,7 @@ __pkg_diff() {
 		 *.mo *.gmo *.orig *.rej *.spec *.temp *.whl *~ *.stackdump";
 
 	# as an alternative build directory to ${B}
-	default_excludes+=" ${CHOST}";
+	default_excludes+=" _build.* ${CHOST}";
 
 	if __config_equals with_aclocal 1
 	then
-- 
2.45.1



More information about the Cygwin-apps mailing list