From a46253dc772488afbed9ca9f66b236f8f295064f Mon Sep 17 00:00:00 2001 From: Angel J <78835633+Iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 12:25:46 -0700 Subject: [PATCH] perlPackages.BoostGeometryUtils: fix Darwin build Patch the bundled Boost numeric conversion enum wrappers on Darwin, where modern Clang rejects the old Boost.MPL enum constants. Also force the XS C++ compile to C++14 to avoid newer C++ mode incompatibilities. --- pkgs/top-level/perl-packages.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index b0fcca553b30..23d07a30c03d 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -2656,6 +2656,34 @@ with self; # Fix out of memory error on Perl 5.19.4 and later. ../development/perl-modules/boost-geometry-utils-fix-oom.patch ]; + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + # Clang on Darwin defaults to a newer C++ mode where the old bundled Boost + # headers no longer compile. + substituteInPlace Build.PL \ + --replace-fail "extra_compiler_flags => [qw(-DHAS_BOOL)]" \ + "extra_compiler_flags => [qw(-DHAS_BOOL -std=c++14)]" + + # Avoid Boost.MPL enum wrappers that modern Clang rejects as out-of-range + # enum constant expressions. + substituteInPlace src/boost/numeric/conversion/detail/int_float_mixture.hpp \ + --replace-fail '#include "boost/mpl/integral_c.hpp"' "" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" + perl -i -pe 'if ($. == 22) { $_ .= " template struct int_float_mixture_constant { static const int_float_mixture_enum value = v; typedef int_float_mixture_constant type; typedef int_float_mixture_enum value_type; operator int_float_mixture_enum() const { return value; } };\n" }' \ + src/boost/numeric/conversion/detail/int_float_mixture.hpp + + # Same workaround for the user-defined-type/builtin-type conversion enum. + substituteInPlace src/boost/numeric/conversion/detail/udt_builtin_mixture.hpp \ + --replace-fail '#include "boost/mpl/integral_c.hpp"' "" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" + perl -i -pe 'if ($. == 21) { $_ .= " template struct udt_builtin_mixture_constant { static const udt_builtin_mixture_enum value = v; typedef udt_builtin_mixture_constant type; typedef udt_builtin_mixture_enum value_type; operator udt_builtin_mixture_enum() const { return value; } };\n" }' \ + src/boost/numeric/conversion/detail/udt_builtin_mixture.hpp + ''; buildInputs = [ ExtUtilsCppGuess ExtUtilsTypemapsDefault