Skip to content

Commit 5e37b4c

Browse files
committed
Install contrib sql and readme files
1 parent ecfb932 commit 5e37b4c

File tree

1 file changed

+82
-2
lines changed

1 file changed

+82
-2
lines changed

src/tools/msvc/Install.pm

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package Install;
2+
23
#
34
# Package that provides 'make install' functionality for msvc builds
45
#
5-
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.2 2007/03/17 14:01:01 mha Exp $
6+
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.3 2007/03/24 15:28:48 mha Exp $
67
#
78
use strict;
89
use warnings;
@@ -34,7 +35,8 @@ sub Install
3435
die "Could not find debug or release binaries" if ($conf eq "");
3536
print "Installing for $conf\n";
3637

37-
EnsureDirectories($target, 'bin','lib','share','share/timezonesets');
38+
EnsureDirectories($target, 'bin','lib','share','share/timezonesets','share/contrib','doc',
39+
'doc/contrib');
3840

3941
CopySolutionOutput($conf, $target);
4042
copy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
@@ -54,6 +56,7 @@ sub Install
5456
);
5557
GenerateConversionScript($target);
5658
GenerateTimezoneFiles($target,$conf);
59+
CopyContribFiles($target);
5760
}
5861

5962
sub EnsureDirectories
@@ -194,6 +197,83 @@ sub GenerateTimezoneFiles
194197
print "\n";
195198
}
196199

200+
sub CopyContribFiles
201+
{
202+
my $target = shift;
203+
204+
print "Copying contrib data files...";
205+
my $D;
206+
opendir($D, 'contrib') || croak "Could not opendir on contrib!\n";
207+
while (my $d = readdir($D))
208+
{
209+
next if ($d =~ /^\./);
210+
next unless (-f "contrib/$d/Makefile");
211+
212+
my $mf = read_file("contrib/$d/Makefile");
213+
$mf =~ s{\\s*[\r\n]+}{}mg;
214+
my $flist = '';
215+
if ($mf =~ /^DATA_built\s*=\s*(.*)$/m) {$flist .= $1}
216+
if ($mf =~ /^DATA\s*=\s*(.*)$/m) {$flist .= " $1"}
217+
$flist =~ s/^\s*//; # Remove leading spaces if we had only DATA_built
218+
219+
if ($flist ne '')
220+
{
221+
$flist = ParseAndCleanRule($flist, $mf);
222+
223+
# Special case for contrib/spi
224+
$flist = "autoinc.sql insert_username.sql moddatetime.sql refint.sql timetravel.sql"
225+
if ($d eq 'spi');
226+
foreach my $f (split /\s+/,$flist)
227+
{
228+
copy('contrib/' . $d . '/' . $f,$target . '/share/contrib/' . basename($f))
229+
|| croak("Could not copy file $f in contrib $d");
230+
print '.';
231+
}
232+
}
233+
234+
$flist = '';
235+
if ($mf =~ /^DOCS\s*=\s*(.*)$/mg) {$flist .= $1}
236+
if ($flist ne '')
237+
{
238+
$flist = ParseAndCleanRule($flist, $mf);
239+
240+
# Special case for contrib/spi
241+
$flist =
242+
"README.spi autoinc.example insert_username.example moddatetime.example refint.example timetravel.example"
243+
if ($d eq 'spi');
244+
foreach my $f (split /\s+/,$flist)
245+
{
246+
copy('contrib/' . $d . '/' . $f, $target . '/doc/contrib/' . $f)
247+
|| croak("Coud not copy file $f in contrib $d");
248+
print '.';
249+
}
250+
}
251+
}
252+
closedir($D);
253+
print "\n";
254+
}
255+
256+
sub ParseAndCleanRule
257+
{
258+
my $flist = shift;
259+
my $mf = shift;
260+
261+
# Strip out $(addsuffix) rules
262+
if (index($flist, '$(addsuffix ') >= 0)
263+
{
264+
my $pcount = 0;
265+
my $i;
266+
for ($i = index($flist, '$(addsuffix ') + 12; $i < length($flist); $i++)
267+
{
268+
$pcount++ if (substr($flist, $i, 1) eq '(');
269+
$pcount-- if (substr($flist, $i, 1) eq ')');
270+
last if ($pcount < 0);
271+
}
272+
$flist = substr($flist, 0, index($flist, '$(addsuffix ')) . substr($flist, $i+1);
273+
}
274+
return $flist;
275+
}
276+
197277
sub read_file
198278
{
199279
my $filename = shift;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy