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