summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/util/mkdef.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/util/mkdef.pl')
-rw-r--r--src/lib/libcrypto/util/mkdef.pl46
1 files changed, 34 insertions, 12 deletions
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl
index ecba93cd94..adfd447dd3 100644
--- a/src/lib/libcrypto/util/mkdef.pl
+++ b/src/lib/libcrypto/util/mkdef.pl
@@ -58,6 +58,7 @@ my $debug=0;
58 58
59my $crypto_num= "util/libeay.num"; 59my $crypto_num= "util/libeay.num";
60my $ssl_num= "util/ssleay.num"; 60my $ssl_num= "util/ssleay.num";
61my $libname;
61 62
62my $do_update = 0; 63my $do_update = 0;
63my $do_rewrite = 1; 64my $do_rewrite = 1;
@@ -73,12 +74,13 @@ my $VMS=0;
73my $W32=0; 74my $W32=0;
74my $W16=0; 75my $W16=0;
75my $NT=0; 76my $NT=0;
77my $OS2=0;
76# Set this to make typesafe STACK definitions appear in DEF 78# Set this to make typesafe STACK definitions appear in DEF
77my $safe_stack_def = 0; 79my $safe_stack_def = 0;
78 80
79my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", 81my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT",
80 "EXPORT_VAR_AS_FUNCTION" ); 82 "EXPORT_VAR_AS_FUNCTION" );
81my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT" ); 83my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
82my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", 84my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
83 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", 85 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
84 "RIPEMD", 86 "RIPEMD",
@@ -126,11 +128,18 @@ foreach (@ARGV, split(/ /, $options))
126 $VMSAlpha=1; 128 $VMSAlpha=1;
127 } 129 }
128 $VMS=1 if $_ eq "VMS"; 130 $VMS=1 if $_ eq "VMS";
131 $OS2=1 if $_ eq "OS2";
129 132
130 $do_ssl=1 if $_ eq "ssleay"; 133 $do_ssl=1 if $_ eq "ssleay";
131 $do_ssl=1 if $_ eq "ssl"; 134 if ($_ eq "ssl") {
135 $do_ssl=1;
136 $libname=$_
137 }
132 $do_crypto=1 if $_ eq "libeay"; 138 $do_crypto=1 if $_ eq "libeay";
133 $do_crypto=1 if $_ eq "crypto"; 139 if ($_ eq "crypto") {
140 $do_crypto=1;
141 $libname=$_;
142 }
134 $do_update=1 if $_ eq "update"; 143 $do_update=1 if $_ eq "update";
135 $do_rewrite=1 if $_ eq "rewrite"; 144 $do_rewrite=1 if $_ eq "rewrite";
136 $do_ctest=1 if $_ eq "ctest"; 145 $do_ctest=1 if $_ eq "ctest";
@@ -170,8 +179,17 @@ foreach (@ARGV, split(/ /, $options))
170 } 179 }
171 180
172 181
182if (!$libname) {
183 if ($do_ssl) {
184 $libname="SSLEAY";
185 }
186 if ($do_crypto) {
187 $libname="LIBEAY";
188 }
189}
190
173# If no platform is given, assume WIN32 191# If no platform is given, assume WIN32
174if ($W32 + $W16 + $VMS == 0) { 192if ($W32 + $W16 + $VMS + $OS2 == 0) {
175 $W32 = 1; 193 $W32 = 1;
176} 194}
177 195
@@ -182,7 +200,7 @@ if ($W16) {
182 200
183if (!$do_ssl && !$do_crypto) 201if (!$do_ssl && !$do_crypto)
184 { 202 {
185 print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT ]\n"; 203 print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n";
186 exit(1); 204 exit(1);
187 } 205 }
188 206
@@ -305,10 +323,10 @@ EOF
305 323
306} else { 324} else {
307 325
308 &print_def_file(*STDOUT,"SSLEAY",*ssl_list,@ssl_symbols) 326 &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols)
309 if $do_ssl == 1; 327 if $do_ssl == 1;
310 328
311 &print_def_file(*STDOUT,"LIBEAY",*crypto_list,@crypto_symbols) 329 &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols)
312 if $do_crypto == 1; 330 if $do_crypto == 1;
313 331
314} 332}
@@ -995,6 +1013,7 @@ sub is_valid
995 if ($keyword eq "WIN32" && $W32) { return 1; } 1013 if ($keyword eq "WIN32" && $W32) { return 1; }
996 if ($keyword eq "WIN16" && $W16) { return 1; } 1014 if ($keyword eq "WIN16" && $W16) { return 1; }
997 if ($keyword eq "WINNT" && $NT) { return 1; } 1015 if ($keyword eq "WINNT" && $NT) { return 1; }
1016 if ($keyword eq "OS2" && $OS2) { return 1; }
998 # Special platforms: 1017 # Special platforms:
999 # EXPORT_VAR_AS_FUNCTION means that global variables 1018 # EXPORT_VAR_AS_FUNCTION means that global variables
1000 # will be represented as functions. This currently 1019 # will be represented as functions. This currently
@@ -1092,24 +1111,27 @@ sub print_def_file
1092{ 1111{
1093 (*OUT,my $name,*nums,my @symbols)=@_; 1112 (*OUT,my $name,*nums,my @symbols)=@_;
1094 my $n = 1; my @e; my @r; my @v; my $prev=""; 1113 my $n = 1; my @e; my @r; my @v; my $prev="";
1114 my $liboptions="";
1095 1115
1096 if ($W32) 1116 if ($W32)
1097 { $name.="32"; } 1117 { $name.="32"; }
1098 else 1118 elsif ($W16)
1099 { $name.="16"; } 1119 { $name.="16"; }
1120 elsif ($OS2)
1121 { $liboptions = "INITINSTANCE\nDATA NONSHARED"; }
1100 1122
1101 print OUT <<"EOF"; 1123 print OUT <<"EOF";
1102; 1124;
1103; Definition file for the DLL version of the $name library from OpenSSL 1125; Definition file for the DLL version of the $name library from OpenSSL
1104; 1126;
1105 1127
1106LIBRARY $name 1128LIBRARY $name $liboptions
1107 1129
1108DESCRIPTION 'OpenSSL $name - http://www.openssl.org/' 1130DESCRIPTION 'OpenSSL $name - http://www.openssl.org/'
1109 1131
1110EOF 1132EOF
1111 1133
1112 if (!$W32) { 1134 if ($W16) {
1113 print <<"EOF"; 1135 print <<"EOF";
1114CODE PRELOAD MOVEABLE 1136CODE PRELOAD MOVEABLE
1115DATA PRELOAD MOVEABLE SINGLE 1137DATA PRELOAD MOVEABLE SINGLE
@@ -1148,10 +1170,10 @@ EOF
1148 print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; 1170 print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n";
1149 } 1171 }
1150 $prev = $s2; # To warn about duplicates... 1172 $prev = $s2; # To warn about duplicates...
1151 if($v) { 1173 if($v && !$OS2) {
1152 printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n; 1174 printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n;
1153 } else { 1175 } else {
1154 printf OUT " %s%-39s @%d\n",($W32)?"":"_",$s2,$n; 1176 printf OUT " %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n;
1155 } 1177 }
1156 } 1178 }
1157 } 1179 }