summaryrefslogtreecommitdiff
path: root/user/perl-extutils-cppguess/fix.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/perl-extutils-cppguess/fix.patch')
-rw-r--r--user/perl-extutils-cppguess/fix.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/user/perl-extutils-cppguess/fix.patch b/user/perl-extutils-cppguess/fix.patch
new file mode 100644
index 000000000..13ddb2203
--- /dev/null
+++ b/user/perl-extutils-cppguess/fix.patch
@@ -0,0 +1,60 @@
+Fix MSVC detection. I don't know why I did this, either.
+
+Ref: #1174
+
+--- ExtUtils-CppGuess-0.27/lib/ExtUtils/CppGuess.pm.old 2023-11-19 13:19:51.000000000 -0600
++++ ExtUtils-CppGuess-0.27/lib/ExtUtils/CppGuess.pm 2024-07-10 11:26:59.221777726 -0500
+@@ -257,6 +257,12 @@
+ compiler_command => 'clang++',
+ extra_lflags => '-lc++',
+ );
++ } elsif ( $self->_cc_is_msvc( $c_compiler ) ) {
++ %guess = (
++ compiler_command => 'cl',
++ extra_cflags => '-TP -EHsc',
++ extra_lflags => 'msvcprt.lib',
++ );
+ } elsif( $self->_cc_is_sunstudio( $c_compiler ) ) {
+ %guess = (
+ compiler_command => 'CC',
+@@ -277,12 +283,6 @@
+ # Don't use -lstdc++ if Perl was linked with -static-libstdc++ (ActivePerl 5.18+ on Windows)
+ $guess{extra_lflags} = '-lstdc++'
+ unless ($self->_config->{ldflags} || '') =~ /static-libstdc\+\+/;
+- } elsif ( $self->_cc_is_msvc( $c_compiler ) ) {
+- %guess = (
+- compiler_command => 'cl',
+- extra_cflags => '-TP -EHsc',
+- extra_lflags => 'msvcprt.lib',
+- );
+ }
+ $guess{$ENV2VAL{$_}} = $ENV{$_} for grep defined $ENV{$_}, keys %ENV2VAL;
+ if (!%guess) {
+@@ -383,8 +383,12 @@
+
+ sub _cc_is_msvc {
+ my( $self, $cc ) = @_;
+- $self->{is_msvc}
+- = ($self->_os =~ /MSWin32/ and File::Basename::basename($cc) =~ /^cl/i);
++ $self->{is_msvc} = undef;
++ if (
++ ($self->_os =~ /MSWin32/ and File::Basename::basename($cc) =~ /^cl/i)
++ ) {
++ $self->{is_msvc} = 1;
++ }
+ return $self->{is_msvc};
+ }
+
+--- ExtUtils-CppGuess-0.27/t/002_icpp.t.old 2023-11-19 13:11:06.000000000 -0600
++++ ExtUtils-CppGuess-0.27/t/002_icpp.t 2024-07-10 11:27:48.506428703 -0500
+@@ -9,8 +9,8 @@
+ [
+ { os => 'MSWin32', cc => 'cl', config => {ccflags => ''} },
+ {
+- is_sunstudio => 0,
+- is_msvc => 1, is_gcc => 0, is_clang => 0,
++ is_sunstudio => undef,
++ is_msvc => 1, is_gcc => undef, is_clang => undef,
+ compiler_command => 'cl -TP -EHsc',
+ linker_flags => 'msvcprt.lib',
+ },