The code in util/bindkeys.pl was overly complicated and it could not be
reused on Windows because redirecting stdin and stdout at the same time
from perl is overly complicated.
Now the util/bindkeys.pl accepts the input file as the first and only
argument and prints the header file to stdout. This allows the same
utility to be used from automake and win32/Configure script.
CLEANFILES = bind.keys.h
bind.keys.h: bind.keys Makefile
- ${PERL} ${top_srcdir}/util/bindkeys.pl < ${top_srcdir}/bind.keys > $@
+ ${PERL} ${top_srcdir}/util/bindkeys.pl ${top_srcdir}/bind.keys > $@
dist_sysconf_DATA = bind.keys
use strict;
use warnings;
-my $lines;
-while (<>) {
+print "#pragma once\n";
+print "#define TRUST_ANCHORS \"\\\n";
+
+my $fn = shift or die "Usage: $0 FILENAME\n";
+open(my $fh, '<', $fn) or die "cannot open file $ARGV[1]\n";
+while (<$fh>) {
chomp;
- if (/\/\* .Id:.* \*\//) {
- next;
- }
s/\"/\\\"/g;
- s/$/\\n\\/;
- $lines .= $_ . "\n";
+ print $_ . "\\n\\\n";
}
-
-my $mkey = "#define TRUST_ANCHORS \\\n\t\"\\\n" . $lines . "\"\n";
-
-print "#ifndef BIND_KEYS_H\n";
-print "#define BIND_KEYS_H 1\n";
-print $mkey;
-print "#endif /* BIND_KEYS_H */\n";
+close($fh);
+print "\"\n";
close F;
}
+# Make bind.keys.h
+# Keep this in sync with util/bindkeys.pl
+
+sub makebindkeysh {
+ my $bindkeysh = `perl.exe ..\\util\\bindkeys.pl ..\\bind.keys`;
+ die "Failed to generate bind.keys.h!\n" unless (length($bindkeysh));
+
+ open(my $fout, ">" . "..\\bind.keys.h") || die $!;
+ print $fout $bindkeysh;
+ close($fout);
+}
+
# Build install files
sub makeinstallfile {
makeinstallfile();
+ makebindkeysh();
+
print "Configured.\n";
} else {
print "add win32 or x64 to commit configuration to build files\n";