summaryrefslogtreecommitdiffstats
path: root/debian/ada/libgnat_alihash
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:22:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:22:56 +0000
commit3f472a4e5ca21e3ddb13737473e636b2b11a408a (patch)
tree7db1ab317884b9f6e04b6e13737c1679879cb97a /debian/ada/libgnat_alihash
parentAdding upstream version 13.2.0. (diff)
downloadgcc-13-3f472a4e5ca21e3ddb13737473e636b2b11a408a.tar.xz
gcc-13-3f472a4e5ca21e3ddb13737473e636b2b11a408a.zip
Adding debian version 13.2.0-10.debian/13.2.0-10debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/ada/libgnat_alihash')
-rwxr-xr-xdebian/ada/libgnat_alihash39
1 files changed, 39 insertions, 0 deletions
diff --git a/debian/ada/libgnat_alihash b/debian/ada/libgnat_alihash
new file mode 100755
index 0000000..26b223e
--- /dev/null
+++ b/debian/ada/libgnat_alihash
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+# Helper for debian/rules2.
+
+# Exit silently during builds without Ada.
+
+# If .ali (Ada Library Information) files are found in gnat RTS directory,
+# output a dpkg-gencontrol command line argument setting the
+# libgnat:Provides substitution variable
+# to the XOR of the checksums in all such files,
+# as 8 lowercase hexadecimal digits.
+
+# See https://people.debian.org/~lbrenta/debian-ada-policy.html.
+
+# Should be in sync with dh_ada_library in the dh-ada-library package.
+
+# perl -c $script
+# perltidy $script -st | diff -u $script -
+# perlcritic -1 --verbose=11 --exclude=Modules::RequireVersionVar $script
+
+use autodie;
+use re '/amsx';
+use strict;
+use warnings;
+
+my @ali_files = glob 'build/gcc/ada/rts/*.ali';
+if (@ali_files) {
+ my $result = 0;
+ for my $path (@ali_files) {
+ open my $fh, q{<}, $path;
+ while (<$fh>) {
+ if (m/ ^ D [ ] [^\t]+ \t+ \d{14} [ ] ( [[:xdigit:]]{8} ) /) {
+ $result ^= hex $1;
+ }
+ }
+ close $fh;
+ }
+ printf '-Vlibgnat:alihash=%08x', $result;
+}