This series of patches allow building the CRT (without tests or anything else) without installing headers first, and finally remove 'mingw-w64-headers/defaults' as done in f183d3b82fbf17ca0ec8ea7fdaee3d82f03b66ec.




The header `_mingw_ddk.h` is included as `sdks/_mingw_ddk.h` from `_mingw.h`
and it must be available before any other target is built.

Generate it using the configure script in the correct relative location to
that header.

Signed-off-by: Markus Mützel <[email protected]>
Co-authored-by: LIU Hao <[email protected]>
Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/Makefile.am              | 6 +-----
 mingw-w64-headers/configure.ac             | 1 +
 mingw-w64-headers/crt/sdks/_mingw_ddk.h.in | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/mingw-w64-headers/Makefile.am b/mingw-w64-headers/Makefile.am
index 6ebeda477..2e7d8eaf8 100644
--- a/mingw-w64-headers/Makefile.am
+++ b/mingw-w64-headers/Makefile.am
@@ -21,8 +21,7 @@ gdiplushead_HEADERS = @GDIPLUSHEAD_LIST@
 wrlhead_HEADERS = @WRLHEAD_LIST@
 wrlwrappershead_HEADERS = @WRLWRAPPERSHEAD_LIST@
 mingwhelperhead_HEADERS = @MINGWHELPERHEAD_LIST@
-nodist_sdkshead_HEADERS = _mingw_ddk.h
-noinst_HEADERS = crt/sdks/_mingw_ddk.h.in
+sdkshead_HEADERS = crt/sdks/_mingw_ddk.h
  ddkheaddir = $(baseheaddir)/ddk
 idlheaddir = $(baseheaddir)
@@ -413,6 +412,3 @@ include/prsht.h: ;
 include/wincrypt.h: ;
  endif
-
-_mingw_ddk.h: $(srcdir)/crt/sdks/_mingw_ddk.h.in
-       $(SED) s/MINGW_HAS_DDK$$/@MINGW_HAS_DDK@/ $< > $@
diff --git a/mingw-w64-headers/configure.ac b/mingw-w64-headers/configure.ac
index 3211fbd18..bb2d1455d 100644
--- a/mingw-w64-headers/configure.ac
+++ b/mingw-w64-headers/configure.ac
@@ -199,6 +199,7 @@ AC_SUBST([DEFAULT_MSVCRT_VERSION])
 AC_CONFIG_FILES([
   Makefile
   crt/_mingw.h
+  crt/sdks/_mingw_ddk.h
 ])
 AC_OUTPUT
 diff --git a/mingw-w64-headers/crt/sdks/_mingw_ddk.h.in 
b/mingw-w64-headers/crt/sdks/_mingw_ddk.h.in
index 0978eddeb..564e2e8ac 100644
--- a/mingw-w64-headers/crt/sdks/_mingw_ddk.h.in
+++ b/mingw-w64-headers/crt/sdks/_mingw_ddk.h.in
@@ -1,6 +1,6 @@
 #ifndef MINGW_DDK_H
 #define MINGW_DDK_H
-#if MINGW_HAS_DDK
+#if @MINGW_HAS_DDK@
 #define MINGW_HAS_DDK_H 1
 #endif
 #endif
--
2.52.0


From 06e40801a16a16fcfda56133d9062154475eae9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <[email protected]>
Date: Mon, 19 Jan 2026 15:08:29 +0100
Subject: [PATCH 2/4] Prefer headers in the source tree and generated headers
 over installed ones
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add `-isystem` to the preprocessor flags that prefer headers in the source
tree or headers the have been generated over ones that have been installed.

Signed-off-by: Markus Mützel <[email protected]>
Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-crt/Makefile.am | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 74f35ea12..f3d45d05b 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -11,11 +11,13 @@

 #AUTOMAKE_OPTIONS = color-tests

+sysincludes = -isystem $(top_srcdir)/../mingw-w64-headers/include \
+              -isystem $(top_srcdir)/../mingw-w64-headers/crt \
+              -isystem $(top_builddir)/../mingw-w64-headers/crt
 if WITHSYSROOT
-  sysincludes="-I@TARGET_SYSTEM_ROOT@/include"
+  sysincludes+="-isystem @TARGET_SYSTEM_ROOT@/include"
   withsys="--with-sysroot=@TARGET_SYSTEM_ROOT@"
 else
-  sysincludes=
   withsys=
 endif

--
2.52.0


From de9b64c809e8450708730a9ab03b4a613967874b Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Tue, 20 Jan 2026 13:38:55 +0800
Subject: [PATCH 3/4] headers: Remove obsolete 'defaults' directory

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/defaults/generate.sh               | 3 ---
 mingw-w64-headers/defaults/include/sdks/_mingw_ddk.h | 6 ------
 2 files changed, 9 deletions(-)
 delete mode 100755 mingw-w64-headers/defaults/generate.sh
 delete mode 100644 mingw-w64-headers/defaults/include/sdks/_mingw_ddk.h

diff --git a/mingw-w64-headers/defaults/generate.sh 
b/mingw-w64-headers/defaults/generate.sh
deleted file mode 100755
index b5bd08172..000000000
--- a/mingw-w64-headers/defaults/generate.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-sed s/@MINGW_HAS_DDK@/0/ crt/sdks/_mingw_ddk.h.in > 
defaults/include/sdks/_mingw_ddk.h
diff --git a/mingw-w64-headers/defaults/include/sdks/_mingw_ddk.h b/mingw-w64-headers/defaults/include/sdks/_mingw_ddk.h
deleted file mode 100644
index 93b2742b2..000000000
--- a/mingw-w64-headers/defaults/include/sdks/_mingw_ddk.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef MINGW_DDK_H
-#define MINGW_DDK_H
-#if 0
-#define MINGW_HAS_DDK_H 1
-#endif
-#endif
--
2.52.0


From 095d9ca7dca93910cb415a48f417e479f159dbda Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Tue, 20 Jan 2026 13:54:25 +0800
Subject: [PATCH 4/4] headers: Update .gitignore

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/.gitignore | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-headers/.gitignore b/mingw-w64-headers/.gitignore
index 17ad3be81..552b80e21 100644
--- a/mingw-w64-headers/.gitignore
+++ b/mingw-w64-headers/.gitignore
@@ -1,2 +1,2 @@
-_mingw_ddk.h
+crt/sdks/_mingw_ddk.h
 crt/_mingw.h
--
2.52.0

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to