Browse Source

Fix util/wrap.pl.in for VMS usage

In the name of consistency, make sure that this same script is used
across more platforms, in this case VMS.  This removes the need for
util/local_shlib.com.in and util/unlocal_shlib.com.in, which were
under-used anyway.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20415)
Richard Levitte 1 year ago
parent
commit
1939ee7f25
4 changed files with 27 additions and 71 deletions
  1. 1 5
      util/build.info
  2. 0 31
      util/local_shlib.com.in
  3. 0 27
      util/unlocal_shlib.com.in
  4. 26 8
      util/wrap.pl.in

+ 1 - 5
util/build.info

@@ -1,8 +1,4 @@
-IF[{- $target{build_scheme}->[1] eq "VMS" -}]
- SCRIPTS{noinst}=local_shlib.com unlocal_shlib.com
- SOURCE[local_shlib.com]=local_shlib.com.in
- SOURCE[unlocal_shlib.com]=unlocal_shlib.com.in
-ELSIF[{- $target{build_scheme}->[1] eq "unix" -}]
+IF[{- $target{build_scheme}->[1] eq "unix" -}]
  SCRIPTS{noinst}=shlib_wrap.sh
  SOURCE[shlib_wrap.sh]=shlib_wrap.sh.in
 ENDIF

+ 0 - 31
util/local_shlib.com.in

@@ -1,31 +0,0 @@
-${-
-  use File::Spec::Functions qw(rel2abs);
-
-  my $bldtop = rel2abs($config{builddir});
-  our %names = ( map { platform->sharedname($_) =>
-                           $bldtop.platform->sharedlib($_) }
-                 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
-                 @{$unified_info{libraries}} );
-  "" -}
-$       ! Create a local environment with the shared library logical names
-$       ! properly set.  Undo this with unlocal_shlib.com
-$
-$       OPENSSL_NAMES := OPENSSL_NAMES_'F$GETJPI("","PID")'
-$       CREATE/NAME_TABLE/PARENT_TABLE=LNM$PROCESS_DIRECTORY 'OPENSSL_NAMES'
-$       DEFINE/TABLE='OPENSSL_NAMES' OSSL_FLAG YES
-$
-$       NAMES := {- join(",", keys %names); -}
-{-
-  join("\n", map { "\$       __$_ = \"".$names{$_}."\"" } sort keys %names);
--}      
-$       I = 0
-$       LOOP:
-$           E = F$ELEMENT(I,",",NAMES)
-$           I = I + 1
-$           IF E .EQS. "," THEN GOTO ENDLOOP
-$           EV = __'E'
-$           OLDV = F$TRNLNM(E,"LNM$PROCESS")
-$           IF OLDV .NES. "" THEN DEFINE/TABLE='OPENSSL_NAMES' 'E' 'OLDV'
-$           DEFINE 'E' 'EV'
-$           GOTO LOOP
-$       ENDLOOP:

+ 0 - 27
util/unlocal_shlib.com.in

@@ -1,27 +0,0 @@
-${-
-  use File::Spec::Functions qw(rel2abs);
-
-  my $bldtop = rel2abs($config{builddir});
-  our %names = ( map { platform->sharedname($_) =>
-                           $bldtop.platform->sharedlib($_) }
-                 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
-                 @{$unified_info{libraries}} );
-  "" -}
-$       ! Remove the local environment created by local_shlib.com
-$
-$       OPENSSL_NAMES := OPENSSL_NAMES_'F$GETJPI("","PID")'
-$       IF F$TRNLNM("OSSL_FLAG",OPENSSL_NAMES) .EQS. "" THEN EXIT 0
-$
-$       NAMES := {- join(",", sort keys %names); -}
-$       I = 0
-$       LOOP:
-$           E = F$ELEMENT(I,",",NAMES)
-$           I = I + 1
-$           IF E .EQS. "," THEN GOTO ENDLOOP
-$           OLDV = F$TRNLNM(E,OPENSSL_NAMES)
-$           DEASSIGN 'E'
-$           IF OLDV .NES. "" THEN DEFINE 'E' 'OLDV'
-$           GOTO LOOP
-$       ENDLOOP:
-$
-$       DEASSIGN 'OPENSSL_NAMES' /TABLE=LNM$PROCESS_DIRECTORY

+ 26 - 8
util/wrap.pl.in

@@ -23,6 +23,7 @@ my $std_engines = catdir($there, 'engines');
 my $std_providers = catdir($there, 'providers');
 my $std_openssl_conf = catdir($there, 'apps/openssl.cnf');
 my $unix_shlib_wrap = catfile($there, 'util/shlib_wrap.sh');
+my $std_openssl_conf_include;
 
 if ($ARGV[0] eq '-fips') {
     $std_openssl_conf = {-
@@ -32,19 +33,36 @@ if ($ARGV[0] eq '-fips') {
          -};
     shift;
 
-    my $std_openssl_conf_include = catdir($there, 'providers');
-    $ENV{OPENSSL_CONF_INCLUDE} = $std_openssl_conf_include
-        if ($ENV{OPENSSL_CONF_INCLUDE} // '') eq ''
-            && -d $std_openssl_conf_include;
+    $std_openssl_conf_include = catdir($there, 'providers');
 }
 
-$ENV{OPENSSL_ENGINES} = $std_engines
+local $ENV{OPENSSL_CONF_INCLUDE} = $std_openssl_conf_include
+    if defined $std_openssl_conf_include
+       &&($ENV{OPENSSL_CONF_INCLUDE} // '') eq ''
+       && -d $std_openssl_conf_include;
+local $ENV{OPENSSL_ENGINES} = $std_engines
     if ($ENV{OPENSSL_ENGINES} // '') eq '' && -d $std_engines;
-$ENV{OPENSSL_MODULES} = $std_providers
+local $ENV{OPENSSL_MODULES} = $std_providers
     if ($ENV{OPENSSL_MODULES} // '') eq '' && -d $std_providers;
-$ENV{OPENSSL_CONF} = $std_openssl_conf
+local $ENV{OPENSSL_CONF} = $std_openssl_conf
     if ($ENV{OPENSSL_CONF} // '') eq '' && -f $std_openssl_conf;
-
+{-
+     # For VMS, we define logical names to get the libraries properly
+     # defined.
+     use File::Spec::Functions qw(rel2abs);
+
+     if ($^O eq "VMS") {
+         my $bldtop = rel2abs($config{builddir});
+         my %names =
+             map { platform->sharedname($_) => $bldtop.platform->sharedlib($_) }
+             grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
+             @{$unified_info{libraries}};
+
+         foreach (sort keys %names) {
+             $OUT .= "local \$ENV\{'$_'\} = '$names{$_}';\n";
+         }
+     }
+-}
 my $use_system = 0;
 my @cmd;