changeset 5962:88dfa92d0c86

Add patches for building packages with UCRT. * src/flac-1-ucrt.patch, src/gdal-2-ucrt.patch, src/mesa-2-ucrt.patch: Don't set specific msvcrt version. * src/flac.mk: autoreconf after applying patch. * dist-files.mk: Add new files to build system.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 18 Nov 2021 14:59:34 +0100
parents 7c0066684448
children ca7bc7c7c141
files dist-files.mk src/flac-1-ucrt.patch src/flac.mk src/gdal-2-ucrt.patch src/mesa-2-ucrt.patch
diffstat 5 files changed, 103 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Thu Nov 18 14:49:26 2021 +0100
+++ b/dist-files.mk	Thu Nov 18 14:59:34 2021 +0100
@@ -95,6 +95,7 @@
   file-test.c \
   file.mk \
   fixesproto.mk \
+  flac-1-ucrt.patch \
   flac.mk \
   fltk-2-uuid-mod.patch \
   fltk-test.cpp \
@@ -121,6 +122,7 @@
   gd-test.c \
   gd.mk \
   gdal-1-gcc11.patch \
+  gdal-2-ucrt.patch \
   gdal.mk \
   gdb.mk \
   gdcm-1-nosecapi.patch \
@@ -337,6 +339,7 @@
   matio.mk \
   mdbtools.mk \
   mesa-1-meson.patch \
+  mesa-2-ucrt.patch \
   mesa-proto.mk \
   mesa.mk \
   mingw-blas-1-xerbla.patch \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/flac-1-ucrt.patch	Thu Nov 18 14:59:34 2021 +0100
@@ -0,0 +1,13 @@
+Don't force MSVCRT version on mingw.
+
+diff -aur a/configure.ac b/configure.ac
+--- a/configure.ac	2019-08-04 10:26:40.680643000 +0200
++++ b/configure.ac	2021-11-17 18:56:11.962266940 +0100
+@@ -208,7 +208,6 @@
+ os_is_windows=no
+ case "$host" in
+ 	*mingw*)
+-		CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS"
+ 		os_is_windows=yes
+ 		;;
+ esac
--- a/src/flac.mk	Thu Nov 18 14:49:26 2021 +0100
+++ b/src/flac.mk	Thu Nov 18 14:59:34 2021 +0100
@@ -19,10 +19,10 @@
 endef
 
 define $(PKG)_BUILD
-    cd '$(1)' && ./configure \
+    cd '$(1)' && autoreconf -fi && ./configure \
         $(HOST_AND_BUILD_CONFIGURE_OPTIONS) \
         $(ENABLE_SHARED_OR_STATIC) \
-	$(CONFIGURE_LDFLAGS) $(CONFIGURE_CPPFLAGS) \
+        $(CONFIGURE_LDFLAGS) $(CONFIGURE_CPPFLAGS) \
         --prefix='$(HOST_PREFIX)' \
         --disable-doxygen-docs \
         --disable-xmms-plugin \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gdal-2-ucrt.patch	Thu Nov 18 14:59:34 2021 +0100
