2 # Copyright (c) 2024-2025, PostgreSQL Global Development Group
5 use warnings FATAL
=> 'all';
14 'format:s' => \
$format,
15 'libname:s' => \
$libname,
17 'output:s' => \
$output) or die "wrong arguments";
19 if (not( $format eq 'darwin'
23 die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
26 open(my $input_handle, '<', $input)
27 or die "$0: could not open input file '$input': $!\n";
29 open(my $output_handle, '>', $output)
30 or die "$0: could not open output file '$output': $!\n";
35 print $output_handle "{
39 elsif ($format eq 'win')
41 # XXX: Looks like specifying LIBRARY $libname is optional, which makes it
42 # easier to build a generic command for generating export files...
45 print $output_handle "LIBRARY $libname\n";
47 print $output_handle "EXPORTS\n";
50 while (<$input_handle>)
54 # don't do anything with a comment
56 elsif (/^(\S+)\s+(\S+)/)
58 if ($format eq 'darwin')
60 print $output_handle "_$1\n";
62 elsif ($format eq 'gnu')
64 print $output_handle " $1;\n";
66 elsif ($format eq 'win')
68 print $output_handle "$1 @ $2\n";
73 die "$0: unexpected line $_\n";
79 print $output_handle " local: *;