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