diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 07:24:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 07:24:22 +0000 |
commit | 45d6379135504814ab723b57f0eb8be23393a51d (patch) | |
tree | d4f2ec4acca824a8446387a758b0ce4238a4dffa /util | |
parent | Initial commit. (diff) | |
download | bind9-45d6379135504814ab723b57f0eb8be23393a51d.tar.xz bind9-45d6379135504814ab723b57f0eb8be23393a51d.zip |
Adding upstream version 1:9.16.44.upstream/1%9.16.44
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/bindkeys.pl | 49 | ||||
-rw-r--r-- | util/check-make-install.in | 62 | ||||
-rwxr-xr-x | util/mksymtbl.pl | 99 |
3 files changed, 210 insertions, 0 deletions
diff --git a/util/bindkeys.pl b/util/bindkeys.pl new file mode 100755 index 0000000..085b6be --- /dev/null +++ b/util/bindkeys.pl @@ -0,0 +1,49 @@ +#!/usr/bin/env perl + +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +use strict; +use warnings; + +my $lines; +while (<>) { + chomp; + if (/\/\* .Id:.* \*\//) { + next; + } + s/\"/\\\"/g; + s/$/\\n\\/; + $lines .= $_ . "\n"; +} + +my $mkey = "#define TRUST_ANCHORS \\\n\t\"\\\n" . $lines . "\"\n"; + +print <<END; +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +END + +print "#ifndef BIND_KEYS_H\n"; +print "#define BIND_KEYS_H 1\n"; +print $mkey; +print "#endif /* BIND_KEYS_H */\n"; diff --git a/util/check-make-install.in b/util/check-make-install.in new file mode 100644 index 0000000..94ab48c --- /dev/null +++ b/util/check-make-install.in @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +abs_top_srcdir=@abs_top_srcdir@ +abs_builddir=@abs_builddir@ +prefix=@prefix@ +includedir=@includedir@ +install_dir="${DESTDIR}@prefix@" + +headers_to_install() { + find "${abs_top_srcdir}/lib" -name "*.h" -or -name "*.h.in" | + grep -v -F /win32/ | + sed -n \ + -e "s|\.h\.in$|\.h|" \ + -e "s|.*include/|${DESTDIR}${includedir}/|p" | + sort -u +} + +status=0 + +for header in $(headers_to_install); do + if [ ! -f "${header}" ]; then + echo "Missing $header" + status=1 + fi +done + +named_binary_path="${install_dir}/sbin/named" +if [ ! -x "${named_binary_path}" ]; then + echo "ERROR: ${named_binary_path} does not exist or is not executable" + status=1 +fi + +named_man_page_path="${install_dir}/share/man/man8/named.8" +if [ ! -f "${named_man_page_path}" ]; then + echo "ERROR: ${named_man_page_path} does not exist" + status=1 +fi + +if [ -n "${DESTDIR}" ]; then + for expected_subdir in bin etc include lib sbin share; do + echo "${install_dir}/${expected_subdir}" >> "${abs_builddir}/expected_dirs" + done + find "${install_dir}" -maxdepth 1 -mindepth 1 -type d | sort > "${abs_builddir}/existing_dirs" + if ! diff -u "${abs_builddir}/expected_dirs" "${abs_builddir}/existing_dirs"; then + echo "ERROR: Contents of DESTDIR do not match expectations" + status=1 + fi + rm -f "${abs_builddir}/expected_dirs" "${abs_builddir}/existing_dirs" +fi + +exit $status diff --git a/util/mksymtbl.pl b/util/mksymtbl.pl new file mode 100755 index 0000000..8747a2f --- /dev/null +++ b/util/mksymtbl.pl @@ -0,0 +1,99 @@ +#!/usr/bin/env perl + +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +use strict; +use diagnostics; +$^W = 1; + +my $rev = '$Id$'; +$rev =~ s/\$//g; +$rev =~ s/,v//g; +$rev =~ s/Id: //; + +use Getopt::Std; +my %options; +getopts('i:o:', \%options); + +my ($binname, $need_uscorefix, $outputfile, $nsyms, $ostype, $nm_prog); +my %symmap; + +$binname = $ARGV[0]; +$need_uscorefix = 0; +if ($options{'o'}) { + $outputfile = $options{'o'}; +} else { + $outputfile = "symtbl.c"; +} + +# OS-depending configuration +$nm_prog = "nm"; +$ostype = `uname -s`; +chop($ostype); + +if ($options{'i'}) { + open(SYMBOLS, $options{'i'}) || die "failed to open $options{'i'}"; +} else { + open(SYMBOLS, "$nm_prog $binname |") || + die "failed to invoke utility to get symbols"; +} +open(TBLFILE, ">$outputfile") || die "failed to open output file: $outputfile"; + +$nsyms = 0; +while (<SYMBOLS>) { + my ($addr, $symbol) = (0, ""); + # *BSDs, Linux, etc. + if (/([0-9a-f]*)\s[tT]\s(.*)/) { + ($addr, $symbol) = ($1, $2); + # heuristics: some compilers add a "_" to all program + # defined symbols. Detect and fix it for a well known + # symbol of "main". + $need_uscorefix = 1 if ($symbol eq "_main"); + } + if ($symbol ne "") { + next if ($symmap{$addr}); + + $symmap{$addr} = $symbol; + $nsyms++; + } +} + +sub lhex { + my $la = substr($a, -8); + my $lb = substr($b, -8); + my $ha = substr($a, 0, length($a) - length($la)); + my $hb = substr($b, 0, length($b) - length($lb)); + $ha = "0" if ($ha eq ""); + $ha = "0" if ($hb eq ""); + if (hex($ha) != hex($hb)) { + $la = $ha; + $lb = $hb; + } + hex($la) <=> hex($lb) +} + +print TBLFILE "/*\n * Generated by $rev \n */\n"; +print TBLFILE "#include <isc/backtrace.h>\n"; +print TBLFILE "const int isc__backtrace_nsymbols = $nsyms;\n"; +print TBLFILE "const isc_backtrace_symmap_t isc__backtrace_symtable[] = {\n"; +foreach (sort lhex keys(%symmap)) { + my ($addr, $symbol) = ($_, $symmap{$_}); + if ($need_uscorefix && $symbol =~ /^_(.*)/) { + $symbol = $1; + } + print TBLFILE "\t{ (void *)0x$addr, \"$symbol\" },\n"; +} +print TBLFILE "\t{ (void *)0x0, \"\" },\n"; +print TBLFILE "};\n"; + +close(TBLFILE); +close(SYMBOLS); |