Browse Source

Move uplink file information to build.info files

This file information was hidden in config target files, when they
should really be part of build.info like any other file we build
from.  With build.info variables, the task became much easier.

We take the opportunity to move apps_init_src and apps_aux_src to
apps/build.info as well, and to clean up apps/build.info.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9166)
Richard Levitte 4 years ago
parent
commit
989b2ad786

+ 0 - 25
Configurations/00-base-templates.conf

@@ -14,10 +14,7 @@ my %targets=(
 	thread_scheme	=> "(unknown)", # Assume we don't know
 	thread_defines	=> [],
 
-	apps_aux_src	=> "",
-	apps_init_src	=> "",
 	cpuid_asm_src	=> "mem_clr.c",
-	uplink_aux_src	=> "",
 	bn_asm_src	=> "bn_asm.c",
 	ec_asm_src	=> "",
 	des_asm_src	=> "des_enc.c fcrypt_b.c",
@@ -169,28 +166,6 @@ my %targets=(
         perl_platform    => 'VMS',
     },
 
-    uplink_common => {
-	template	=> 1,
-	apps_init_src	=> add("../ms/applink.c"),
-	uplink_aux_src	=> add("../ms/uplink.c"),
-	defines		=> add("OPENSSL_USE_APPLINK"),
-    },
-    x86_uplink => {
-	inherit_from	=> [ "uplink_common" ],
-	template	=> 1,
-	uplink_aux_src	=> add("uplink-x86.s"),
-    },
-    x86_64_uplink => {
-	inherit_from	=> [ "uplink_common" ],
-	template	=> 1,
-	uplink_aux_src	=> add("uplink-x86_64.s"),
-    },
-    ia64_uplink => {
-	inherit_from	=> [ "uplink_common" ],
-	template	=> 1,
-	uplink_aux_src	=> add("uplink-ia64.s"),
-    },
-
     x86_asm => {
 	template	=> 1,
 	cpuid_asm_src	=> "x86cpuid.s",

+ 5 - 13
Configurations/10-main.conf

@@ -1216,7 +1216,6 @@ my %targets = (
         shared_target    => "win-shared", # meaningless except it gives Configure a hint
         thread_scheme    => "winthreads",
         dso_scheme       => "win32",
-        apps_aux_src     => add("win32_init.c"),
         bn_ops           => "EXPORT_VAR_AS_FN",
         perl_platform    => 'Windows::MSVC',
         # additional parameter to build_scheme denotes install-path "flavour"
@@ -1272,8 +1271,7 @@ my %targets = (
         bn_ops           => add("SIXTY_FOUR_BIT"),
     },
     "VC-WIN64I" => {
-        inherit_from     => [ "VC-WIN64-common", asm("ia64_asm"),
-                              sub { $disabled{uplink} ? () : "ia64_uplink" } ],
+        inherit_from     => [ "VC-WIN64-common", asm("ia64_asm") ],
         AS               => "ias",
         ASFLAGS          => "-d debug",
         asoutflag        => "-o ",
@@ -1285,8 +1283,7 @@ my %targets = (
         multilib         => "-ia64",
     },
     "VC-WIN64A" => {
-        inherit_from     => [ "VC-WIN64-common", asm("x86_64_asm"),
-                              sub { $disabled{uplink} ? () : "x86_64_uplink" } ],
+        inherit_from     => [ "VC-WIN64-common", asm("x86_64_asm") ],
         AS               => sub { vc_win64a_info()->{AS} },
         ASFLAGS          => sub { vc_win64a_info()->{ASFLAGS} },
         asoutflag        => sub { vc_win64a_info()->{asoutflag} },
@@ -1299,8 +1296,7 @@ my %targets = (
         multilib         => "-x64",
     },
     "VC-WIN32" => {
-        inherit_from     => [ "VC-noCE-common", asm("x86_asm"),
-                              sub { $disabled{uplink} ? () : "uplink_common" } ],
+        inherit_from     => [ "VC-noCE-common", asm("x86_asm") ],
         CFLAGS           => add("/WX"),
         AS               => sub { vc_win32_info()->{AS} },
         ASFLAGS          => sub { vc_win32_info()->{ASFLAGS} },
@@ -1308,7 +1304,7 @@ my %targets = (
         asflags          => sub { vc_win32_info()->{asflags} },
         sys_id           => "WIN32",
         bn_ops           => add("BN_LLONG"),
-        uplink_arch      => 'x86',
+        uplink_arch      => 'common',
         perlasm_scheme   => sub { vc_win32_info()->{perlasm_scheme} },
         # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
         # some installation path heuristics in windows-makefile.tmpl...
@@ -1379,13 +1375,11 @@ my %targets = (
         shared_target    => "mingw-shared",
         shared_cppflags  => add("_WINDLL"),
         shared_ldflag    => "-static-libgcc",
-        apps_aux_src     => add("win32_init.c"),
 
         perl_platform    => 'mingw',
     },
     "mingw" => {
-        inherit_from     => [ "mingw-common", asm("x86_asm"),
-                              sub { $disabled{uplink} ? () : "x86_uplink" } ],
+        inherit_from     => [ "mingw-common", asm("x86_asm") ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         cflags           => "-m32",
         sys_id           => "MINGW32",
@@ -1730,8 +1724,6 @@ my %targets = (
 
         disable          => add('pinshared'),
 
-        apps_aux_src     => "vms_term_sock.c vms_decc_argv.c",
-        apps_init_src    => "vms_decc_init.c",
     },
 
     # From HELP CC/POINTER_SIZE:

+ 1 - 2
Configurations/50-masm.conf

@@ -9,8 +9,7 @@
 
 my %targets = (
     "VC-WIN64A-masm" => {
-        inherit_from    => [ "VC-WIN64-common", asm("x86_64_asm"),
-                             sub { $disabled{shared} ? () : "x86_64_uplink" } ],
+        inherit_from    => [ "VC-WIN64-common", asm("x86_64_asm") ],
         AS              => "ml64",
         ASFLAGS         => "/nologo /Zi",
         asoutflag       => "/Fo",

+ 0 - 8
Configurations/README

@@ -238,14 +238,6 @@ In each table entry, the following keys are significant:
                                                 export vars as
                                                 accessor functions.
 
-        apps_aux_src    => Extra source to build apps/openssl and other
-                           apps, as needed by the target and that can be
-                           collected in a library.
-        apps_init_src   => Init source to build apps/openssl and other
-                           apps, as needed by the target.  This code
-                           cannot be placed in a library, as the rest
-                           of the code isn't expected to link to it
-                           explicitly.
         cpuid_asm_src   => assembler implementation of cpuid code as
                            well as OPENSSL_cleanse().
                            Default to mem_clr.c

+ 0 - 2
Configure

@@ -3431,9 +3431,7 @@ sub print_table_entry
         "loutflag",
         "ex_libs",
         "bn_ops",
-        "apps_aux_src",
         "cpuid_asm_src",
-        "uplink_aux_src",
         "bn_asm_src",
         "ec_asm_src",
         "des_asm_src",

+ 34 - 15
apps/build.info

@@ -1,4 +1,25 @@
-{- our @apps_openssl_src =
+# Program init source, that don't have direct linkage with the rest of the
+# source, and can therefore not be part of a library.
+IF[{- !$disabled{uplink} -}]
+  $INITSRC=../ms/applink.c
+ENDIF
+IF[{- $config{target} =~ /^vms-/ -}]
+  $INITSRC=vms_decc_init.c
+ENDIF
+
+# Auxilliary program source
+IF[{- $config{target} =~ /^(?:VC-|mingw)/ -}]
+  # It's called 'init', but doesn't have much 'init' in it...
+  $AUXLIBAPPSSRC=win32_init.c
+ENDIF
+IF[{- $config{target} =~ /^vms-/ -}]
+  $AUXLIBAPPSSRC=vms_term_sock.c vms_decc_argv.c
+ENDIF
+
+# Source for the 'openssl' program
+# We need the perl variable for the DEPEND generator further down.
+$OPENSSLSRC={-
+   our @opensslsrc =
        qw(openssl.c
           asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c dhparam.c
           dsa.c dsaparam.c ec.c ecparam.c enc.c engine.c errstr.c gendsa.c
@@ -7,30 +28,28 @@
           rsautl.c 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
           info.c);
-   our @apps_lib_src =
-       ( qw(apps.c apps_ui.c opt.c fmt.c s_cb.c s_socket.c app_rand.c
-            bf_prefix.c),
-         split(/\s+/, $target{apps_aux_src}) );
-   our @apps_init_src = split(/\s+/, $target{apps_init_src});
-   "" -}
+   join(' ', @opensslsrc); -}
+# Source for libapps
+$LIBAPPSSRC=apps.c apps_ui.c opt.c fmt.c s_cb.c s_socket.c app_rand.c \
+        bf_prefix.c
+
 IF[{- !$disabled{apps} -}]
   LIBS{noinst}=libapps.a
-  SOURCE[libapps.a]={- join(" ", @apps_lib_src) -}
+  SOURCE[libapps.a]=$LIBAPPSSRC $AUXLIBAPPSSRC
   INCLUDE[libapps.a]=.. ../include include
 
   PROGRAMS=openssl
-  SOURCE[openssl]={- join(" ", @apps_init_src) -}
-  SOURCE[openssl]={- join(" ", @apps_openssl_src) -}
+  SOURCE[openssl]=$INITSRC $OPENSSLSRC
   INCLUDE[openssl]=.. ../include include
   DEPEND[openssl]=libapps.a ../libssl
 
-IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
-  GENERATE[openssl.rc]=../util/mkrc.pl openssl
-  SOURCE[openssl]=openssl.rc
-ENDIF
+  IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+    GENERATE[openssl.rc]=../util/mkrc.pl openssl
+    SOURCE[openssl]=openssl.rc
+  ENDIF
 
   {- join("\n  ", map { (my $x = $_) =~ s|\.c$|.o|; "DEPEND[$x]=progs.h" }
-                  @apps_openssl_src) -}
+                  @opensslsrc) -}
   GENERATE[progs.h]=progs.pl $(APPS_OPENSSL)
   DEPEND[progs.h]=../configdata.pm
 

+ 17 - 1
crypto/build.info

@@ -8,6 +8,21 @@ SUBDIRS=objects buffer bio stack lhash rand evp asn1 pem x509 conf \
         err comp ocsp cms ts srp cmac ct async kmac ess crmf cmp
 
 LIBS=../libcrypto
+
+$UPLINKSRC=
+$UPLINKDEF=
+IF[{- !$disabled{uplink} -}]
+  $UPLINKSRC_common=../ms/uplink.c
+  $UPLINKSRC_x86=$UPLINKSRC_common uplink-x86.s
+  $UPLINKSRC_x86_64=$UPLINKSRC_common uplink-x86_64.s
+  $UPLINKSRC_ia64=$UPLINKSRC_common uplink-ia64.s
+
+  IF[$UPLINKSRC_{- $target{uplink_arch} -}]
+    $UPLINKSRC=$UPLINKSRC_{- $target{uplink_arch} -}
+    $UPLINKDEF=OPENSSL_USE_APPLINK
+  ENDIF
+ENDIF
+
 # The Core
 $CORE_COMMON=provider_core.c provider_predefined.c core_fetch.c core_namemap.c
 
@@ -23,7 +38,8 @@ $UTIL_COMMON=\
 SOURCE[../libcrypto]=$UTIL_COMMON \
         mem_dbg.c cversion.c info.c cpt_err.c ebcdic.c uid.c o_time.c o_dir.c \
         o_fopen.c getenv.c o_init.c o_fips.c init.c trace.c provider.c \
-        {- $target{uplink_aux_src} -}
+        $UPLINKSRC
+DEFINE[../libcrypto]=$UPLINKDEF
 SOURCE[../providers/fips]=$UTIL_COMMON
         
 

+ 17 - 12
test/build.info

@@ -1,15 +1,20 @@
 SUBDIRS=ossl_shim
-{-
-     use File::Spec::Functions;
-     sub rebase_files
-     {
-         my ($base, $files) = @_;
-         return join(" ", map { "$base/$_" } split(/\s+/, $files));
-     }
-     our $apps_aux_src =
-         join(' ', map { "../apps/$_" } split(/\s+/, $target{apps_aux_src}));
-     ""
--}
+
+# TODO: use ../apps/libapps.a instead of direct ../apps source.
+# This can't currently be done, because some of its units drag in too many
+# unresolved references that don't apply here.  Most of all, ../apps/apps.c
+# needs to be divided in smaller pieces to be useful here.
+#
+# Auxilliary program source (copied from ../apps/build.info)
+IF[{- $config{target} =~ /^(?:VC-|mingw)/ -}]
+  # It's called 'init', but doesn't have much 'init' in it...
+  $AUXLIBAPPSSRC=../apps/win32_init.c
+ENDIF
+IF[{- $config{target} =~ /^vms-/ -}]
+  $AUXLIBAPPSSRC=../apps/vms_term_sock.c ../apps/vms_decc_argv.c
+ENDIF
+$LIBAPPSSRC=../apps/opt.c $AUXLIBAPPSSRC
+
 IF[{- !$disabled{tests} -}]
   LIBS{noinst,has_main}=libtestutil.a
   SOURCE[libtestutil.a]=testutil/basic_output.c testutil/output_helpers.c \
@@ -17,7 +22,7 @@ IF[{- !$disabled{tests} -}]
           testutil/format_output.c testutil/tap_bio.c \
           testutil/test_cleanup.c testutil/main.c testutil/init.c \
           testutil/options.c testutil/test_options.c \
-          testutil/apps_mem.c ../apps/opt.c {- $apps_aux_src; -}
+          testutil/apps_mem.c $LIBAPPSSRC
   INCLUDE[libtestutil.a]=../include ../apps/include ..
   DEPEND[libtestutil.a]=../libcrypto