Configuration: move the handling of zlib_include to config files
authorRichard Levitte <levitte@openssl.org>
Thu, 8 Feb 2018 22:26:22 +0000 (23:26 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 9 Feb 2018 13:27:31 +0000 (14:27 +0100)
It was a bit absurd to have this being specially handled in the build
file templates, especially that we have the 'includes' attribute.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5296)

Configurations/00-base-templates.conf
Configurations/10-main.conf
Configurations/descrip.mms.tmpl
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl

index 0d0f8b8a7f4a403d23a0e7a766e87d4a31aaf0a3..951aeaa599cc358cd88efb851984d952c0039aa1 100644 (file)
@@ -7,6 +7,7 @@ my %targets=(
        cppflags        => "",
        lflags          => "",
        defines         => [],
+       includes        => [],
        thread_scheme   => "(unknown)", # Assume we don't know
        thread_defines  => [],
 
@@ -70,6 +71,13 @@ my %targets=(
                 push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
                 return [ @defs ];
             },
+        includes        =>
+            sub {
+                my @incs = ();
+                push @incs, $withargs{zlib_include}
+                    if !$disabled{zlib} && $withargs{zlib_include};
+                return [ @incs ];
+            },
     },
 
     BASE_unix => {
@@ -129,6 +137,16 @@ my %targets=(
         inherit_from    => [ "BASE_common" ],
         template        => 1,
 
+        includes        =>
+            add(sub {
+                    my @incs = ();
+                    # GNV$ZLIB_INCLUDE is the standard logical name for later
+                    # zlib incarnations.
+                    push @incs, 'GNV$ZLIB_INCLUDE:'
+                        if !$disabled{zlib} && !$withargs{zlib_include};
+                    return [ @incs ];
+                }),
+
         build_file       => "descrip.mms",
         build_scheme     => [ "unified", "VMS" ],
     },
index 70b01046e7b008157f0d5a5eedcb4229f0c18ddd..b17a7803b3249fb4586c86063ecdf7dee8bcee70 100644 (file)
@@ -580,7 +580,7 @@ my %targets = (
         cc               => "gcc",
         cflags           => "-O3",
         cppflags         => "-D_ENDIAN -DBN_DIV2W -D_POSIX_SOURCE -D_SOCKET_SOURCE",
-        includes         => [ "/SYSLOG/PUB" ],
+        includes         => add("/SYSLOG/PUB"),
         sys_id           => "MPE",
         lflags           => add("-L/SYSLOG/PUB"),
         ex_libs          => add("-lsyslog -lsocket -lcurses"),
@@ -1444,10 +1444,11 @@ my %targets = (
                                 "NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT" ],
                    debug   => [ "DEBUG", "_DEBUG" ]),
         includes         =>
-            combine(sub { defined(env('WCECOMPAT'))
-                          ? '$(WCECOMPAT)/include' : (); },
-                    sub { defined(env('PORTSDK_LIBPATH'))
-                          ? '$(PORTSDK_LIBPATH)/../../include' : (); }),
+            add(combine(sub { defined(env('WCECOMPAT'))
+                              ? '$(WCECOMPAT)/include' : (); },
+                        sub { defined(env('PORTSDK_LIBPATH'))
+                                  ? '$(PORTSDK_LIBPATH)/../../include'
+                                  : (); })),
         lflags           => add(combine("/nologo /opt:ref",
                                         sub { vc_wince_info()->{lflags}; },
                                         sub { defined(env('PORTSDK_LIBPATH'))
index 2b2e4d04cb58512cbfb790c3295ae7f1f66bb65b..e3b1700fc18341b9de662749f4b604b42294fddb 100644 (file)
@@ -640,13 +640,6 @@ EOF
       $cflags .= '/DEFINE=('.$defines.')';
       $cflags .= "/INCLUDE=('tmp_includes')";
       
-      my @incs = ();
-      push @incs, @{$args{incs}} if @{$args{incs}};
-      unless ($disabled{zlib}) {
-          # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
-          # incarnations.
-          push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
-      }
       # We create a logical name TMP_INCLUDES: to hold the list of internal
       # includes.  However, we cannot use it directly, as logical names can't
       # hold zero entries, so we also create a symbol with the same name and
@@ -666,13 +659,13 @@ EOF
           ."\n\t".$incs_add;
       my $incs_off = 'DELETE/SYMBOL/LOCAL tmp_includes'
           ."\n\t".'DELETE/SYMBOL/LOCAL tmp_add';
-      if (@incs) {
+      if (@{$args{incs}}) {
           $incs_on =
               'DEFINE tmp_includes '
               .join(",-\n\t\t\t", map {
                                       file_name_is_absolute($_)
                                       ? $_ : catdir($backward,$_)
-                                  } @incs)
+                                  } @{$args{incs}})
               ."\n\t".$incs_on
               ."\n\t".'IF tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
               ."\n\t".'tmp_includes = "tmp_includes:" + tmp_includes';
index 9e05fd1d5f785decca117b0f2247143ae77c294e..3c80fec37b7b1ff3f41d4e4babf7ff14cacb9573 100644 (file)
@@ -891,11 +891,6 @@ EOF
       my $srcs = join(" ",  @srcs);
       my $deps = join(" ", @srcs, @{$args{deps}});
       my $incs = join("", map { " -I".$_ } @{$args{incs}});
-      unless ($disabled{zlib}) {
-          if ($withargs{zlib_include}) {
-              $incs .= " -I".$withargs{zlib_include};
-          }
-      }
       my $cmd = '$(CC)';
       my $cmdflags = '$(CFLAGS)';
       my $cmdcompile = ' -c';
index 0abe6eaa536e5c9833811a1eb2e73c7da13ded89..86bc0869b96b2d1bc5ce539b53a4609b9e0f4ba6 100644 (file)
@@ -466,11 +466,6 @@ EOF
      my $srcs = '"'.join('" "',  @srcs).'"';
      my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
      my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}});
-     unless ($disabled{zlib}) {
-         if ($withargs{zlib_include}) {
-             $incs .= ' /I "'.$withargs{zlib_include}.'"';
-         }
-     }
      my $cflags = '$(CFLAGS)';
      $cflags .= { lib => ' $(LIB_CFLAGS)',
                  dso => ' $(DSO_CFLAGS)',