Build file templates: additional information to build file template functions
authorRichard Levitte <levitte@openssl.org>
Thu, 8 Sep 2016 16:09:47 +0000 (18:09 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 8 Sep 2016 22:12:54 +0000 (00:12 +0200)
Send a bit information to the build file template functions.  For
src2obj(), the additional option 'product' holds the name of the final
file that the object file will go into.  Additionally, the diverse
functions will get the option 'installed', with a value that evaluates
true if the final product is to be installed, otherwise false.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Configurations/common.tmpl

index 9d7fbf2e77bc7029c71e56883f638373296c1758..d811a2a144651f8c1ef190a171f535f1594ce9f2 100644 (file)
      @newlist;
  }
 
+ # is_installed checks if a given file will be installed (i.e. they are
+ # not defined _NO_INST in build.info)
+ sub is_installed {
+     my $product = shift;
+     if (grep { $product eq $_ }
+         map { (@{$unified_info{install}->{$_}}) }
+         keys %{$unified_info{install}}) {
+         return 1;
+     }
+     return 0;
+ }
+
  # dogenerate is responsible for producing all the recipes that build
  # generated source files.  It recurses in case a dependency is also a
  # generated source file.
@@ -72,6 +84,7 @@
      my %opts = @_;
      if (@{$unified_info{sources}->{$obj}}) {
          $OUT .= src2obj(obj => $obj_no_o,
+                         product => $bin,
                          srcs => $unified_info{sources}->{$obj},
                          deps => $unified_info{depends}->{$obj},
                          incs => [ @{$unified_info{includes}->{$bin}},
                                         (@{$unified_info{sources}->{$lib}},
                                          @{$unified_info{shared_sources}->{$lib}}) ],
                               deps => [ reducedepends(resolvedepends($lib)) ],
+                              installed => is_installed($lib),
                               %ordinals);
          foreach (@{$unified_info{shared_sources}->{$lib}}) {
-             doobj($_, $lib, intent => "lib");
+             doobj($_, $lib, intent => "lib", installed => is_installed($lib));
          }
      }
      $OUT .= obj2lib(lib => $lib,
                      objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
                                (@{$unified_info{sources}->{$lib}},
                                 @{$unified_info{shared_sources}->{$lib}}) ],
-                     deps => [ resolvedepends($lib) ]);
+                     deps => [ resolvedepends($lib) ],
+                     installed => is_installed($lib));
      foreach ((@{$unified_info{sources}->{$lib}},
                @{$unified_info{shared_sources}->{$lib}})) {
-         doobj($_, $lib, intent => "dso");
+         doobj($_, $lib, intent => "dso", installed => is_installed($lib));
      }
      $cache{$lib} = 1;
  }
      $OUT .= obj2bin(bin => $bin,
                      objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
                                @{$unified_info{sources}->{$bin}} ],
-                     deps => $deps);
+                     deps => $deps,
+                     installed => is_installed($bin));
      foreach (@{$unified_info{sources}->{$bin}}) {
-         doobj($_, $bin, intent => "bin");
+         doobj($_, $bin, intent => "bin", installed => is_installed($bin));
      }
      $cache{$bin} = 1;
  }
      my $script = shift;
      return "" if $cache{$script};
      $OUT .= in2script(script => $script,
-                       sources => $unified_info{sources}->{$script});
+                       sources => $unified_info{sources}->{$script},
+                       installed => is_installed($script));
      $cache{$script} = 1;
  }