components/make/patches/32511.patch
changeset 913 646785c43987
equal deleted inserted replaced
912:d98bdeebbbb3 913:646785c43987
       
     1 This diff is taken from git:
       
     2 https://github.com/scfc/gnumake/commit/d952d36acf66398b7fe1e3efa15af73add937ecb
       
     3 minus changes in the 'Changelog' files which don't apply cleanly to our sources
       
     4 
       
     5 and it fixes Savannah bug 32511
       
     6 http://savannah.gnu.org/bugs/?32511
       
     7 
       
     8 diff --git a/ChangeLog b/ChangeLog
       
     9 index 2345823..e2a9786 100644
       
    10 diff --git a/remake.c b/remake.c
       
    11 index 669eadc..5526624 100644
       
    12 --- a/remake.c
       
    13 +++ b/remake.c
       
    14 @@ -1534,8 +1534,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
       
    15    unsigned int liblen;
       
    16  
       
    17    /* Information about the earliest (in the vpath sequence) match.  */
       
    18 -  unsigned int best_vpath, best_path;
       
    19 -  unsigned int std_dirs = 0;
       
    20 +  unsigned int best_vpath = 0, best_path = 0;
       
    21  
       
    22    char **dp;
       
    23  
       
    24 @@ -1554,6 +1553,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
       
    25        static char *buf = NULL;
       
    26        static unsigned int buflen = 0;
       
    27        static int libdir_maxlen = -1;
       
    28 +      static unsigned int std_dirs = 0;
       
    29        char *libbuf = variable_expand ("");
       
    30  
       
    31        /* Expand the pattern using LIB as a replacement.  */
       
    32 diff --git a/tests/scripts/features/vpath3 b/tests/scripts/features/vpath3
       
    33 index 978c5ee..c6ede28 100644
       
    34 --- a/tests/scripts/features/vpath3
       
    35 +++ b/tests/scripts/features/vpath3
       
    36 @@ -1,50 +1,35 @@
       
    37 -#                                                                     -*-perl-*-
       
    38 +#                                                                    -*-perl-*-
       
    39  
       
    40  $description = "Test the interaction of the -lfoo feature and vpath";
       
    41  $details = "";
       
    42  
       
    43 -open(MAKEFILE,"> $makefile");
       
    44 -
       
    45 -# The Contents of the MAKEFILE ...
       
    46 -
       
    47 -print MAKEFILE "vpath %.a a1\n";
       
    48 -print MAKEFILE "vpath %.so b1\n";
       
    49 -print MAKEFILE "vpath % a2 b2\n";
       
    50 -print MAKEFILE "vpath % b3\n";
       
    51 -print MAKEFILE "all: -l1 -l2 -l3; \@echo \$^\n";
       
    52 -
       
    53 -# END of Contents of MAKEFILE
       
    54 -
       
    55 -close(MAKEFILE);
       
    56 -
       
    57 -mkdir("a1", 0777);
       
    58 -mkdir("b1", 0777);
       
    59 -mkdir("a2", 0777);
       
    60 -mkdir("b2", 0777);
       
    61 -mkdir("b3", 0777);
       
    62 -
       
    63 -@files_to_touch = ("a1${pathsep}lib1.a",
       
    64 -		   "b1${pathsep}lib1.so",
       
    65 -		   "a2${pathsep}lib2.a",
       
    66 -		   "b2${pathsep}lib2.so",
       
    67 -		   "lib3.a",
       
    68 -		   "b3${pathsep}lib3.so");
       
    69 +my @dirs_to_make = qw(a1 b1 a2 b2 b3);
       
    70 +for my $d (@dirs_to_make) {
       
    71 +    mkdir($d, 0777);
       
    72 +}
       
    73  
       
    74 +my @files_to_touch = ("a1${pathsep}lib1.a",
       
    75 +                      "a1${pathsep}libc.a",
       
    76 +                      "b1${pathsep}lib1.so",
       
    77 +                      "a2${pathsep}lib2.a",
       
    78 +                      "b2${pathsep}lib2.so",
       
    79 +                      "lib3.a",
       
    80 +                      "b3${pathsep}lib3.so");
       
    81  &touch(@files_to_touch);
       
    82  
       
    83 -&run_make_with_options($makefile,"",&get_logfile);
       
    84 -
       
    85 -# Create the answer to what should be produced by this Makefile
       
    86 -$answer = "a1${pathsep}lib1.a a2${pathsep}lib2.a lib3.a\n";
       
    87 -
       
    88 -if (&compare_output($answer,&get_logfile(1)))
       
    89 -{
       
    90 -  unlink @files_to_touch;
       
    91 -  rmdir("a1");
       
    92 -  rmdir("b1");
       
    93 -  rmdir("a2");
       
    94 -  rmdir("b2");
       
    95 -  rmdir("b3");
       
    96 +run_make_test('
       
    97 +vpath %.h b3
       
    98 +vpath %.a a1
       
    99 +vpath %.so b1
       
   100 +vpath % a2 b2
       
   101 +vpath % b3
       
   102 +all: -l1 -lc -l2 -l3; @echo $^
       
   103 +',
       
   104 +              '', "a1${pathsep}lib1.a a1${pathsep}libc.a a2${pathsep}lib2.a lib3.a\n");
       
   105 +
       
   106 +unlink(@files_to_touch);
       
   107 +for my $d (@dirs_to_make) {
       
   108 +    rmdir($d);
       
   109  }
       
   110  
       
   111  1;