aboutsummaryrefslogtreecommitdiff
path: root/src/common/unicode/generate-unicode_version.pl
blob: 6c3b7243c6cbe109cbbe6367b187b23d5ef89d03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl
#
# Generate header file with Unicode version used by Postgres.
#
# Output: unicode_version.h
#
# Copyright (c) 2000-2025, PostgreSQL Global Development Group

use strict;
use warnings FATAL => 'all';
use Getopt::Long;

use FindBin;
use lib "$FindBin::RealBin/../../tools/";

my $output_path = '.';
my $version_str = undef;

GetOptions('outdir:s' => \$output_path, 'version:s' => \$version_str);

my @version_parts = split /\./, $version_str;

my $unicode_version_str = sprintf "%d.%d", $version_parts[0],
  $version_parts[1];

my $output_file = "$output_path/unicode_version.h";

# Start writing out the output files
open my $OT, '>', $output_file
  or die "Could not open output file $output_file: $!\n";

print $OT <<HEADER;
/*-------------------------------------------------------------------------
 *
 * unicode_version.h
 *	  Unicode version used by Postgres.
 *
 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/common/unicode_version.h
 *
 *-------------------------------------------------------------------------
 */

#define PG_UNICODE_VERSION		"$unicode_version_str"
HEADER