VirtualBox

source: vbox/trunk/src/libs/openssl-3.3.2/util/mkinstallvars.pl@ 108403

最後變更 在這個檔案從108403是 108206,由 vboxsync 提交於 5 週 前

openssl-3.3.2: Exported all files to OSE and removed .scm-settings ​bugref:10757

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:executable 設為 *
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 5.0 KB
 
1#! /usr/bin/env perl
2# Copyright 2021-2024 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
13use File::Spec;
14use List::Util qw(pairs);
15
16# These are expected to be set up as absolute directories
17my @absolutes = qw(PREFIX libdir);
18# These may be absolute directories, and if not, they are expected to be set up
19# as subdirectories to PREFIX or LIBDIR. The order of the pairs is important,
20# since the LIBDIR subdirectories depend on the calculation of LIBDIR from
21# PREFIX.
22my @subdirs = pairs (PREFIX => [ qw(BINDIR LIBDIR INCLUDEDIR APPLINKDIR) ],
23 LIBDIR => [ qw(ENGINESDIR MODULESDIR PKGCONFIGDIR
24 CMAKECONFIGDIR) ]);
25# For completeness, other expected variables
26my @others = qw(VERSION LDLIBS);
27
28my %all = ( );
29foreach (@absolutes) { $all{$_} = 1 }
30foreach (@subdirs) { foreach (@{$_->[1]}) { $all{$_} = 1 } }
31foreach (@others) { $all{$_} = 1 }
32print STDERR "DEBUG: all keys: ", join(", ", sort keys %all), "\n";
33
34my %keys = ();
35my %values = ();
36foreach (@ARGV) {
37 (my $k, my $v) = m|^([^=]*)=(.*)$|;
38 $keys{$k} = 1;
39 push @{$values{$k}}, $v;
40}
41
42# warn if there are missing values, and also if there are unexpected values
43foreach my $k (sort keys %all) {
44 warn "No value given for $k\n" unless $keys{$k};
45}
46foreach my $k (sort keys %keys) {
47 warn "Unknown variable $k\n" unless $all{$k};
48}
49
50# This shouldn't be needed, but just in case we get relative paths that
51# should be absolute, make sure they actually are.
52foreach my $k (@absolutes) {
53 my $v = $values{$k} || [ '.' ];
54 die "Can't have more than one $k\n" if scalar @$v > 1;
55 print STDERR "DEBUG: $k = $v->[0] => ";
56 $v = [ map { File::Spec->rel2abs($_) } @$v ];
57 $values{$k} = $v;
58 print STDERR "$k = $v->[0]\n";
59}
60
61# Absolute paths for the subdir variables are computed. This provides
62# the usual form of values for names that have become norm, known as GNU
63# installation paths.
64# For the benefit of those that need it, the subdirectories are preserved
65# as they are, using the same variable names, suffixed with '_REL_{var}',
66# if they are indeed subdirectories. The '{var}' part of the name tells
67# which other variable value they are relative to.
68foreach my $pair (@subdirs) {
69 my ($var, $subdir_vars) = @$pair;
70 foreach my $k (@$subdir_vars) {
71 my $kr = "${k}_REL_${var}";
72 my $v2 = $values{$k} || [ '.' ];
73 $values{$k} = []; # We're rebuilding it
74 print STDERR "DEBUG: $k = ",
75 (scalar @$v2 > 1 ? "[ " . join(", ", @$v2) . " ]" : $v2->[0]),
76 " => ";
77 foreach my $v (@$v2) {
78 if (File::Spec->file_name_is_absolute($v)) {
79 push @{$values{$k}}, $v;
80 push @{$values{$kr}},
81 File::Spec->abs2rel($v, $values{$var}->[0]);
82 } else {
83 push @{$values{$kr}}, $v;
84 push @{$values{$k}},
85 File::Spec->rel2abs($v, $values{$var}->[0]);
86 }
87 }
88 print STDERR join(", ",
89 map {
90 my $v = $values{$_};
91 "$_ = " . (scalar @$v > 1
92 ? "[ " . join(", ", @$v) . " ]"
93 : $v->[0]);
94 } ($k, $kr)),
95 "\n";
96 }
97}
98
99print <<_____;
100package OpenSSL::safe::installdata;
101
102use strict;
103use warnings;
104use Exporter;
105our \@ISA = qw(Exporter);
106our \@EXPORT = qw(
107_____
108
109foreach my $k (@absolutes) {
110 print " \@$k\n";
111}
112foreach my $pair (@subdirs) {
113 my ($var, $subdir_vars) = @$pair;
114 foreach my $k (@$subdir_vars) {
115 my $k2 = "${k}_REL_${var}";
116 print " \@$k \@$k2\n";
117 }
118}
119
120print <<_____;
121 \$VERSION \@LDLIBS
122);
123
124_____
125
126foreach my $k (@absolutes) {
127 print "our \@$k" . ' ' x (27 - length($k)) . "= ( '",
128 join("', '", @{$values{$k}}),
129 "' );\n";
130}
131foreach my $pair (@subdirs) {
132 my ($var, $subdir_vars) = @$pair;
133 foreach my $k (@$subdir_vars) {
134 my $k2 = "${k}_REL_${var}";
135 print "our \@$k" . ' ' x (27 - length($k)) . "= ( '",
136 join("', '", @{$values{$k}}),
137 "' );\n";
138 print "our \@$k2" . ' ' x (27 - length($k2)) . "= ( '",
139 join("', '", @{$values{$k2}}),
140 "' );\n";
141 }
142}
143
144print <<_____;
145our \$VERSION = '$values{VERSION}->[0]';
146our \@LDLIBS =
147 # Unix and Windows use space separation, VMS uses comma separation
148 \$^O eq 'VMS'
149 ? split(/ *, */, '$values{LDLIBS}->[0]')
150 : split(/ +/, '$values{LDLIBS}->[0]');
151
1521;
153_____
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette