This patch adds the ability to build shared libraries (DLLs) for the OS/2
platform. It's a diff against the current 0.9.7-stable branch but should apply
cleanly to HEAD too. Although I've touched a few bits of code that are used
for the Win32 build in mkdef.pl I've verified that the output generated by it
for windows targets is unchanged. The output for VMS does change a little but
looks quite broken anyway (EXETYPE WINDOWS?).
The included changes to util/libeay.num were generated, not hand edited, so a
make update won't clobber them.
Index: INSTALL.OS2
===================================================================
RCS file: /usr/local/cvs/openssl.org/openssl/INSTALL.OS2,v
retrieving revision 1.1
diff -u -r1.1 INSTALL.OS2
--- INSTALL.OS2 2001/07/01 22:39:29 1.1
+++ INSTALL.OS2 2002/03/09 12:11:26
@@ -20,3 +20,12 @@
If that finishes successfully you will find the libraries and programs in the
"out" directory.
+
+ Alternatively, you can make a dynamic build that puts the library code into
+ crypto.dll and ssl.dll by running
+
+ > make -f os2-emx-dll.mak
+
+ This will build the above mentioned dlls and a matching pair of import
+ libraries in the "out_dll" directory along with the set of test programs
+ and the openssl application.
Index: crypto/symhacks.h
===================================================================
RCS file: /usr/local/cvs/openssl.org/openssl/crypto/symhacks.h,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 symhacks.h
--- crypto/symhacks.h 2002/02/28 13:18:26 1.12.2.1
+++ crypto/symhacks.h 2002/03/09 12:11:28
@@ -247,7 +247,7 @@
/* Case insensiteve linking causes problems.... */
-#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS)
+#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)
#undef ERR_load_CRYPTO_strings
#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
#undef OCSP_crlID_new
Index: crypto/bio/bio.h
===================================================================
RCS file: /usr/local/cvs/openssl.org/openssl/crypto/bio/bio.h,v
retrieving revision 1.56
diff -u -r1.56 bio.h
--- crypto/bio/bio.h 2002/01/24 16:20:17 1.56
+++ crypto/bio/bio.h 2002/03/09 12:11:28
@@ -554,7 +554,9 @@
BIO_METHOD *BIO_s_connect(void);
BIO_METHOD *BIO_s_accept(void);
BIO_METHOD *BIO_s_fd(void);
+#ifndef OPENSSL_SYS_OS2
BIO_METHOD *BIO_s_log(void);
+#endif
BIO_METHOD *BIO_s_bio(void);
BIO_METHOD *BIO_s_null(void);
BIO_METHOD *BIO_f_null(void);
Index: os2/OS2-EMX.cmd
===================================================================
RCS file: /usr/local/cvs/openssl.org/openssl/os2/OS2-EMX.cmd,v
retrieving revision 1.1
diff -u -r1.1 OS2-EMX.cmd
--- os2/OS2-EMX.cmd 2001/07/01 22:39:42 1.1
+++ os2/OS2-EMX.cmd 2002/03/09 12:11:28
@@ -5,6 +5,11 @@
@rem create make file
perl util\mk1mf.pl OS2-EMX > OS2-EMX.mak
+perl util\mk1mf.pl dll OS2-EMX > OS2-EMX-DLL.mak
+
+echo Generating export definition files
+perl util\mkdef.pl crypto OS2 > os2\crypto.def
+perl util\mkdef.pl ssl OS2 > os2\ssl.def
echo Generating x86 for GNU assember
Index: util/libeay.num
===================================================================
RCS file: /usr/local/cvs/openssl.org/openssl/util/libeay.num,v
retrieving revision 1.173.2.3
diff -u -r1.173.2.3 libeay.num
--- util/libeay.num 2002/02/28 20:27:57 1.173.2.3
+++ util/libeay.num 2002/03/09 12:11:28
@@ -984,8 +984,8 @@
CRYPTO_free_ex_data 1004 EXIST::FUNCTION:
CRYPTO_get_ex_data 1005 EXIST::FUNCTION:
CRYPTO_set_ex_data 1007 EXIST::FUNCTION:
-ERR_load_CRYPTO_strings 1009 EXIST:!VMS,!WIN16:FUNCTION:
-ERR_load_CRYPTOlib_strings 1009 EXIST:VMS,WIN16:FUNCTION:
+ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS,!WIN16:FUNCTION:
+ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS,WIN16:FUNCTION:
EVP_PKEY_bits 1010 EXIST::FUNCTION:
MD5_Transform 1011 EXIST::FUNCTION:MD5
SHA1_Transform 1012 EXIST::FUNCTION:SHA,SHA1
@@ -1216,7 +1216,7 @@
str_dup 1240 NOEXIST::FUNCTION:
i2s_ASN1_ENUMERATED 1241 EXIST::FUNCTION:
i2s_ASN1_ENUMERATED_TABLE 1242 EXIST::FUNCTION:
-BIO_s_log 1243
EXIST:!WIN16,!WIN32,!macintosh:FUNCTION:
+BIO_s_log 1243
+EXIST:!OS2,!WIN16,!WIN32,!macintosh:FUNCTION:
BIO_f_reliable 1244 EXIST::FUNCTION:BIO
PKCS7_dataFinal 1245 EXIST::FUNCTION:
PKCS7_dataDecode 1246 EXIST::FUNCTION:
@@ -2732,8 +2732,8 @@
KRB5_APREQ_free 3179 EXIST::FUNCTION:
ASN1_OBJECT_it 3180 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
ASN1_OBJECT_it 3180 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
-OCSP_crlID_new 3181 EXIST:!VMS,!WIN16:FUNCTION:
-OCSP_crlID2_new 3181 EXIST:VMS,WIN16:FUNCTION:
+OCSP_crlID_new 3181 EXIST:!OS2,!VMS,!WIN16:FUNCTION:
+OCSP_crlID2_new 3181 EXIST:OS2,VMS,WIN16:FUNCTION:
CONF_modules_load_file 3182 EXIST::FUNCTION:
CONF_imodule_set_usr_data 3183 EXIST::FUNCTION:
ENGINE_set_default_string 3184 EXIST::FUNCTION:
Index: util/mkdef.pl
===================================================================
RCS file: /usr/local/cvs/openssl.org/openssl/util/mkdef.pl,v
retrieving revision 1.67
diff -u -r1.67 mkdef.pl
--- util/mkdef.pl 2002/01/02 16:55:35 1.67
+++ util/mkdef.pl 2002/03/09 12:11:28
@@ -58,6 +58,7 @@
my $crypto_num= "util/libeay.num";
my $ssl_num= "util/ssleay.num";
+my $libname;
my $do_update = 0;
my $do_rewrite = 1;
@@ -73,12 +74,13 @@
my $W32=0;
my $W16=0;
my $NT=0;
+my $OS2=0;
# Set this to make typesafe STACK definitions appear in DEF
my $safe_stack_def = 0;
my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT",
"EXPORT_VAR_AS_FUNCTION" );
-my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT" );
+my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
"CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
"RIPEMD",
@@ -126,11 +128,18 @@
$VMSAlpha=1;
}
$VMS=1 if $_ eq "VMS";
+ $OS2=1 if $_ eq "OS2";
$do_ssl=1 if $_ eq "ssleay";
- $do_ssl=1 if $_ eq "ssl";
+ if ($_ eq "ssl") {
+ $do_ssl=1;
+ $libname=$_
+ }
$do_crypto=1 if $_ eq "libeay";
- $do_crypto=1 if $_ eq "crypto";
+ if ($_ eq "crypto") {
+ $do_crypto=1;
+ $libname=$_;
+ }
$do_update=1 if $_ eq "update";
$do_rewrite=1 if $_ eq "rewrite";
$do_ctest=1 if $_ eq "ctest";
@@ -170,8 +179,17 @@
}
+if (!$libname) {
+ if ($do_ssl) {
+ $libname="SSLEAY";
+ }
+ if ($do_crypto) {
+ $libname="LIBEAY";
+ }
+}
+
# If no platform is given, assume WIN32
-if ($W32 + $W16 + $VMS == 0) {
+if ($W32 + $W16 + $VMS + $OS2 == 0) {
$W32 = 1;
}
@@ -182,7 +200,7 @@
if (!$do_ssl && !$do_crypto)
{
- print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT ]\n";
+ print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n";
exit(1);
}
@@ -305,10 +323,10 @@
} else {
- &print_def_file(*STDOUT,"SSLEAY",*ssl_list,@ssl_symbols)
+ &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols)
if $do_ssl == 1;
- &print_def_file(*STDOUT,"LIBEAY",*crypto_list,@crypto_symbols)
+ &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols)
if $do_crypto == 1;
}
@@ -995,6 +1013,7 @@
if ($keyword eq "WIN32" && $W32) { return 1; }
if ($keyword eq "WIN16" && $W16) { return 1; }
if ($keyword eq "WINNT" && $NT) { return 1; }
+ if ($keyword eq "OS2" && $OS2) { return 1; }
# Special platforms:
# EXPORT_VAR_AS_FUNCTION means that global variables
# will be represented as functions. This currently
@@ -1092,24 +1111,27 @@
{
(*OUT,my $name,*nums,my @symbols)=@_;
my $n = 1; my @e; my @r; my @v; my $prev="";
+ my $liboptions="";
if ($W32)
{ $name.="32"; }
- else
+ elsif ($W16)
{ $name.="16"; }
+ elsif ($OS2)
+ { $liboptions = "INITINSTANCE\nDATA NONSHARED"; }
print OUT <<"EOF";
;
; Definition file for the DLL version of the $name library from OpenSSL
;
-LIBRARY $name
+LIBRARY $name $liboptions
DESCRIPTION 'OpenSSL $name - http://www.openssl.org/'
EOF
- if (!$W32) {
+ if ($W16) {
print <<"EOF";
CODE PRELOAD MOVEABLE
DATA PRELOAD MOVEABLE SINGLE
@@ -1148,10 +1170,10 @@
print STDERR "Warning: Symbol '",$s2,"'
redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~
/^(.*?)\\/,$1),"\n";
}
$prev = $s2; # To warn about duplicates...
- if($v) {
+ if($v && !$OS2) {
printf OUT " %s%-39s @%-8d
DATA\n",($W32)?"":"_",$s2,$n;
} else {
- printf OUT " %s%-39s
@%d\n",($W32)?"":"_",$s2,$n;
+ printf OUT " %s%-39s
+@%d\n",($W32||$OS2)?"":"_",$s2,$n;
}
}
}
Index: util/pl/OS2-EMX.pl
===================================================================
RCS file: /usr/local/cvs/openssl.org/openssl/util/pl/OS2-EMX.pl,v
retrieving revision 1.1
diff -u -r1.1 OS2-EMX.pl
--- util/pl/OS2-EMX.pl 2001/07/01 22:39:46 1.1
+++ util/pl/OS2-EMX.pl 2002/03/09 12:11:28
@@ -10,18 +10,20 @@
# C compiler stuff
$cc='gcc';
-$cflags="-DL_ENDIAN -O3 -fomit-frame-pointer -m486 -Zmt -Wall ";
+$cflags="-DL_ENDIAN -O3 -fomit-frame-pointer -m486 -Zmtd -Wall ";
+$cflags.="-Zomf " if $shlib;
+$shl_cflag="-Zdll";
if ($debug) {
$cflags.="-g ";
}
-$obj='.o';
+$obj=$shlib ? '.obj' : '.o';
$ofile='-o ';
# EXE linking stuff
$link='${CC}';
-$lflags='${CFLAGS} -Zbsd-signals';
+$lflags='${CFLAGS} -Zbsd-signals -s';
$efile='-o ';
$exep='.exe';
$ex_libs="-lsocket";
@@ -30,12 +32,12 @@
$mklib='ar r';
$mlflags='';
$ranlib="ar s";
-$plib='lib';
-$libp=".a";
-$shlibp=".a";
+$plib='';
+$libp=$shlib ? ".lib" : ".a";
+$shlibp=$shlib ? ".dll" : ".a";
$lfile='';
-$asm='as';
+$asm=$shlib ? 'as -Zomf' : 'as';
$afile='-o ';
$bn_asm_obj="";
$bn_asm_src="";
@@ -46,26 +48,34 @@
if (!$no_asm)
{
- $bn_asm_obj='crypto\bn\asm\bn-os2.o crypto\bn\asm\co-os2.o';
- $bn_asm_src='crypto\bn\asm\bn-os2.asm crypto\bn\asm\co-os2.asm';
- $des_enc_obj='crypto\des\asm\d-os2.o crypto\des\asm\y-os2.o';
- $des_enc_src='crypto\des\asm\d-os2.asm crypto\des\asm\y-os2.asm';
- $bf_enc_obj='crypto\bf\asm\b-os2.o';
- $bf_enc_src='crypto\bf\asm\b-os2.asm';
- $cast_enc_obj='crypto\cast\asm\c-os2.o';
- $cast_enc_src='crypto\cast\asm\c-os2.asm';
- $rc4_enc_obj='crypto\rc4\asm\r4-os2.o';
- $rc4_enc_src='crypto\rc4\asm\r4-os2.asm';
- $rc5_enc_obj='crypto\rc5\asm\r5-os2.o';
- $rc5_enc_src='crypto\rc5\asm\r5-os2.asm';
- $md5_asm_obj='crypto\md5\asm\m5-os2.o';
- $md5_asm_src='crypto\md5\asm\m5-os2.asm';
- $sha1_asm_obj='crypto\sha\asm\s1-os2.o';
- $sha1_asm_src='crypto\sha\asm\s1-os2.asm';
- $rmd160_asm_obj='crypto\ripemd\asm\rm-os2.o';
- $rmd160_asm_src='crypto\ripemd\asm\rm-os2.asm';
+ $bn_asm_obj="crypto\\bn\\asm\\bn-os2$obj crypto\\bn\\asm\\co-os2$obj";
+ $bn_asm_src="crypto\\bn\\asm\\bn-os2.asm crypto\\bn\\asm\\co-os2.asm";
+ $des_enc_obj="crypto\\des\\asm\\d-os2$obj crypto\\des\\asm\\y-os2$obj";
+ $des_enc_src="crypto\\des\\asm\\d-os2.asm crypto\\des\\asm\\y-os2.asm";
+ $bf_enc_obj="crypto\\bf\\asm\\b-os2$obj";
+ $bf_enc_src="crypto\\bf\\asm\\b-os2.asm";
+ $cast_enc_obj="crypto\\cast\\asm\\c-os2$obj";
+ $cast_enc_src="crypto\\cast\\asm\\c-os2.asm";
+ $rc4_enc_obj="crypto\\rc4\\asm\\r4-os2$obj";
+ $rc4_enc_src="crypto\\rc4\\asm\\r4-os2.asm";
+ $rc5_enc_obj="crypto\\rc5\\asm\\r5-os2$obj";
+ $rc5_enc_src="crypto\\rc5\\asm\\r5-os2.asm";
+ $md5_asm_obj="crypto\\md5\\asm\\m5-os2$obj";
+ $md5_asm_src="crypto\\md5\\asm\\m5-os2.asm";
+ $sha1_asm_obj="crypto\\sha\\asm\\s1-os2$obj";
+ $sha1_asm_src="crypto\\sha\\asm\\s1-os2.asm";
+ $rmd160_asm_obj="crypto\\ripemd\\asm\\rm-os2$obj";
+ $rmd160_asm_src="crypto\\ripemd\\asm\\rm-os2.asm";
}
+if ($shlib)
+ {
+ $mlflags.=" $lflags -Zdll";
+ $lib_cflag=" -D_DLL";
+ $out_def="out_dll";
+ $tmp_def="tmp_dll";
+ }
+
sub do_lib_rule
{
local($obj,$target,$name,$shlib)=@_;
@@ -76,9 +86,19 @@
($Name=$name) =~ tr/a-z/A-Z/;
$ret.="$target: \$(${Name}OBJ)\n";
- $ret.="\t\$(RM) $target\n";
- $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
- $ret.="\t\$(RANLIB) $target\n\n";
+ if (!$shlib)
+ {
+ $ret.="\t\$(RM) $target\n";
+ $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
+ $ret.="\t\$(RANLIB) $target\n\n";
+ }
+ else
+ {
+ local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
+ $ex.=' -lsocket';
+ $ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target
+\$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n";
+ $ret.="\temximp -o $out_def/$name$libp os2/${Name}.def\n\n";
+ }
}
sub do_link_rule
@@ -89,7 +109,7 @@
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($target);
$ret.="$target: $files $dep_libs\n";
- $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
+ $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n";
return($ret);
}
--
______________________________________________________________________________
| Brian Havard | "He is not the messiah! |
| [EMAIL PROTECTED] | He's a very naughty boy!" - Life of Brian |
------------------------------------------------------------------------------
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]