@@ -0,0 +1,23 @@
+From bd4d925741b6c06ba38888a9bb959b490adf27af Mon Sep 17 00:00:00 2001
+From: Jeremy Drake <github@jdrake.com>
+Date: Mon, 18 Oct 2021 11:02:08 -0700
+Subject: [PATCH] gdal: don't define __MSVCRT_VERSION__
+
+--- gdal-3.3.2/port/cpl_port.h.orig	2021-10-18 10:57:01.393925700 -0700
++++ gdal-3.3.2/port/cpl_port.h	2021-10-18 10:57:27.784506600 -0700
+@@ -113,15 +113,6 @@
+ /*      MinGW stuff                                                     */
+ /* ==================================================================== */
+ 
+-/* We need __MSVCRT_VERSION__ >= 0x0700 to have "_aligned_malloc" */
+-/* Latest versions of mingw32 define it, but with older ones, */
+-/* we need to define it manually */
+-#if defined(__MINGW32__)
+-#ifndef __MSVCRT_VERSION__
+-#define __MSVCRT_VERSION__ 0x0700
+-#endif
+-#endif
+-
+ /* Needed for std=c11 on Solaris to have strcasecmp() */
+ #if defined(GDAL_COMPILATION) && defined(__sun__) && (__STDC_VERSION__ + 0) >= 201112L && (_XOPEN_SOURCE + 0) < 600
+ #ifdef _XOPEN_SOURCE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mesa-2-ucrt.patch	Thu Nov 18 14:59:34 2021 +0100
@@ -0,0 +1,62 @@
+From a3b60fc23f2968e2d22c8d46baf29d4cd90b0d5c Mon Sep 17 00:00:00 2001
+From: Jeremy Drake <github@jdrake.com>
+Date: Sat, 16 Oct 2021 16:50:46 -0700
+Subject: [PATCH] mesa: fixes for UCRT.
+
+--- mesa-21.2.4/meson.build.orig	2021-10-16 16:02:38.021997300 -0700
++++ mesa-21.2.4/meson.build	2021-10-16 16:03:24.287545400 -0700
+@@ -1046,8 +1046,6 @@
+       '-D_HAS_EXCEPTIONS=0', # Tell C++ STL to not use exceptions
+       '-DNOMINMAX',
+     ]
+-  else
+-    pre_args += ['-D__MSVCRT_VERSION__=0x0700']
+   endif
+ elif host_machine.system() == 'openbsd'
+   pre_args += '-D_ISOC11_SOURCE'
+--- mesa-21.2.4/src/compiler/spirv/vtn_private.h.orig	2021-10-16 15:28:02.537761600 -0700
++++ mesa-21.2.4/src/compiler/spirv/vtn_private.h	2021-10-16 15:28:05.959391400 -0700
+@@ -41,7 +41,7 @@
+ struct vtn_decoration;
+ 
+ /* setjmp/longjmp is broken on MinGW: https://sourceforge.net/p/mingw-w64/bugs/406/ */
+-#ifdef __MINGW32__
++#if defined(__MINGW32__) && !defined(_UCRT)
+   #define vtn_setjmp __builtin_setjmp
+   #define vtn_longjmp __builtin_longjmp
+ #else
+--- mesa-21.2.4/src/compiler/nir/nir.h.orig	2021-10-14 12:59:05.367845000 -0700
++++ mesa-21.2.4/src/compiler/nir/nir.h	2021-10-16 15:55:09.881268400 -0700
+@@ -54,7 +54,7 @@
+ 
+ #include "nir_opcodes.h"
+ 
+-#if defined(_WIN32) && !defined(snprintf)
++#if defined(_WIN32) && !defined(snprintf) && !defined(_UCRT)
+ #define snprintf _snprintf
+ #endif
+ 
+--- mesa-21.2.4/src/compiler/nir/nir_lower_atomics_to_ssbo.c.orig	2021-10-14 12:59:05.375845200 -0700
++++ mesa-21.2.4/src/compiler/nir/nir_lower_atomics_to_ssbo.c	2021-10-16 15:55:30.818804300 -0700
+@@ -27,10 +27,6 @@
+ #include "nir.h"
+ #include "nir_builder.h"
+ 
+-#if defined(_WIN32) && !defined(snprintf)
+-#define snprintf _snprintf
+-#endif
+-
+ /*
+  * Remap atomic counters to SSBOs, starting from the shader's next SSBO slot
+  * (info.num_ssbos).
+--- mesa-21.2.4/src/gallium/drivers/swr/swr_fence.cpp.orig	2021-10-16 16:29:10.287533700 -0700
++++ mesa-21.2.4/src/gallium/drivers/swr/swr_fence.cpp	2021-10-16 16:29:45.678206500 -0700
+@@ -29,7 +29,7 @@
+ #include "swr_screen.h"
+ #include "swr_fence.h"
+ 
+-#ifdef __APPLE__
++#if defined(__APPLE__) || defined(__MINGW32__)
+ #include <sched.h>
+ #endif
+