Skip to content

Commit 85f7b03

Browse files
committed
meson: prereq: Add -o option to gen_node_support.pl
1 parent 18df2e9 commit 85f7b03

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/backend/nodes/gen_node_support.pl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use strict;
1919
use warnings;
20+
use Getopt::Long;
2021

2122
use File::Basename;
2223

@@ -25,6 +26,11 @@
2526

2627
use Catalog; # for RenameTempFile
2728

29+
my $output_path = '.';
30+
31+
GetOptions(
32+
'output:s' => \$output_path);
33+
2834

2935
# Test whether first argument is element of the list in the second
3036
# argument
@@ -453,7 +459,7 @@ sub elem
453459
# nodetags.h
454460

455461
push @output_files, 'nodetags.h';
456-
open my $nt, '>', 'nodetags.h' . $tmpext or die $!;
462+
open my $nt, '>', "$output_path/nodetags.h" . $tmpext or die "$output_path/nodetags.h: $!";
457463

458464
printf $nt $header_comment, 'nodetags.h';
459465

@@ -480,13 +486,13 @@ sub elem
480486
# copyfuncs.c, equalfuncs.c
481487

482488
push @output_files, 'copyfuncs.funcs.c';
483-
open my $cff, '>', 'copyfuncs.funcs.c' . $tmpext or die $!;
489+
open my $cff, '>', "$output_path/copyfuncs.funcs.c" . $tmpext or die $!;
484490
push @output_files, 'equalfuncs.funcs.c';
485-
open my $eff, '>', 'equalfuncs.funcs.c' . $tmpext or die $!;
491+
open my $eff, '>', "$output_path/equalfuncs.funcs.c" . $tmpext or die $!;
486492
push @output_files, 'copyfuncs.switch.c';
487-
open my $cfs, '>', 'copyfuncs.switch.c' . $tmpext or die $!;
493+
open my $cfs, '>', "$output_path/copyfuncs.switch.c" . $tmpext or die $!;
488494
push @output_files, 'equalfuncs.switch.c';
489-
open my $efs, '>', 'equalfuncs.switch.c' . $tmpext or die $!;
495+
open my $efs, '>', "$output_path/equalfuncs.switch.c" . $tmpext or die $!;
490496

491497
printf $cff $header_comment, 'copyfuncs.funcs.c';
492498
printf $eff $header_comment, 'equalfuncs.funcs.c';
@@ -672,13 +678,13 @@ sub elem
672678
# outfuncs.c, readfuncs.c
673679

674680
push @output_files, 'outfuncs.funcs.c';
675-
open my $off, '>', 'outfuncs.funcs.c' . $tmpext or die $!;
681+
open my $off, '>', "$output_path/outfuncs.funcs.c" . $tmpext or die $!;
676682
push @output_files, 'readfuncs.funcs.c';
677-
open my $rff, '>', 'readfuncs.funcs.c' . $tmpext or die $!;
683+
open my $rff, '>', "$output_path/readfuncs.funcs.c" . $tmpext or die $!;
678684
push @output_files, 'outfuncs.switch.c';
679-
open my $ofs, '>', 'outfuncs.switch.c' . $tmpext or die $!;
685+
open my $ofs, '>', "$output_path/outfuncs.switch.c" . $tmpext or die $!;
680686
push @output_files, 'readfuncs.switch.c';
681-
open my $rfs, '>', 'readfuncs.switch.c' . $tmpext or die $!;
687+
open my $rfs, '>', "$output_path/readfuncs.switch.c" . $tmpext or die $!;
682688

683689
printf $off $header_comment, 'outfuncs.funcs.c';
684690
printf $rff $header_comment, 'readfuncs.funcs.c';
@@ -976,7 +982,7 @@ sub elem
976982
# now rename the temporary files to their final names
977983
foreach my $file (@output_files)
978984
{
979-
Catalog::RenameTempFile($file, $tmpext);
985+
Catalog::RenameTempFile("$output_path/$file", $tmpext);
980986
}
981987

982988

0 commit comments

Comments
 (0)