xref: /minix3/crypto/external/bsd/openssl/dist/util/bat.sh (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc#!/usr/local/bin/perl
2*ebfedea0SLionel Sambuc
3*ebfedea0SLionel Sambuc$infile="/home/eay/ssl/SSLeay/MINFO";
4*ebfedea0SLionel Sambuc
5*ebfedea0SLionel Sambucopen(IN,"<$infile") || die "unable to open $infile:$!\n";
6*ebfedea0SLionel Sambuc$_=<IN>;
7*ebfedea0SLionel Sambucfor (;;)
8*ebfedea0SLionel Sambuc	{
9*ebfedea0SLionel Sambuc	chop;
10*ebfedea0SLionel Sambuc
11*ebfedea0SLionel Sambuc	($key,$val)=/^([^=]+)=(.*)/;
12*ebfedea0SLionel Sambuc	if ($key eq "RELATIVE_DIRECTORY")
13*ebfedea0SLionel Sambuc		{
14*ebfedea0SLionel Sambuc		if ($lib ne "")
15*ebfedea0SLionel Sambuc			{
16*ebfedea0SLionel Sambuc			$uc=$lib;
17*ebfedea0SLionel Sambuc			$uc =~ s/^lib(.*)\.a/$1/;
18*ebfedea0SLionel Sambuc			$uc =~ tr/a-z/A-Z/;
19*ebfedea0SLionel Sambuc			$lib_nam{$uc}=$uc;
20*ebfedea0SLionel Sambuc			$lib_obj{$uc}.=$libobj." ";
21*ebfedea0SLionel Sambuc			}
22*ebfedea0SLionel Sambuc		last if ($val eq "FINISHED");
23*ebfedea0SLionel Sambuc		$lib="";
24*ebfedea0SLionel Sambuc		$libobj="";
25*ebfedea0SLionel Sambuc		$dir=$val;
26*ebfedea0SLionel Sambuc		}
27*ebfedea0SLionel Sambuc
28*ebfedea0SLionel Sambuc	if ($key eq "TEST")
29*ebfedea0SLionel Sambuc		{ $test.=&var_add($dir,$val); }
30*ebfedea0SLionel Sambuc
31*ebfedea0SLionel Sambuc	if (($key eq "PROGS") || ($key eq "E_OBJ"))
32*ebfedea0SLionel Sambuc		{ $e_exe.=&var_add($dir,$val); }
33*ebfedea0SLionel Sambuc
34*ebfedea0SLionel Sambuc	if ($key eq "LIB")
35*ebfedea0SLionel Sambuc		{
36*ebfedea0SLionel Sambuc		$lib=$val;
37*ebfedea0SLionel Sambuc		$lib =~ s/^.*\/([^\/]+)$/$1/;
38*ebfedea0SLionel Sambuc		}
39*ebfedea0SLionel Sambuc
40*ebfedea0SLionel Sambuc	if ($key eq "EXHEADER")
41*ebfedea0SLionel Sambuc		{ $exheader.=&var_add($dir,$val); }
42*ebfedea0SLionel Sambuc
43*ebfedea0SLionel Sambuc	if ($key eq "HEADER")
44*ebfedea0SLionel Sambuc		{ $header.=&var_add($dir,$val); }
45*ebfedea0SLionel Sambuc
46*ebfedea0SLionel Sambuc	if ($key eq "LIBSRC")
47*ebfedea0SLionel Sambuc		{ $libsrc.=&var_add($dir,$val); }
48*ebfedea0SLionel Sambuc
49*ebfedea0SLionel Sambuc	if (!($_=<IN>))
50*ebfedea0SLionel Sambuc		{ $_="RELATIVE_DIRECTORY=FINISHED\n"; }
51*ebfedea0SLionel Sambuc	}
52*ebfedea0SLionel Sambucclose(IN);
53*ebfedea0SLionel Sambuc
54*ebfedea0SLionel Sambuc@a=split(/\s+/,$libsrc);
55*ebfedea0SLionel Sambucforeach (@a)
56*ebfedea0SLionel Sambuc	{
57*ebfedea0SLionel Sambuc	print "${_}.c\n";
58*ebfedea0SLionel Sambuc	}
59*ebfedea0SLionel Sambuc
60*ebfedea0SLionel Sambucsub var_add
61*ebfedea0SLionel Sambuc	{
62*ebfedea0SLionel Sambuc	local($dir,$val)=@_;
63*ebfedea0SLionel Sambuc	local(@a,$_,$ret);
64*ebfedea0SLionel Sambuc
65*ebfedea0SLionel Sambuc	return("") if $no_engine && $dir =~ /\/engine/;
66*ebfedea0SLionel Sambuc	return("") if $no_idea && $dir =~ /\/idea/;
67*ebfedea0SLionel Sambuc	return("") if $no_rc2  && $dir =~ /\/rc2/;
68*ebfedea0SLionel Sambuc	return("") if $no_rc4  && $dir =~ /\/rc4/;
69*ebfedea0SLionel Sambuc	return("") if $no_rsa  && $dir =~ /\/rsa/;
70*ebfedea0SLionel Sambuc	return("") if $no_rsa  && $dir =~ /^rsaref/;
71*ebfedea0SLionel Sambuc	return("") if $no_dsa  && $dir =~ /\/dsa/;
72*ebfedea0SLionel Sambuc	return("") if $no_dh   && $dir =~ /\/dh/;
73*ebfedea0SLionel Sambuc	if ($no_des && $dir =~ /\/des/)
74*ebfedea0SLionel Sambuc		{
75*ebfedea0SLionel Sambuc		if ($val =~ /read_pwd/)
76*ebfedea0SLionel Sambuc			{ return("$dir/read_pwd "); }
77*ebfedea0SLionel Sambuc		else
78*ebfedea0SLionel Sambuc			{ return(""); }
79*ebfedea0SLionel Sambuc		}
80*ebfedea0SLionel Sambuc	return("") if $no_mdc2 && $dir =~ /\/mdc2/;
81*ebfedea0SLionel Sambuc	return("") if $no_sock && $dir =~ /\/proxy/;
82*ebfedea0SLionel Sambuc	return("") if $no_bf   && $dir =~ /\/bf/;
83*ebfedea0SLionel Sambuc	return("") if $no_cast && $dir =~ /\/cast/;
84*ebfedea0SLionel Sambuc
85*ebfedea0SLionel Sambuc	$val =~ s/^\s*(.*)\s*$/$1/;
86*ebfedea0SLionel Sambuc	@a=split(/\s+/,$val);
87*ebfedea0SLionel Sambuc	grep(s/\.[och]$//,@a);
88*ebfedea0SLionel Sambuc
89*ebfedea0SLionel Sambuc	@a=grep(!/^e_.*_3d$/,@a) if $no_des;
90*ebfedea0SLionel Sambuc	@a=grep(!/^e_.*_d$/,@a) if $no_des;
91*ebfedea0SLionel Sambuc	@a=grep(!/^e_.*_i$/,@a) if $no_idea;
92*ebfedea0SLionel Sambuc	@a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
93*ebfedea0SLionel Sambuc	@a=grep(!/^e_.*_bf$/,@a) if $no_bf;
94*ebfedea0SLionel Sambuc	@a=grep(!/^e_.*_c$/,@a) if $no_cast;
95*ebfedea0SLionel Sambuc	@a=grep(!/^e_rc4$/,@a) if $no_rc4;
96*ebfedea0SLionel Sambuc
97*ebfedea0SLionel Sambuc	@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
98*ebfedea0SLionel Sambuc	@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
99*ebfedea0SLionel Sambuc
100*ebfedea0SLionel Sambuc	@a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
101*ebfedea0SLionel Sambuc
102*ebfedea0SLionel Sambuc	@a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
103*ebfedea0SLionel Sambuc	@a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
104*ebfedea0SLionel Sambuc
105*ebfedea0SLionel Sambuc	@a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
106*ebfedea0SLionel Sambuc	@a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
107*ebfedea0SLionel Sambuc	@a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
108*ebfedea0SLionel Sambuc
109*ebfedea0SLionel Sambuc	@a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
110*ebfedea0SLionel Sambuc	@a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
111*ebfedea0SLionel Sambuc
112*ebfedea0SLionel Sambuc	@a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
113*ebfedea0SLionel Sambuc
114*ebfedea0SLionel Sambuc	@a=grep(!/_dhp$/,@a) if $no_dh;
115*ebfedea0SLionel Sambuc
116*ebfedea0SLionel Sambuc	@a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
117*ebfedea0SLionel Sambuc	@a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
118*ebfedea0SLionel Sambuc	@a=grep(!/_mdc2$/,@a) if $no_mdc2;
119*ebfedea0SLionel Sambuc
120*ebfedea0SLionel Sambuc	@a=grep(!/^engine$/,@a) if $no_engine;
121*ebfedea0SLionel Sambuc	@a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa;
122*ebfedea0SLionel Sambuc	@a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
123*ebfedea0SLionel Sambuc	@a=grep(!/^gendsa$/,@a) if $no_sha1;
124*ebfedea0SLionel Sambuc	@a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
125*ebfedea0SLionel Sambuc
126*ebfedea0SLionel Sambuc	@a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
127*ebfedea0SLionel Sambuc
128*ebfedea0SLionel Sambuc	grep($_="$dir/$_",@a);
129*ebfedea0SLionel Sambuc	@a=grep(!/(^|\/)s_/,@a) if $no_sock;
130*ebfedea0SLionel Sambuc	@a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
131*ebfedea0SLionel Sambuc	$ret=join(' ',@a)." ";
132*ebfedea0SLionel Sambuc	return($ret);
133*ebfedea0SLionel Sambuc	}
134*ebfedea0SLionel Sambuc
135