Make build.info INCLUDE stmts be both source and build tree relative
authorRichard Levitte <levitte@openssl.org>
Wed, 29 Jun 2016 20:51:42 +0000 (22:51 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 1 Jul 2016 16:34:21 +0000 (18:34 +0200)
INCLUDE statements in build.info files were source tree centric.  That
meant that to get include directory specs in the build tree, we had to
resort to perl fragments that specified the build tree include paths
as absolute ones.

This change has the INCLUDE statement consider both the source and
build tree for any include directory.  It means that there may be some
extra unnecessary include paths, but it also makes life simpler for
anyone who makes changes in the build.info files.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Configure

index 17d7063dba90cd89b0332d2dffd8f5ce685a8d4b..f8a6ec2e846b531eafaf897c5e6c054cf7cdd740 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1713,8 +1713,8 @@ EOF
                 # sure it can get included
                 if ($dest ne "" && $d =~ /\.(h|pm)$/) {
                     my $i = dirname($d);
                 # sure it can get included
                 if ($dest ne "" && $d =~ /\.(h|pm)$/) {
                     my $i = dirname($d);
-                    push @{$unified_info{includes}->{$ddest}}, $i
-                        unless grep { $_ eq $i } @{$unified_info{includes}->{$ddest}};
+                    push @{$unified_info{includes}->{$ddest}->{source}}, $i
+                        unless grep { $_ eq $i } @{$unified_info{includes}->{$ddest}->{source}};
                 }
             }
         }
                 }
             }
         }
@@ -1732,9 +1732,12 @@ EOF
                 }
             }
             foreach (@{$includes{$dest}}) {
                 }
             }
             foreach (@{$includes{$dest}}) {
-                my $i = cleandir($sourced, $_, $blddir);
-                push @{$unified_info{includes}->{$ddest}}, $i
-                    unless grep { $_ eq $i } @{$unified_info{includes}->{$ddest}};
+                my $is = cleandir($sourced, $_, $blddir);
+                my $ib = cleandir($buildd, $_, $blddir);
+                push @{$unified_info{includes}->{$ddest}->{source}}, $is
+                    unless grep { $_ eq $is } @{$unified_info{includes}->{$ddest}->{source}};
+                push @{$unified_info{includes}->{$ddest}->{build}}, $ib
+                    unless grep { $_ eq $ib } @{$unified_info{includes}->{$ddest}->{build}};
             }
         }
     }
             }
         }
     }
@@ -1751,6 +1754,22 @@ EOF
                 [ sort keys %{$unified_info{$l1}->{$l2}} ];
         }
     }
                 [ sort keys %{$unified_info{$l1}->{$l2}} ];
         }
     }
+    # Includes
+    foreach my $dest (sort keys %{$unified_info{includes}}) {
+        if (defined($unified_info{includes}->{$dest}->{build})) {
+            my @source_includes =
+                ( @{$unified_info{includes}->{$dest}->{source}} );
+            $unified_info{includes}->{$dest} =
+                [ @{$unified_info{includes}->{$dest}->{build}} ];
+            foreach my $inc (@source_includes) {
+                push @{$unified_info{includes}->{$dest}}, $inc
+                    unless grep { $_ eq $inc } @{$unified_info{includes}->{$dest}};
+            }
+        } else {
+            $unified_info{includes}->{$dest} =
+                [ @{$unified_info{includes}->{$dest}->{source}} ];
+        }
+    }
 }
 
 # For the schemes that need it, we provide the old *_obj configs
 }
 
 # For the schemes that need it, we provide the old *_obj configs