Debian Codegraph @

debian/rust-vendor/openssl-src/openssl/util/mkbuildinf.pl

raw
1 #! /usr/bin/env perl
2 # Copyright 2014-2025 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9 use strict;
10 use warnings;
11
12 my $platform = pop @ARGV;
13 my $cflags = join(' ', @ARGV);
14 $cflags =~ s(\\)(\\\\)g;
15 $cflags = "compiler: $cflags";
16
17 # Use the value of the envvar SOURCE_DATE_EPOCH, even if it's
18 # zero or the empty string.
19 my $date = gmtime($ENV{'SOURCE_DATE_EPOCH'} // time()) . " UTC";
20
21 print <<"END_OUTPUT";
22 /*
23 * WARNING: do not edit!
24 * Generated by util/mkbuildinf.pl
25 *
26 * Copyright 2014-2025 The OpenSSL Project Authors. All Rights Reserved.
27 *
28 * Licensed under the Apache License 2.0 (the "License"). You may not use
29 * this file except in compliance with the License. You can obtain a copy
30 * in the file LICENSE in the source distribution or at
31 * https://www.openssl.org/source/license.html
32 */
33
34 #define PLATFORM "platform: $platform"
35 #define DATE "built on: $date"
36
37 /*
38 * Generate compiler_flags as an array of individual characters. This is a
39 * workaround for the situation where CFLAGS gets too long for a C90 string
40 * literal
41 */
42 static const char compiler_flags[] = {
43 END_OUTPUT
44
45 my $ctr = 0;
46 foreach my $c (split //, $cflags) {
47 $c =~ s|([\\'])|\\$1|;
48 # Max 16 characters per line
49 if (($ctr++ % 16) == 0) {
50 if ($ctr != 1) {
51 print "\n";
52 }
53 print " ";
54 }
55 print "'$c',";
56 }
57 print <<"END_OUTPUT";
58 '\\0'
59 };
60 END_OUTPUT