git: 1fe6f2477967 - main - math/vtk9: fix build with libc++ 21

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 31 Jan 2026 18:20:00 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1fe6f247796702372b50b08c464536586f8468c7

commit 1fe6f247796702372b50b08c464536586f8468c7
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-01-19 19:58:42 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-01-31 18:18:37 +0000

    math/vtk9: fix build with libc++ 21
    
    With libc++ 21, math/vtk9 fails to compile, resulting in errors similar
    to:
    
        In file included from /wrkdirs/usr/ports/math/vtk9/work/VTK-9.5.2/ThirdParty/fmt/vtkfmt/src/os.cc:14:
        In file included from /wrkdirs/usr/ports/math/vtk9/work/VTK-9.5.2/ThirdParty/fmt/vtkfmt/vtkfmt/os.h:11:
        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.5.2/ThirdParty/fmt/vtkfmt/vtkfmt/format.h:747:28: error: use of undeclared identifier 'malloc'
          747 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
              |                            ^~~~~~
        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.5.2/ThirdParty/fmt/vtkfmt/vtkfmt/format.h:752:35: error: use of undeclared identifier 'free'
          752 |   void deallocate(T* p, size_t) { free(p); }
              |                                   ^~~~
    
    This is because malloc and free are defined in <cstdlib>, which is not
    included in vtk's format.h. Add the include to fix the build.
    
    PR:             292590
    Approved by:    yuri (maintainer)
    MFH:            2026Q1
---
 math/vtk9/files/patch-ThirdParty_fmt_vtkfmt_vtkfmt_format.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/math/vtk9/files/patch-ThirdParty_fmt_vtkfmt_vtkfmt_format.h b/math/vtk9/files/patch-ThirdParty_fmt_vtkfmt_vtkfmt_format.h
new file mode 100644
index 000000000000..5ae8d9addfdf
--- /dev/null
+++ b/math/vtk9/files/patch-ThirdParty_fmt_vtkfmt_vtkfmt_format.h
@@ -0,0 +1,10 @@
+--- ThirdParty/fmt/vtkfmt/vtkfmt/format.h.orig	2025-09-17 20:02:27 UTC
++++ ThirdParty/fmt/vtkfmt/vtkfmt/format.h
+@@ -44,6 +44,7 @@
+ #  include <cmath>    // std::signbit
+ #  include <cstddef>  // std::byte
+ #  include <cstdint>  // uint32_t
++#  include <cstdlib>  // malloc/free
+ #  include <cstring>  // std::memcpy
+ #  include <limits>   // std::numeric_limits
+ #  include <new>      // std::bad_alloc