blob: 968bfc7a696ce85fe6f5cc8b71d27cd0601203db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
sub get_module_info
{
my ($MODULE, $MOD_DIR) = @_;
my %HASH;
my $mod_dirname = catfile($MOD_DIR,$MODULE);
my $mod_dir = new DirHandle $mod_dirname;
if(!defined $mod_dir)
{ die "(error): Couldn't open dir $mod_dirname ($!)\n"; }
my $mod_info_name = 'modinfo.txt';
my %MODFILES;
my $have_config_file = 0;
while(defined($_ = $mod_dir->read))
{
if($_ eq $mod_info_name) { $have_config_file = 1; }
else { $MODFILES{$_} = undef; }
}
die "(error): Module $MODULE does not seem to have a description file\n"
unless $have_config_file;
my $desc_file = catfile($MOD_DIR,$MODULE,$mod_info_name);
open MODFILE, "<$desc_file" or die
"(error): Couldn't open file $desc_file, ($!)\n";
$HASH{'libs'} = {};
$HASH{'add'} = {};
$HASH{'local_only'} = {};
$HASH{'replace'} = {};
$HASH{'ignore'} = {};
$HASH{'define'} = {};
$HASH{'define_base'} = {};
$HASH{'external_libs'} = 0;
while(<MODFILE>)
{
$HASH{'name'} = $1 if(/^realname \"(.*)\"/);
$HASH{'notes'} = $1 if(/^note \"(.*)\"/);
$HASH{'add'}{$1} = undef if(/^add_file ([\.\w]*)/);
$HASH{'local_only'}{$1} = undef if(/^local_only ([\.\w]*)/);
$HASH{'replace'}{$1} = undef if(/^replace_file ([\.\w]*)/);
$HASH{'ignore'}{$1} = undef if(/^ignore_file ([\.\w]*)/);
$HASH{'define'}{$1} = undef if(/^define (\w*)/);
$HASH{'define_base'}{$1} = undef if(/^define_base (\w*)/);
$HASH{'mp_bits'} = $1 if(/^mp_bits ([0-9]*)/);
$HASH{'external_libs'} = 1 if(/^uses_external_libs/);
if(/^require_version /)
{
if(/^require_version (\d)\.(\d)\.(\d)$/)
{
my $version = "$1.$2.$3";
my $needed_version = 100*$1 + 10*$2 + $3;
my $have_version =
100*$MAJOR_VERSION + 10*$MINOR_VERSION + $PATCH_VERSION;
if($needed_version > $have_version) {
warn "Module $MODULE requires Botan version $version\n";
%HASH = ();
close MODFILE;
return %HASH;
}
}
else
{
warn "In module $MODULE, bad version code in require_version\n";
}
}
# Read in a list of supported CPU types (archs and/or submodels)
if(/^<arch>$/) {
while(1) {
$_ = process($_ = <MODFILE>);
next unless $_;
last if (m@^</arch>$@);
$HASH{'arch'}{$_} = undef;
}
}
# Read in a list of supported OSes
if(/^<os>$/) {
while(1) {
$_ = process($_ = <MODFILE>);
next unless $_;
last if (m@^</os>$@);
$HASH{'os'}{$_} = undef;
}
}
# Read in a set of os->extra library mappings
if(/^<libs>$/) {
while(1) {
$_ = process($_ = <MODFILE>);
next unless $_;
last if (m@^</libs>$@);
m/^([\w!,]*) -> ([\w,-]*)$/;
$HASH{'libs'}{$1} = $2;
}
}
# Read in a list of supported compilers
if(/^<cc>$/) {
while(1) {
$_ = process($_ = <MODFILE>);
next unless $_;
last if (m@^</cc>$@);
$HASH{'cc'}{$_} = undef;
}
}
}
close MODFILE;
return %HASH;
}
|