]> git.ipfire.org Git - thirdparty/openssl.git/blob - util/mkinstallvars.pl
Clean up exporters, specifically those we have for pkg-config
[thirdparty/openssl.git] / util / mkinstallvars.pl
1 #! /usr/bin/env perl
2 # Copyright 2021 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 # All variables are supposed to come from Makefile, in environment variable
10 # form, or passed as variable assignments on the command line.
11 # The result is a Perl module creating the package OpenSSL::safe::installdata.
12
13 use File::Spec;
14
15 # These are expected to be set up as absolute directories
16 my @absolutes = qw(PREFIX);
17 # These may be absolute directories, and if not, they are expected to be set up
18 # as subdirectories to PREFIX
19 my @subdirs = qw(BINDIR LIBDIR INCLUDEDIR ENGINESDIR MODULESDIR APPLINKDIR);
20
21 my %keys = ();
22 foreach (@ARGV) {
23 (my $k, my $v) = m|^([^=]*)=(.*)$|;
24 $keys{$k} = 1;
25 $ENV{$k} = $v;
26 }
27 foreach my $k (sort keys %keys) {
28 my $v = $ENV{$k};
29 $v = File::Spec->rel2abs($v) if $v && grep { $k eq $_ } @absolutes;
30 $ENV{$k} = $v;
31 }
32 foreach my $k (sort keys %keys) {
33 my $v = $ENV{$k} || '.';
34 $v = File::Spec->rel2abs($v, $ENV{PREFIX})
35 if ($v && !File::Spec->file_name_is_absolute($v)
36 && grep { $k eq $_ } @subdirs);
37 $ENV{$k} = $v;
38 }
39
40 print <<_____;
41 package OpenSSL::safe::installdata;
42
43 use strict;
44 use warnings;
45 use Exporter;
46 our \@ISA = qw(Exporter);
47 our \@EXPORT = qw(\$PREFIX \$BINDIR \$LIBDIR \$INCLUDEDIR \$APPLINKDIR
48 \$ENGINESDIR \$MODULESDIR \$VERSION \$LDLIBS);
49
50 our \$PREFIX = '$ENV{PREFIX}';
51 our \$BINDIR = '$ENV{BINDIR}';
52 our \$LIBDIR = '$ENV{LIBDIR}';
53 our \$INCLUDEDIR = '$ENV{INCLUDEDIR}';
54 our \$ENGINESDIR = '$ENV{ENGINESDIR}';
55 our \$MODULESDIR = '$ENV{MODULESDIR}';
56 our \$APPLINKDIR = '$ENV{APPLINKDIR}';
57 our \$VERSION = '$ENV{VERSION}';
58 our \@LDLIBS =
59 # Unix and Windows use space separation, VMS uses comma separation
60 split(/ +| *, */, '$ENV{LDLIBS}');
61
62 1;
63 _____