1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Add output directory argument to generate-unicode_norm_table.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.

Author: Andres Freund <andres@anarazel.de>
Author: Peter Eisentraut <peter@eisentraut.org>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
This commit is contained in:
Andres Freund
2022-07-18 12:18:36 -07:00
parent 2bf626b714
commit c8a9246e09

View File

@ -10,20 +10,27 @@
use strict; use strict;
use warnings; use warnings;
use Getopt::Long;
use FindBin; use FindBin;
use lib "$FindBin::RealBin/../../tools/"; use lib "$FindBin::RealBin/../../tools/";
use PerfectHash; use PerfectHash;
my $output_table_file = "unicode_norm_table.h"; my $output_path = '.';
my $output_func_file = "unicode_norm_hashfunc.h";
GetOptions(
'outdir:s' => \$output_path);
my $output_table_file = "$output_path/unicode_norm_table.h";
my $output_func_file = "$output_path/unicode_norm_hashfunc.h";
my $FH; my $FH;
# Read list of codes that should be excluded from re-composition. # Read list of codes that should be excluded from re-composition.
my @composition_exclusion_codes = (); my @composition_exclusion_codes = ();
open($FH, '<', "CompositionExclusions.txt") open($FH, '<', "$output_path/CompositionExclusions.txt")
or die "Could not open CompositionExclusions.txt: $!."; or die "Could not open $output_path/CompositionExclusions.txt: $!.";
while (my $line = <$FH>) while (my $line = <$FH>)
{ {
if ($line =~ /^([[:xdigit:]]+)/) if ($line =~ /^([[:xdigit:]]+)/)
@ -38,8 +45,8 @@ close $FH;
# and character decomposition mapping # and character decomposition mapping
my @characters = (); my @characters = ();
my %character_hash = (); my %character_hash = ();
open($FH, '<', "UnicodeData.txt") open($FH, '<', "$output_path/UnicodeData.txt")
or die "Could not open UnicodeData.txt: $!."; or die "Could not open $output_path/UnicodeData.txt: $!.";
while (my $line = <$FH>) while (my $line = <$FH>)
{ {