On Wed, Mar 4, 2015 at 4:13 AM, Michael Paquier wrote:
> Those entries are removed as well in the patch.

Please find attached a new version of the patch, fixing a failure for
plperl installation that contains GNUmakefile instead of Makefile.
-- 
Michael
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index eba9aa0..fd6080f 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -91,7 +91,6 @@ sub Install
 	}
 
 	CopySolutionOutput($conf, $target);
-	lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
 	my $sample_files = [];
 	my @top_dir      = ("src");
 	@top_dir = ("src\\bin", "src\\interfaces") if ($insttype eq "client");
@@ -108,12 +107,8 @@ sub Install
 		$target . '/lib/',
 		"$conf\\",
 		"postgres\\postgres.lib",
-		"libpq\\libpq.lib",
-		"libecpg\\libecpg.lib",
 		"libpgcommon\\libpgcommon.lib",
-		"libpgport\\libpgport.lib",
-		"libpgtypes\\libpgtypes.lib",
-		"libecpg_compat\\libecpg_compat.lib");
+		"libpgport\\libpgport.lib");
 	CopyContribFiles($config, $target);
 	CopyIncludeFiles($target);
 
@@ -236,8 +231,9 @@ sub CopySolutionOutput
 	while ($sln =~ $rem)
 	{
 		my $pf = $1;
-		my $dir;
+		my @dirs;
 		my $ext;
+		my $is_sharedlib = 0;
 
 		$sln =~ s/$rem//;
 
@@ -247,17 +243,42 @@ sub CopySolutionOutput
 
 		my $proj = read_file("$pf.$vcproj")
 		  || croak "Could not open $pf.$vcproj\n";
+
+		# Check if this project uses a shared library by looking if
+		# SO_MAJOR_VERSION is defined in its Makefile, whose path
+		# can be found using the resource file of this project.
+		if (($vcproj eq 'vcxproj' &&
+			 $proj =~ qr{ResourceCompile\s*Include="([^"]+)"}) ||
+			($vcproj eq 'vcproj' &&
+			 $proj =~ qr{File\s*RelativePath="([^\"]+)\.rc"}))
+		{
+			my $projpath = dirname($1);
+			my $mfname = -e "$projpath/GNUmakefile" ?
+				"$projpath/GNUmakefile" : "$projpath/Makefile";
+			my $mf = read_file($mfname) ||
+				croak "Could not open $mfname\n";
+
+			if ($mf =~ /^SO_MAJOR_VERSION\s*=\s*(.*)$/mg)
+			{
+				$is_sharedlib = 1;
+			}
+		}
+
 		if ($vcproj eq 'vcproj' && $proj =~ qr{ConfigurationType="([^"]+)"})
 		{
 			if ($1 == 1)
 			{
-				$dir = "bin";
+				@dirs = qw(bin);
 				$ext = "exe";
 			}
 			elsif ($1 == 2)
 			{
-				$dir = "lib";
+				@dirs = qw(lib);
 				$ext = "dll";
+				if ($is_sharedlib)
+				{
+					push(@dirs, 'bin');
+				}
 			}
 			else
 			{
@@ -271,13 +292,17 @@ sub CopySolutionOutput
 		{
 			if ($1 eq 'Application')
 			{
-				$dir = "bin";
+				@dirs = qw(bin);
 				$ext = "exe";
 			}
 			elsif ($1 eq 'DynamicLibrary')
 			{
-				$dir = "lib";
+				@dirs = qw(lib);
 				$ext = "dll";
+				if ($is_sharedlib)
+				{
+					push(@dirs, 'bin');
+				}
 			}
 			else    # 'StaticLibrary'
 			{
@@ -290,8 +315,11 @@ sub CopySolutionOutput
 		{
 			croak "Could not parse $pf.$vcproj\n";
 		}
-		lcopy("$conf\\$pf\\$pf.$ext", "$target\\$dir\\$pf.$ext")
-		  || croak "Could not copy $pf.$ext\n";
+		foreach my $dir (@dirs)
+		{
+			lcopy("$conf\\$pf\\$pf.$ext", "$target\\$dir\\$pf.$ext")
+				|| croak "Could not copy $pf.$ext\n";
+		}
 		lcopy("$conf\\$pf\\$pf.pdb", "$target\\symbols\\$pf.pdb")
 		  || croak "Could not copy $pf.pdb\n";
 		print ".";
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to