Build: Generate apps/progs.c and apps/progs.h in build time
authorRichard Levitte <levitte@openssl.org>
Wed, 26 Feb 2020 13:39:16 +0000 (14:39 +0100)
committerRichard Levitte <levitte@openssl.org>
Mon, 2 Mar 2020 02:34:30 +0000 (03:34 +0100)
util/progs.pl depends on the build tree (on configdata.pm,
specifically), so it needs to be run from the build tree.  But why
stop there?  We might as well generate apps/progs.c and apps/progs.h
when building.

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

Configurations/descrip.mms.tmpl
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl
apps/build.info

index bf22e40dc4d6aba52fb454b2b13ba56f947b314f..8ce6e789990380297fc79faf7329ed9291c8184a 100644 (file)
@@ -140,8 +140,8 @@ HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -
 HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
 HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
 
-APPS_OPENSSL={- use File::Spec::Functions;
-                catfile("apps","openssl") -}
+APPS_OPENSSL="{- use File::Spec::Functions;
+                 catfile("apps","openssl") -}"
 
 # DESTDIR is for package builders so that they can configure for, say,
 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
index ac24687609a919f6b01c188bd6abfed5838bec9b..a019779993ffa6836de1993287cff7cba0c71082 100644 (file)
@@ -195,8 +195,8 @@ MANDOCS7={-
              fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
                         @{$unified_info{mandocs}->{man7}})) -}
 
-APPS_OPENSSL={- use File::Spec::Functions;
-                catfile("apps","openssl") -}
+APPS_OPENSSL="{- use File::Spec::Functions;
+                 catfile("apps","openssl") -}"
 
 # DESTDIR is for package builders so that they can configure for, say,
 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
@@ -962,12 +962,6 @@ lint:
 generate_apps:
        ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
                                < apps/openssl.cnf > apps/openssl-vms.cnf )
-       @ : {- output_off() if $disabled{apps}; "" -}
-       ( b=`pwd`; cd $(SRCDIR); \
-         $(PERL) -I$$b apps/progs.pl -H $(APPS_OPENSSL) > apps/progs.h )
-       ( b=`pwd`; cd $(SRCDIR); \
-         $(PERL) -I$$b apps/progs.pl -C $(APPS_OPENSSL) > apps/progs.c )
-       @ : {- output_on() if $disabled{apps}; "" -}
 
 generate_crypto_bn:
        ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
index 859d3a6324209874ad92dc686631d43d4de495aa..c49b32f0e187d6a8b03408d60d50326f042246a1 100644 (file)
@@ -130,8 +130,8 @@ HTMLDOCS5_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS5;
 HTMLDOCS7_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS7;
                      join(' ', sort keys %dirs) -}
 
-APPS_OPENSSL={- use File::Spec::Functions;
-                "\"".catfile("apps","openssl")."\"" -}
+APPS_OPENSSL="{- use File::Spec::Functions;
+                 catfile("apps","openssl") -}"
 
 # Do not edit these manually. Use Configure with --prefix or --openssldir
 # to change this!  Short explanation in the top comment in Configure
index 1b931c8ac1be6df51145b805efae9585b3081daa..495e56065ebee301c0aa780a4649f83ff8e55af5 100644 (file)
@@ -19,6 +19,10 @@ $OPENSSLSRC=\
         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 storeutl.c \
         list.c info.c provider.c fipsinstall.c
+IF[{- !$disabled{'deprecated-3.0'} -}]
+  $OPENSSLSRC=$OPENSSLSRC \
+        dhparam.c dsa.c dsaparam.c gendsa.c rsa.c rsautl.c genrsa.c
+ENDIF
 
 IF[{- !$disabled{apps} -}]
   PROGRAMS=openssl
@@ -26,15 +30,18 @@ IF[{- !$disabled{apps} -}]
   INCLUDE[openssl]=.. ../include include
   DEPEND[openssl]=libapps.a ../libssl
 
+  DEPEND[${OPENSSLSRC/.c/.o}]=progs.h
+  GENERATE[progs.c]=progs.pl -C $(APPS_OPENSSL)
+  GENERATE[progs.h]=progs.pl -H $(APPS_OPENSSL)
+  # progs.pl tries to read all 'openssl' sources, including progs.c, so we make
+  # sure things are generated in the correct order.
+  DEPEND[progs.h]=progs.c
+
   IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
     GENERATE[openssl.rc]=../util/mkrc.pl openssl
     SOURCE[openssl]=openssl.rc
   ENDIF
 
-  IF[{- !$disabled{'deprecated-3.0'} -}]
-    SOURCE[openssl]=dhparam.c dsa.c dsaparam.c gendsa.c rsa.c rsautl.c genrsa.c
-  ENDIF
-
   SCRIPTS{misc}=CA.pl
   SOURCE[CA.pl]=CA.pl.in
   # linkname tells build files that a symbolic link or copy of this script