提交 e84193e4 编写于 作者: R Richard Levitte

unified build scheme: add a "unified" template for VMS descrip.mms

As part of this, change util/mkdef.pl to stop adding libraries to
depend on in its output.  mkdef.pl should ONLY output a symbol
vector.

Because symbol names can't be longer than 31 characters, we use the
compiler to shorten those that are longer down to 23 characters plus
an 8 character CRC.  To make sure users of our header files will pick
up on that automatically, add the DEC C supported extra headers files
__decc_include_prologue.h and __decc_include_epilogue.h.

Furthermore, we add a config.com, so VMS people can configure just as
comfortably as any Unix folks, thusly:

    @config
Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 9c44c29e
......@@ -12,6 +12,7 @@
thread_cflags => "",
thread_defines => [],
apps_extra_src => "",
cpuid_asm_src => "mem_clr.c",
bn_asm_src => "bn_asm.c",
ec_asm_src => "",
......
......@@ -1523,4 +1523,64 @@
ranlib => "$ENV{'RANLIB'}",
},
##### VMS
"vms-generic" => {
template => 1,
cc => "CC/DECC",
cflags => "/STANDARD=RELAXED/NOLIST/PREFIX=ALL/NAMES=(AS_IS,SHORTENED)",
debug_cflags => "/NOOPTIMIZE/DEBUG",
release_cflags => "/OPTIMIZE/NODEBUG",
lflags => "/MAP",
debug_lflags => "/DEBUG/TRACEBACK",
release_lflags => "/NODEBUG/NOTRACEBACK",
shared_target => "vms-shared",
apps_extra_src => "vms_decc_init.c",
build_file => "descrip.mms",
build_scheme => [ "unified", "VMS" ],
},
# VMS on VAX is *unsupported*
#"vms-asm" => {
# template => 1,
# bn_obj => "[.asm]vms.obj vms-helper.obj"
#},
#"vms-vax" => {
# inherit_from => [ "vms-generic", asm("vms-asm") ],
# as => "MACRO",
# debug_aflags => "/NOOPTIMIZE/DEBUG",
# release_aflags => "/OPTIMIZE/NODEBUG",
# bn_opts => "THIRTY_TWO_BIT RC4_CHAR RC4_CHUNK DES_PTR BF_PTR",
#},
"vms-alpha" => {
inherit_from => [ "vms-generic" ],
#as => "???",
#debug_aflags => "/NOOPTIMIZE/DEBUG",
#release_aflags => "/OPTIMIZE/NODEBUG",
bn_opts => "SIXTY_FOUR_BIT RC4_INT RC4_CHUNK_LL DES_PTR BF_PTR",
},
"vms-alpha-P32" => {
inherit_from => [ "vms-alpha" ],
cflags => add("/POINTER_SIZE=32"),
},
"vms-alpha-P64" => {
inherit_from => [ "vms-alpha" ],
cflags => add("/POINTER_SIZE=64"),
},
"vms-ia64" => {
inherit_from => [ "vms-generic" ],
#as => "I4S",
#debug_aflags => "/NOOPTIMIZE/DEBUG",
#release_aflags => "/OPTIMIZE/NODEBUG",
bn_opts => "SIXTY_FOUR_BIT RC4_INT RC4_CHUNK_LL DES_PTR BF_PTR",
},
"vms-ia64-P32" => {
inherit_from => [ "vms-ia64" ],
cflags => add("/POINTER_SIZE=32"),
},
"vms-ia64-P64" => {
inherit_from => [ "vms-ia64" ],
cflags => add("/POINTER_SIZE=64"),
},
);
......@@ -163,6 +163,8 @@ In each table entry, the following keys are significant:
export vars as
accessor functions.
apps_extra_src => Extra source to build apps/openssl, as
needed by the target.
cpuid_asm_src => assembler implementation of cpuid code as
well as OPENSSL_cleanse().
Default to mem_clr.c
......
此差异已折叠。
CASE_SENSITIVE=YES
SYMBOL_VECTOR=(bind_engine=PROCEDURE,v_check=PROCEDURE)
$ ! OpenSSL shutdown script
$ !
$ ! This script deassigns the logical names used by the installation
$ ! of OpenSSL. It can do so at any level, defined by P1.
$ !
$ ! P1 Qualifier(s) for DEASSIGN.
$ ! Default: /PROCESS
$ !
$ ! P2 If the value is "NOALIASES", no alias logical names are
$ ! deassigned.
$
$ status = %x10000001 ! Generic success
$
$ ! In case there's a problem
$ ON CONTROL_Y THEN GOTO bailout
$ ON ERROR THEN GOTO bailout
$
$ ! Find the architecture
$ IF F$GETSYI("CPU") .LT. 128
$ THEN
$ arch := VAX
$ ELSE
$ arch := F$EDIT(F$GETSYI("ARCH_NAME"),"UPCASE")
$ IF arch .EQS. "" THEN GOTO unknown_arch
$ ENDIF
$
$ ! Generated information
$ VERSION := {- $config{version} -}
$ INSTALLTOP := {- $config{INSTALLTOP} -}
$ POINTER_SIZE = {- $config{pointersize} -}
$
$ ! Abbrevs
$ DEAS := DEASSIGN /NOLOG 'P1'
$ v = VERSION - "." - "."
$
$ DEAS OSSL$ROOT'v'
$ DEAS OSSL$INCLUDE'v'
$ DEAS OSSL$LIB'v'
$ DEAS OSSL$SHARE'v'
$ DEAS OSSL$ENGINES'v'
$ DEAS OSSL$EXE'v'
$ {- output_off() if $config{no_shared} -}
$ {- join("\n\$ ", map { "DEAS $_'v'" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
$ {- output_on() -}
$ IF P2 .NES. "NOALIASES"
$ THEN
$ DEAS OSSL$ROOT
$ DEAS OSSL$INCLUDE
$ DEAS OSSL$LIB
$ DEAS OSSL$SHARE
$ DEAS OSSL$ENGINES
$ DEAS OSSL$EXE
$ DEAS OPENSSL
$ {- output_off() if $config{no_shared} -}
$ {- join("\n\$ ", map { "DEAS $_" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
$ {- output_on() -}
$ ENDIF
$
$ EXIT 'status'
$ ! OpenSSL startup script
$ !
$ ! This script defines the logical names used by the installation
$ ! of OpenSSL. It can provide those logical names at any level,
$ ! defined by P1.
$ !
$ ! The logical names created are:
$ !
$ ! OSSL$ROOTnnn Installation root
$ ! OSSL$EXEnnn Where the executables are located
$ ! OSSL$LIBnnn Where the library files are located
$ ! OSSL$SHAREnnn Where the sahreable images are located
$ ! OSSL$INCLUDEnnn Include directory root
$ ! OSSL$ENGINESnnn Where the sahreable images are located
$ !
$ ! In all these, nnn is the OpenSSL version number. This allows
$ ! several OpenSSL versions to be installed simultaneously.
$ !
$ ! In addition, unless P2 is "NOALIASES", these logical names are
$ ! created:
$ !
$ ! OSSL$ROOT Alias for OSSL$ROOTnnn
$ ! OSSL$EXE Alias for OSSL$EXEnnn
$ ! OSSL$LIB Alias for OSSL$LIBnnn
$ ! OSSL$SHARE Alias for OSSL$SHAREnnn
$ ! OSSL$INCLUDE Alias for OSSL$INCLUDEnnn
$ ! OPENSSL is OSSL$INCLUDE:[OPENSSL]
$ ! OSSL$ENGINES Alias for OSSL$ENGINESnnn
$ !
$ ! P1 Qualifier(s) for DEFINE. "/SYSTEM" would be typical when
$ ! calling this script from SYS$STARTUP:SYSTARTUP_VMS.COM,
$ ! while "/PROCESS" would be typical for a personal install.
$ ! Default: /PROCESS
$ !
$ ! P2 If the value is "NOALIASES", no alias logical names are
$ ! created.
$
$ status = %x10000001 ! Generic success
$
$ ! In case there's a problem
$ ON CONTROL_Y THEN GOTO bailout
$ ON ERROR THEN GOTO bailout
$
$ ! Find the architecture
$ IF F$GETSYI("CPU") .LT. 128
$ THEN
$ arch := VAX
$ ELSE
$ arch := F$EDIT(F$GETSYI("ARCH_NAME"),"UPCASE")
$ IF arch .EQS. "" THEN GOTO unknown_arch
$ ENDIF
$
$ ! Generated information
$ VERSION := {- $config{version} -}
$ INSTALLTOP := {- $config{INSTALLTOP} -}
$ OPENSSLDIR := {- $config{OPENSSLDIR} -}
$ POINTER_SIZE = {- $config{pointersize} -}
$
$ ! Make sure that INSTALLTOP and OPENSSLDIR become something one
$ ! can build concealed logical names on
$ INSTALLTOP_ = F$PARSE("A.;",INSTALLTOP,,,"NO_CONCEAL") - "A.;" -
- ".][000000" - "[000000." - "][" - "]" + ".]"
$ OPENSSLDIR_ = F$PARSE("A.;",OPENSSLDIR,,,"NO_CONCEAL") - "A.;" -
- ".][000000" - "[000000." - "][" - "]" + ".]"
$ DEFINE /TRANSLATION=CONCEALED /NOLOG WRK_INSTALLTOP 'INSTALLTOP_'
$
$ ! Check that things are in place, and specifically, the stuff
$ ! belonging to this architecture
$ IF F$SEARCH("WRK_INSTALLTOP:[000000]INCLUDE.DIR;1") .EQS. "" -
.OR. F$SEARCH("WRK_INSTALLTOP:[000000]''arch'.DIR;1") .EQS. "" -
.OR. F$SEARCH("WRK_INSTALLTOP:[''arch']LIB.DIR;1") .EQS. "" -
.OR. F$SEARCH("WRK_INSTALLTOP:[''arch']EXE.DIR;1") .EQS. "" -
.OR. F$SEARCH("WRK_INSTALLTOP:[000000]openssl.cnf;1") .EQS. ""
$ THEN
$ WRITE SYS$ERROR "''INSTALLTOP' doesn't look like an OpenSSL installation for ''arch'"
$ status = %x00018292 ! RMS$_FNF, file not found
$ GOTO bailout
$ ENDIF
$
$ ! Abbrevs
$ DEFT := DEFINE /TRANSLATION=CONCEALED /NOLOG 'P1'
$ DEF := DEFINE /NOLOG 'P1'
$ v = VERSION - "." - "."
$
$ DEFT OSSL$INSTROOT'v' 'INSTALLTOP_'
$ DEFT OSSL$INCLUDE'v' OSSL$INSTROOT:[INCLUDE.]
$ DEF OSSL$LIB'v' OSSL$INSTROOT:['arch'.LIB]
$ DEF OSSL$SHARE'v' OSSL$INSTROOT:['arch'.LIB]
$ DEF OSSL$ENGINES'v' OSSL$INSTROOT:['arch'.ENGINES]
$ DEF OSSL$EXE'v' OSSL$INSTROOT:['arch'.EXE]
$ {- output_off() if $config{no_shared} -}
$ {- join("\n\$ ", map { "DEF $_'v' OSSL\$SHARE:$_" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
$ {- output_on() -}
$ IF P2 .NES. "NOALIASES"
$ THEN
$ DEF OSSL$INSTROOT OSSL$INSTROOT'v'
$ DEF OSSL$INCLUDE OSSL$INCLUDE'v'
$ DEF OSSL$LIB OSSL$LIB'v'
$ DEF OSSL$SHARE OSSL$SHARE'v'
$ DEF OSSL$ENGINES OSSL$ENGINES'v'
$ DEF OSSL$EXE OSSL$EXE'v'
$ DEF OPENSSL OSSL$INCLUDE:[OPENSSL]
$ {- output_off() if $config{no_shared} -}
$ {- join("\n\$ ", map { "DEF $_ $_'v'" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
$ {- output_on() -}
$ ENDIF
$
$ DEFT OSSL$DATAROOT 'OPENSSLDIR_'
$ DEF OSSL$CERTS OSSL$DATAROOT:[CERTS]
$ DEF OSSL$PRIVATE OSSL$DATAROOT:[PRIVATE]
$
$ bailout:
$ DEASSIGN WRK_INSTALLTOP
$
$ EXIT 'status'
$!
$! APPS.COM
$! Written By: Robert Byer
$! Vice-President
$! A-Com Computing, Inc.
$! byer@mail.all-net.net
$!
$!
$! Slightly modified by Richard Levitte <richard@levitte.org>
$!
$!
$! Always define OPENSSL. Others are optional (non-null P1).
$!
$ OPENSSL :== $SSLEXE:OPENSSL
$ ! OpenSSL utilities
$ !
$
$ IF (P1 .NES. "")
$ THEN
$ VERIFY :== $SSLEXE:OPENSSL VERIFY
$ ASN1PARSE:== $SSLEXE:OPENSSL ASN1PARS
$! REQ could conflict with REQUEST.
$ OREQ :== $SSLEXE:OPENSSL REQ
$ DGST :== $SSLEXE:OPENSSL DGST
$ DH :== $SSLEXE:OPENSSL DH
$ ENC :== $SSLEXE:OPENSSL ENC
$ GENDH :== $SSLEXE:OPENSSL GENDH
$ ERRSTR :== $SSLEXE:OPENSSL ERRSTR
$ CA :== $SSLEXE:OPENSSL CA
$ CRL :== $SSLEXE:OPENSSL CRL
$ RSA :== $SSLEXE:OPENSSL RSA
$ DSA :== $SSLEXE:OPENSSL DSA
$ DSAPARAM :== $SSLEXE:OPENSSL DSAPARAM
$ X509 :== $SSLEXE:OPENSSL X509
$ GENRSA :== $SSLEXE:OPENSSL GENRSA
$ GENDSA :== $SSLEXE:OPENSSL GENDSA
$ S_SERVER :== $SSLEXE:OPENSSL S_SERVER
$ S_CLIENT :== $SSLEXE:OPENSSL S_CLIENT
$ SPEED :== $SSLEXE:OPENSSL SPEED
$ S_TIME :== $SSLEXE:OPENSSL S_TIME
$ VERSION :== $SSLEXE:OPENSSL VERSION
$ PKCS7 :== $SSLEXE:OPENSSL PKCS7
$ CRL2PKCS7:== $SSLEXE:OPENSSL CRL2P7
$ SESS_ID :== $SSLEXE:OPENSSL SESS_ID
$ CIPHERS :== $SSLEXE:OPENSSL CIPHERS
$ NSEQ :== $SSLEXE:OPENSSL NSEQ
$ PKCS12 :== $SSLEXE:OPENSSL PKCS12
$ ENDIF
$ OPENSSL :== $OSSL$EXE:OPENSSL
$
$ IF F$SYMBOL(PERL) .EQS. "STRING"
$ THEN
$ OSSLCA :== 'PERL' OSSL$EXE:CA.pl
$ OSSLREHASH :== 'PERL' OSSL$EXE:c_rehash.pl
$ ELSE
$ WRITE SYS$ERROR "NOTE: no perl => no OSSLCA or OSSLREHASH"
$ ENDIF
#! /usr/bin/perl
# This script will translate any SYMBOL_VECTOR item that has a translation
# in CXX$DEMANGLER_DB. The latter is generated by and CC/DECC command that
# uses the qualifier /REPOSITORY with the build directory as value. When
# /NAMES=SHORTENED has been used, this file will hold the translations from
# the original symbols to the shortened variants.
#
# CXX$DEMAGLER_DB. is an ISAM file, but with the magic of RMS, it can be
# read as a text file, with each record as one line.
#
# The lines will have the following syntax for any symbol found that's longer
# than 31 characters:
#
# LONG_symbol_34567890123{cksum}$LONG_symbol_34567890123_more_than_31_chars
#
# $ is present at the end of the shortened symbol name, and is preceded by a
# 7 character checksum. The $ makes it easy to separate the shortened name
# from the original one.
use strict;
use warnings;
usage() if scalar @ARGV < 1;
my %translations = ();
open DEMANGLER_DATA, $ARGV[0]
or die "Couldn't open $ARGV[0]: $!\n";
while(<DEMANGLER_DATA>) {
chomp;
(my $translated, my $original) = split /\$/;
$translations{$original} = $translated.'$';
}
close DEMANGLER_DATA;
$| = 1; # Autoflush
while(<STDIN>) {
s@
((?:[A-Za-z0-9_]+)\/)?([A-Za-z0-9_]+)=(PROCEDURE|DATA)
@
if (defined($translations{$2})) {
my $trans = $translations{$2};
my $trans_uc = uc $trans;
if (defined($1) && $trans ne $trans_uc) {
"$trans_uc/$trans=$3"
} else {
"$trans=$3"
}
} else {
$&
}
@gxe;
print $_;
}
......@@ -9,7 +9,8 @@ SOURCE[openssl]=\
s_client.c s_server.c s_time.c sess_id.c smime.c speed.c spkac.c \
srp.c ts.c verify.c version.c x509.c rehash.c \
apps.c opt.c s_cb.c s_socket.c \
app_rand.c
app_rand.c \
{- $target{apps_extra_src} -}
INCLUDE[openssl]={- rel2abs(catdir($builddir,"../include")) -} .. ../include
DEPEND[openssl]=../libssl
......
......@@ -13,3 +13,15 @@ ELSIF[{- $config{target} =~ /^mingw/ -}]
SHARED_NAME[libcrypto]=libeay32
SHARED_NAME[libssl]=ssleay32
ENDIF
# VMS has a cultural standard where all libraries are prefixed.
# For OpenSSL, the choice is 'ossl$' (this prefix was claimed in a
# conversation with VSI, Tuesday January 26 2016)
# Also, it seems it's usual to have a suffix to the shared library name
# for the different pointer sizes that were built for.
IF[{- $config{target} =~ /^vms/ -}]
RENAME[libcrypto]=ossl$libcrypto
RENAME[libssl]=ossl$libssl
SHARED_NAME[libcrypto]=ossl$libcrypto_shr{- $target{pointer_size} -}
SHARED_NAME[libssl]=ossl$libssl_shr{- $target{pointer_size} -}
ENDIF
$ ! OpenSSL config: determine the architecture and run Configure
$ !
$ ! Very simple for the moment, it will take the following arguments:
$ !
$ ! 32 sets /POINTER_SIZE=32
$ ! 64 sets /POINTER_SIZE=64
$ ! DEBUG sets debugging
$ ! HELP prints a usage and exits
$
$ arch == f$edit( f$getsyi( "arch_name"), "lowercase")
$ pointer_size = ""
$ debug = ""
$ here = F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"),,,"SYNTAX_ONLY") - "A.;"
$
$ collected_args = ""
$ P_index = 0
$ LOOP1:
$ P_index = P_index + 1
$ IF P_index .GT. 8 THEN GOTO ENDLOOP1
$ P1 = F$EDIT(P1,"TRIM")
$ IF P1 .EQS. "HELP" THEN GOTO USAGE
$ IF P1 .EQS. "32"
$ THEN
$ pointer_size = "-P32"
$ P1 = ""
$ ENDIF
$ IF P1 .EQS. "64"
$ THEN
$ pointer_size = "-P64"
$ P1 = ""
$ ENDIF
$ IF P1 .EQS. "DEBUG"
$ THEN
$ debug = "--debug"
$ P1 = ""
$ ENDIF
$ IF P1 .NES. "" THEN -
collected_args = collected_args + " " + P1
$ P1 = P2
$ P2 = P3
$ P3 = P4
$ P4 = P5
$ P5 = P6
$ P6 = P7
$ P7 = P8
$ P8 = ""
$ GOTO LOOP1
$ ENDLOOP1:
$
$ target = "vms-''arch'''pointer_size'"
$ PERL 'here'Configure "''target'" 'debug' 'collected_args'
$ EXIT $STATUS
$
$ USAGE:
$ TYPE SYS$INPUT
$ DECK
usage: @config [options]
32 build with 32-bit pointer size
64 build with 64-bit pointer size
DEBUG build with debugging
HELP this text
Any other option is simply passed to Configure.
$ EOD
{- use File::Spec::Functions qw/catdir catfile/; -}
LIBS=../libcrypto
SOURCE[../libcrypto]=\
cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
......@@ -9,6 +10,11 @@ EXTRA= ../ms/uplink-x86.pl ../ms/uplink.c ../ms/applink.c \
DEPEND[cversion.o]=buildinf.h
BEGINRAW[descrip.mms]
[.crypto]buildinf.h : descrip.mms
$(PERL) {- catfile(catdir($sourcedir, "[-]"), "util", "mkbuildinf.pl") -} "$(CC) $(CFLAGS)" "$(PLATFORM)" > [.crypto]buildinf.h
ENDRAW[descrip.mms]
BEGINRAW[Makefile]
crypto/buildinf.h : Makefile
$(PERL) $(SRCDIR)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" > crypto/buildinf.h
......
LIBS=../../libcrypto
SOURCE[../../libcrypto]=\
md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \
rand_win.c rand_unix.c rand_os2.c rand_nw.c
rand_win.c rand_unix.c rand_vms.c rand_os2.c rand_nw.c
/*
* This file is only used by HP C on VMS, and is included automatically
* after each header file from this directory
*/
/* restore state. Must correspond to the save in __decc_include_prologue.h */
#pragma names restore
/*
* This file is only used by HP C on VMS, and is included automatically
* after each header file from this directory
*/
/* save state */
#pragma names save
/* have the compiler shorten symbols larger than 31 chars to 23 chars
* followed by a 8 hex char CRC
*/
#pragma names as_is,shortened
......@@ -1225,12 +1225,8 @@ EOF
}
elsif ($VMS)
{
my $libref = $name eq "ssl" ? "LIBCRYPTO.EXE /SHARE" : "";
print OUT <<"EOF";
IDENTIFICATION="V$version"
CASE_SENSITIVE=YES
LIB$libname.OLB /LIBRARY
$libref
SYMBOL_VECTOR=(-
EOF
$symvtextcount = 16; # length of "SYMBOL_VECTOR=(-"
......@@ -1297,34 +1293,35 @@ EOF
print OUT " $s2;\n";
} elsif ($VMS) {
while(++$prevnum < $n) {
my $symline="SPARE, SPARE -";
if ($symvtextcount + length($symline) + 1 > 1024) {
my $symline=" ,SPARE -\n ,SPARE -\n";
if ($symvtextcount + length($symline) - 2 > 1024) {
print OUT ")\nSYMBOL_VECTOR=(-\n";
$symvtextcount = 16; # length of "SYMBOL_VECTOR=(-"
}
if ($symvtextcount > 16) {
$symline = ",".$symline;
if ($symvtextcount == 16) {
# Take away first comma
$symline =~ s/,//;
}
print OUT " $symline\n";
$symvtextcount += length($symline);
print OUT $symline;
$symvtextcount += length($symline) - 2;
}
(my $s_uc = $s) =~ tr/a-z/A-Z/;
my $symtype=
$v ? "DATA" : "PROCEDURE";
my $symline=
($s_uc ne $s
? "$s_uc/$s=$symtype, $s=$symtype"
: "$s=$symtype, SPARE")
." -";
if ($symvtextcount + length($symline) + 1 > 1024) {
? " ,$s_uc/$s=$symtype -\n ,$s=$symtype -\n"
: " ,$s=$symtype -\n ,SPARE -\n");
if ($symvtextcount + length($symline) - 2 > 1024) {
print OUT ")\nSYMBOL_VECTOR=(-\n";
$symvtextcount = 16; # length of "SYMBOL_VECTOR=(-"
}
if ($symvtextcount > 16) {
$symline = ",".$symline;
if ($symvtextcount == 16) {
# Take away first comma
$symline =~ s/,//;
}
print OUT " $symline\n";
$symvtextcount += length($symline);
print OUT $symline;
$symvtextcount += length($symline) - 2;
} elsif($v && !$OS2) {
printf OUT " %s%-39s @%-8d DATA\n",
($W32)?"":"_",$s2,$n;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册