]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Make util/wrap.pl work better on VMS
authorRichard Levitte <levitte@openssl.org>
Wed, 16 Jun 2021 08:32:43 +0000 (10:32 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 18 Jun 2021 07:08:16 +0000 (09:08 +0200)
Perl's system() on VMS needs to have the command line properly fixed
up, even with arguments passed in list form.  We arrange that by
having util/wrap.pl use the same command line fixups as OpenSSL::Test.

As a consequence, util/wrap.pl needs to be generated, to easily pick
up data from configdata.pm.  This also removes yet another file
copying hack from the build file templates.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15791)

Configurations/descrip.mms.tmpl
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl
util/build.info
util/wrap.pl.in [moved from util/wrap.pl with 81% similarity, mode: 0644]

index 2cf03d0214dc080ae2d1351736f4ae491c167329..bad8e0a776b4d92d88919416248fdfef382e58e4 100644 (file)
@@ -447,7 +447,7 @@ NODEBUG=@
 
 # The main targets ###################################################
 
-{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep copy-utils
+{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
 {- dependmagic('build_libs'); -} : build_libs_nodep
 {- dependmagic('build_modules'); -} : build_modules_nodep
 {- dependmagic('build_programs'); -} : build_programs_nodep
@@ -476,7 +476,7 @@ build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
 all : build_sw build_docs
 
 test : tests
-{- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep copy-utils run_tests
+{- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep run_tests
 run_tests :
         @ ! {- output_off() if $disabled{tests}; "" -}
         DEFINE SRCTOP "$(SRCDIR)"
@@ -738,16 +738,6 @@ check_INSTALLTOP :
         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
                 EXIT %x10000002
 
-# Helper targets #####################################################
-
-copy-utils : [.util]wrap.pl
-
-[.util]wrap.pl : configdata.pm
-       @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
-               CREATE/DIR/LOG [.util]
-       @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
-               COPY/LOG ossl_sourceroot:[util]wrap.pl [.util]
-
 # Developer targets ##################################################
 
 debug_logicals :
index 553e51dfe5e01292ad12397b57c5376018bd5c80..2b894c0928396f5b43a090ac5266b99e3ad2ad54 100644 (file)
@@ -1361,10 +1361,9 @@ tar:
 
 # Helper targets #####################################################
 
-link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl \
-            $(BLDDIR)/apps/openssl.cnf
+link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf
 
-$(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm
+$(BLDDIR)/util/opensslwrap.sh: configdata.pm
        @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
            mkdir -p "$(BLDDIR)/util"; \
            ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
@@ -1924,6 +1923,7 @@ EOF
                            rel2abs($config{builddir}));
       return <<"EOF";
 $script: $sources configdata.pm
+       \$(RM) "$script"
        \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
            "-o$target{build_file}" $sources > "$script"
        chmod a+x $script
index ce64c5c3c1940afc39b48026b210b6c31cd69357..43b29baab4e0cc0517abf7fa39fa0aa76817ab28 100644 (file)
@@ -641,11 +641,7 @@ uninstall_image_docs:
 
 # Helper targets #####################################################
 
-copy-utils: $(BLDDIR)\util\wrap.pl $(BLDDIR)\apps\openssl.cnf
-
-$(BLDDIR)\util\wrap.pl: configdata.pm
-       @if NOT EXIST "$(BLDDIR)\util" mkdir "$(BLDDIR)\util"
-       @if NOT "$(SRCDIR)"=="$(BLDDIR)" copy "$(SRCDIR)\util\$(@F)" "$(BLDDIR)\util"
+copy-utils: $(BLDDIR)\apps\openssl.cnf
 
 $(BLDDIR)\apps\openssl.cnf: configdata.pm
        @if NOT EXIST "$(BLDDIR)\apps" mkdir "$(BLDDIR)\apps"
index 65e17a9b870b9e8647b398decbbd88cef35ce845..80120fdae1dd652766596f094b423318eb3117a6 100644 (file)
@@ -6,3 +6,6 @@ ELSIF[{- $target{build_scheme}->[1] eq "unix" -}]
  SCRIPTS{noinst}=shlib_wrap.sh
  SOURCE[shlib_wrap.sh]=shlib_wrap.sh.in
 ENDIF
+SCRIPTS{noinst}=wrap.pl
+SOURCE[wrap.pl]=wrap.pl.in
+DEPEND[wrap.pl]=../configdata.pm
old mode 100755 (executable)
new mode 100644 (file)
similarity index 81%
rename from util/wrap.pl
rename to util/wrap.pl.in
index 1ca09bf..2ac068c
@@ -1,4 +1,4 @@
-#! /usr/bin/env perl
+#! {- $config{HASHBANGPERL} -}
 
 use strict;
 use warnings;
@@ -6,6 +6,18 @@ use warnings;
 use File::Basename;
 use File::Spec::Functions;
 
+BEGIN {
+    # This method corresponds exactly to 'use OpenSSL::Util',
+    # but allows us to use a platform specific file spec.
+    require {-
+         use Cwd qw(abs_path);
+
+         "'" . abs_path(catfile($config{sourcedir},
+                                'util', 'perl', 'OpenSSL', 'Util.pm')) . "'";
+         -};
+    OpenSSL::Util->import();
+}
+
 my $there = canonpath(catdir(dirname($0), updir()));
 my $std_engines = catdir($there, 'engines');
 my $std_providers = catdir($there, 'providers');
@@ -22,7 +34,10 @@ $ENV{OPENSSL_CONF} = $std_openssl_conf
 my $use_system = 0;
 my @cmd;
 
-if (-x $unix_shlib_wrap) {
+if ($^O eq 'VMS') {
+    # VMS needs the command to be appropriately quotified
+    @cmd = fixup_cmd(@ARGV);
+} elsif (-x $unix_shlib_wrap) {
     @cmd = ( $unix_shlib_wrap, @ARGV );
 } else {
     # Hope for the best