You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/04/02 11:17:41 UTC

cvs commit: modperl-2.0 Makefile.PL

dougm       01/04/02 02:17:41

  Modified:    .        Makefile.PL
  Log:
  hook into test stuff
  
  Revision  Changes    Path
  1.30      +23 -1     modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Makefile.PL	2001/03/27 02:32:49	1.29
  +++ Makefile.PL	2001/04/02 09:17:40	1.30
  @@ -3,15 +3,20 @@
   use warnings FATAL => 'all';
   
   use lib qw(lib);
  +use Config;
   use Apache::Build ();
   use ModPerl::Code ();
   use ModPerl::MM ();
   
  +use lib qw(Apache-Test/lib);
  +use Apache::TestMM qw(test);
  +
   our $VERSION;
   
   my $build = Apache::Build->new(init => 1);
   my $code  = ModPerl::Code->new;
   
  +my @scripts = qw(t/TEST);
   configure();
   
   ModPerl::MM::WriteMakefile(
  @@ -58,6 +63,10 @@
       #ModPerl::MM will use Apache::BuildConfig in subdir/Makefile.PL's
       $build->save;
   
  +    for (@scripts) {
  +        generate_script($_);
  +    }
  +
       generate_xs($httpd_version) if $build->{MP_GENERATE_XS};
   }
   
  @@ -103,6 +112,19 @@
       shift @INC;
   }
   
  +sub generate_script {
  +    my $file = shift;
  +    open my $in, "$file.PL" or die "Couldn't open $file.PL: $!";
  +    open my $out, '>', $file or die "Couldn't open $file: $!";
  +    print "generating script...$file\n";
  +    print $out "#!$Config{perlpath}\n",
  +               "# WARNING: this file is generated, edit $file.PL instead\n",
  +               join '', <$in>;
  +    close $out or die "close $file: $!";
  +    close $in;
  +    chmod 0544, $file;
  +}
  +
   sub echo_cmd {
       my $cmd = shift;
       print "$cmd\n";
  @@ -112,7 +134,7 @@
   sub clean_files {
       my $path = $code->path;
   
  -    return [@{ $build->clean_files },
  +    return [@{ $build->clean_files }, @scripts,
         map { "$path/$_"} @{ $code->clean_files }];
   }