mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-23 18:04:10 -05:00
Update how we build bind.keys.h (both POSIX and Windows)
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.
This commit is contained in:
parent
4c8765e31d
commit
bbd54bdfa9
3 changed files with 24 additions and 15 deletions
|
|
@ -6,7 +6,7 @@ BUILT_SOURCES = bind.keys.h
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -12,20 +12,15 @@
|
|||
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";
|
||||
|
|
|
|||
|
|
@ -2405,6 +2405,18 @@ sub setupproject {
|
|||
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 {
|
||||
|
|
@ -2614,6 +2626,8 @@ if (($want_win32 eq "yes") || ($want_x64 eq "yes")) {
|
|||
|
||||
makeinstallfile();
|
||||
|
||||
makebindkeysh();
|
||||
|
||||
print "Configured.\n";
|
||||
} else {
|
||||
print "add win32 or x64 to commit configuration to build files\n";
|
||||
|
|
|
|||
Loading…
Reference in a new issue