mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Add output directory option to gen_node_support.pl
This is in preparation for building postgres with meson / ninja. When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
This commit is contained in:
parent
c8a9246e09
commit
adba4b7471
@ -19,12 +19,19 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
use Getopt::Long;
|
||||||
|
|
||||||
use FindBin;
|
use FindBin;
|
||||||
use lib "$FindBin::RealBin/../catalog";
|
use lib "$FindBin::RealBin/../catalog";
|
||||||
|
|
||||||
use Catalog; # for RenameTempFile
|
use Catalog; # for RenameTempFile
|
||||||
|
|
||||||
|
my $output_path = '.';
|
||||||
|
|
||||||
|
GetOptions(
|
||||||
|
'outdir:s' => \$output_path)
|
||||||
|
or die "$0: wrong arguments";
|
||||||
|
|
||||||
|
|
||||||
# Test whether first argument is element of the list in the second
|
# Test whether first argument is element of the list in the second
|
||||||
# argument
|
# argument
|
||||||
@ -576,7 +583,7 @@ my $header_comment =
|
|||||||
# nodetags.h
|
# nodetags.h
|
||||||
|
|
||||||
push @output_files, 'nodetags.h';
|
push @output_files, 'nodetags.h';
|
||||||
open my $nt, '>', 'nodetags.h' . $tmpext or die $!;
|
open my $nt, '>', "$output_path/nodetags.h$tmpext" or die "$output_path/nodetags.h$tmpext: $!";
|
||||||
|
|
||||||
printf $nt $header_comment, 'nodetags.h';
|
printf $nt $header_comment, 'nodetags.h';
|
||||||
|
|
||||||
@ -620,13 +627,13 @@ foreach my $infile (sort @ARGV)
|
|||||||
# copyfuncs.c, equalfuncs.c
|
# copyfuncs.c, equalfuncs.c
|
||||||
|
|
||||||
push @output_files, 'copyfuncs.funcs.c';
|
push @output_files, 'copyfuncs.funcs.c';
|
||||||
open my $cff, '>', 'copyfuncs.funcs.c' . $tmpext or die $!;
|
open my $cff, '>', "$output_path/copyfuncs.funcs.c$tmpext" or die $!;
|
||||||
push @output_files, 'equalfuncs.funcs.c';
|
push @output_files, 'equalfuncs.funcs.c';
|
||||||
open my $eff, '>', 'equalfuncs.funcs.c' . $tmpext or die $!;
|
open my $eff, '>', "$output_path/equalfuncs.funcs.c$tmpext" or die $!;
|
||||||
push @output_files, 'copyfuncs.switch.c';
|
push @output_files, 'copyfuncs.switch.c';
|
||||||
open my $cfs, '>', 'copyfuncs.switch.c' . $tmpext or die $!;
|
open my $cfs, '>', "$output_path/copyfuncs.switch.c$tmpext" or die $!;
|
||||||
push @output_files, 'equalfuncs.switch.c';
|
push @output_files, 'equalfuncs.switch.c';
|
||||||
open my $efs, '>', 'equalfuncs.switch.c' . $tmpext or die $!;
|
open my $efs, '>', "$output_path/equalfuncs.switch.c$tmpext" or die $!;
|
||||||
|
|
||||||
printf $cff $header_comment, 'copyfuncs.funcs.c';
|
printf $cff $header_comment, 'copyfuncs.funcs.c';
|
||||||
printf $eff $header_comment, 'equalfuncs.funcs.c';
|
printf $eff $header_comment, 'equalfuncs.funcs.c';
|
||||||
@ -819,13 +826,13 @@ close $efs;
|
|||||||
# outfuncs.c, readfuncs.c
|
# outfuncs.c, readfuncs.c
|
||||||
|
|
||||||
push @output_files, 'outfuncs.funcs.c';
|
push @output_files, 'outfuncs.funcs.c';
|
||||||
open my $off, '>', 'outfuncs.funcs.c' . $tmpext or die $!;
|
open my $off, '>', "$output_path/outfuncs.funcs.c$tmpext" or die $!;
|
||||||
push @output_files, 'readfuncs.funcs.c';
|
push @output_files, 'readfuncs.funcs.c';
|
||||||
open my $rff, '>', 'readfuncs.funcs.c' . $tmpext or die $!;
|
open my $rff, '>', "$output_path/readfuncs.funcs.c$tmpext" or die $!;
|
||||||
push @output_files, 'outfuncs.switch.c';
|
push @output_files, 'outfuncs.switch.c';
|
||||||
open my $ofs, '>', 'outfuncs.switch.c' . $tmpext or die $!;
|
open my $ofs, '>', "$output_path/outfuncs.switch.c$tmpext" or die $!;
|
||||||
push @output_files, 'readfuncs.switch.c';
|
push @output_files, 'readfuncs.switch.c';
|
||||||
open my $rfs, '>', 'readfuncs.switch.c' . $tmpext or die $!;
|
open my $rfs, '>', "$output_path/readfuncs.switch.c$tmpext" or die $!;
|
||||||
|
|
||||||
printf $off $header_comment, 'outfuncs.funcs.c';
|
printf $off $header_comment, 'outfuncs.funcs.c';
|
||||||
printf $rff $header_comment, 'readfuncs.funcs.c';
|
printf $rff $header_comment, 'readfuncs.funcs.c';
|
||||||
@ -1130,7 +1137,7 @@ close $rfs;
|
|||||||
# now rename the temporary files to their final names
|
# now rename the temporary files to their final names
|
||||||
foreach my $file (@output_files)
|
foreach my $file (@output_files)
|
||||||
{
|
{
|
||||||
Catalog::RenameTempFile($file, $tmpext);
|
Catalog::RenameTempFile("$output_path/$file", $tmpext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1144,7 +1151,7 @@ END
|
|||||||
{
|
{
|
||||||
foreach my $file (@output_files)
|
foreach my $file (@output_files)
|
||||||
{
|
{
|
||||||
unlink($file . $tmpext);
|
unlink("$output_path/$file$tmpext");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,15 +865,12 @@ EOF
|
|||||||
utils/rel.h
|
utils/rel.h
|
||||||
);
|
);
|
||||||
|
|
||||||
chdir('src/backend/nodes');
|
my @node_files = map { "src/include/$_" } @node_headers;
|
||||||
|
|
||||||
my @node_files = map { "../../../src/include/$_" } @node_headers;
|
system("perl src/backend/nodes/gen_node_support.pl --outdir src/backend/nodes @node_files");
|
||||||
|
open(my $f, '>', 'src/backend/nodes/node-support-stamp')
|
||||||
system("perl gen_node_support.pl @node_files");
|
|
||||||
open(my $f, '>', 'node-support-stamp')
|
|
||||||
|| confess "Could not touch node-support-stamp";
|
|| confess "Could not touch node-support-stamp";
|
||||||
close($f);
|
close($f);
|
||||||
chdir('../../..');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsNewer(
|
if (IsNewer(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user