mingwperl-v1.patch

text/plain

Filename: mingwperl-v1.patch
Type: text/plain
Part: 0
Message: Re: Building PL/Perl with ActiveState Perl 5.22 and MSVC

Patch

Format: unified
Series: patch v1
File+
src/pl/plperl/plperl.h 8 0
src/tools/msvc/Mkvcbuild.pm 3 2
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index c4e06d0..aac95f8 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -42,6 +42,14 @@
 #undef vsnprintf
 #endif
 
+/*
+ * ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
+ * __inline__.  Translate to something MSVC recognizes.
+ */
+#ifdef _MSC_VER
+#define __inline__ inline
+#endif
+
 
 /*
  * Get the basic Perl API.  We use PERL_NO_GET_CONTEXT mode so that our code
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 686c736..4c2e12e 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -615,9 +615,10 @@ sub mkvcbuild
 			}
 		}
 		$plperl->AddReference($postgres);
-		my $perl_path = $solution->{options}->{perl} . '\lib\CORE\perl*.lib';
+		my $perl_path = $solution->{options}->{perl} . '\lib\CORE\*perl*';
+		# ActivePerl 5.16 provided perl516.lib; 5.18 provided libperl518.a
 		my @perl_libs =
-		  grep { /perl\d+.lib$/ } glob($perl_path);
+		  grep { /perl\d+\.lib$|libperl\d+\.a$/ } glob($perl_path);
 		if (@perl_libs == 1)
 		{
 			$plperl->AddLibrary($perl_libs[0]);