stas        01/10/04 03:51:46

  Modified:    .        Makefile.PL
  Log:
  - allow remote dirs to be included in the make process
  - needed to override the DIR parameter and therefore duplicate parts from
  MM::init_dirscan, to preserve original functionality (to search immediate
  sub-dirs for Makefile.PL)
  
  Revision  Changes    Path
  1.40      +26 -0     modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Makefile.PL       2001/09/18 16:05:16     1.39
  +++ Makefile.PL       2001/10/04 10:51:46     1.40
  @@ -8,6 +8,9 @@
   use ModPerl::Code ();
   use ModPerl::MM ();
   
  +use File::Spec::Functions;
  +use DirHandle ();
  +
   use Apache::TestTrace;
   use Apache::TestMM qw(test);
   
  @@ -16,12 +19,15 @@
   my $build = Apache::Build->new(init => 1);
   my $code  = ModPerl::Code->new;
   
  +my @remote_makefile_dirs = qw(docs/src/api/mod_perl-2.0);
  +
   my @scripts = qw(t/TEST);
   configure();
   
   ModPerl::MM::WriteMakefile(
       NAME => 'mod_perl',
       VERSION => $VERSION,
  +    DIR     => get_dirs_with_makefile(@remote_makefile_dirs),
       macro => {
           MODPERL_SRC   => $code->path,
           PERL          => $build->perl_config('perlpath'),
  @@ -191,6 +197,26 @@
      *) Rebuild Perl without malloc pollution (Configure -Ubincompat5005)
   EOF
       }
  +}
  +
  +
  +# by default only Makefile.PL's in the first level sub-dirs are
  +# discovered. If you want to reach a Makefile.PL's in some remote
  +# directories, pass them to this function.
  +sub get_dirs_with_makefile {
  +    my @remove_makefile_dirs = @_;
  +    my %mf_dirs = ();
  +
  +    # since we cannot override MM::init_dirscan, but at the same time
  +    # want to change $self->{DIR}, we have to reproduce
  +    # MM::init_dirscan's section on setting DIR
  +    for my $dir (@remote_makefile_dirs,
  +                 grep {-d} DirHandle->new(curdir())->read) {
  +        next if curdir() eq $dir || updir() eq $dir;
  +        next if -l $dir; # no symlinks per MakeMaker
  +        $mf_dirs{$dir}++ if -f catfile($dir, "Makefile.PL");
  +    }
  +    return [sort keys %mf_dirs];
   }
   
   package MY;
  
  
  


Reply via email to