perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@locus.apache.org
Subject cvs commit: modperl-2.0/src/modules/perl .cvsignore
Date Fri, 21 Apr 2000 19:43:38 GMT
dougm       00/04/21 12:43:38

  Modified:    .        00README_FIRST Makefile.PL
               lib/Apache Build.pm
               lib/ModPerl Code.pm
               src/modules/perl .cvsignore
  Log:
  get some decent build stuff in place
  
  Revision  Changes    Path
  1.3       +27 -3     modperl-2.0/00README_FIRST
  
  Index: 00README_FIRST
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/00README_FIRST,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- 00README_FIRST	2000/04/18 00:29:52	1.2
  +++ 00README_FIRST	2000/04/21 19:43:33	1.3
  @@ -16,19 +16,34 @@
   mod_perl-2.0 will still work with an out-of-the-box Perl, but will
   only be useful if your mpm is prefork (which is much like 1.3.x)
   
  -in either case, in this directory run:
  +to build mod_perl static:
   
  -% perl Makefile.PL -c -ma
  +% perl Makefile.PL && make libmodperl.a
   
   % cd ../apache-2.0/src
   % ./configure --prefix=$HOME/apache-2.0 --with-mpm=mpmt_pthread
   % patch -p1 < ../modperl-2.0/patches/link-hack.pat
   % make
   
  +to build mod_perl dynamic:
  +
  +% perl Makefile.PL && make libmodperl.so
  +
  +(note the dso-link-hack.pat is need for my suse-6.1, might be
  +different for your platform)
  +
  +% cd ../apache-2.0/src
  +% ./configure --prefix=$HOME/apache-2.0 --with-mpm=mpmt_pthread
  +% patch -p1 < ../modperl-2.0/patches/dso-link-hack.pat
  +% make
  +
   as for httpd.conf, mine looks something like so at the moment:
   
   #same as using the MOD_PERL_TRACE environment variable
   
  +#if dynamic build
  +LoadModule perl_module libexec/libmodperl.so
  +
   PerlTrace all
   
   #only with -Dusethreads
  @@ -39,5 +54,14 @@
   #directive passes arbitrary command line switches to perl
   
   PerlSwitches -T /home/dougm/test/startup.pl
  +
  +it is possible to configure Perl*Handlers, but there is not yet an
  +interface back into Apache, e.g.
  +
  +PerlLogHandler MyLog::handler
  +
  +sub MyLog::handler {
  +    warn "hey, it works!";
  +}
   
  ---dougm 04/17
  +--dougm 04/21
  
  
  
  1.11      +58 -27    modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Makefile.PL	2000/04/20 18:28:14	1.10
  +++ Makefile.PL	2000/04/21 19:43:33	1.11
  @@ -3,6 +3,7 @@
   use warnings;
   
   use ExtUtils::Embed ();
  +use ExtUtils::MakeMaker qw(WriteMakefile);
   
   use lib qw(lib);
   use Apache::Build ();
  @@ -13,18 +14,21 @@
   my $build = Apache::Build->new;
   my $code  = ModPerl::Code->new;
   
  -#quick hack until build system is complete
  -#e.g.
  -#perl Makefile.PL -c -ma MP_DEBUG=1 (configure and 'make all' debug mode)
  -#perl Makefile.PL -mc    (make clean)
  -{
  -    use Getopt::Std;
  -    my %opts;
  -    getopts('Ecm:', \%opts);
  -    configure()  if $opts{c};
  -    make(\%opts) if $opts{m};
  +if ($build->{MP_CPP}) {
  +    make();
  +    exit;
   }
   
  +configure();
  +
  +WriteMakefile(
  +    NAME => 'mod_perl',
  +    VERSION => $VERSION,
  +    clean => {
  +        FILES => "@{ clean_files() }",
  +    },
  +);
  +
   sub configure {
       system_sanity_check();
       set_modperl_version();
  @@ -46,6 +50,8 @@
       $build->save_ldopts;
   
       $code->generate;
  +
  +    $build->write_src_makefile;
   }
   
   sub echo_cmd {
  @@ -55,23 +61,18 @@
   }
   
   sub make {
  -    my $opts = shift;
  -    return clean() if $opts->{m} eq 'c';
  -
       my $ccopts = $build->ccopts;
       my @inc = $build->inc;
  -    my($cc, $ar) = map { $build->perl_config($_) } qw(cc ar);
  +    my $cc = $build->perl_config('cc');
   
       chdir $code->path;
   
  -    $ccopts .= " -E" if $opts->{E};
  +    $ccopts .= " -E" if $build->{MP_CPP};
   
       for (sort { (stat $b)[9] <=> (stat $a)[9] } @{ $code->c_files }) {
           echo_cmd "$cc $ccopts @inc -c $_";
       }
   
  -    echo_cmd "$ar crv libmodperl.a @{ $code->o_files }";
  -
       chdir $build->cwd;
   }
   
  @@ -81,17 +82,11 @@
       unlink $file;
   }
   
  -sub clean {
  -    for ($build->clean_files) {
  -        echo_unlink $_;
  -    }
  +sub clean_files {
  +    my $path = $code->path;
   
  -    chdir $code->path;
  -    my @files = $code->clean_files;
  -    for (@files, <*.o>, <*.a>) {
  -        echo_unlink $_;
  -    }
  -    chdir $build->cwd;
  +    return [@{ $build->clean_files },
  +      map { "$path/$_"} @{ $code->clean_files }];
   }
   
   sub set_modperl_version {
  @@ -150,3 +145,39 @@
       }
   }
   
  +sub MY::top_targets {
  +    my $self = shift;
  +    my $string = $self->MM::top_targets;
  +    my $path = $code->path;
  +
  +    for (qw(SHARED STATIC)) {
  +        $string .= <<EOF;
  +
  +$build->{"MODPERL_LIB_$_"}:
  +	@(cd $path && \$(MAKE) \$\@);
  +
  +EOF
  +    }
  +
  +    $string;
  +}
  +
  +sub MY::clean {
  +    my $self = shift;
  +    my $string = $self->MM::clean(@_);
  +    my $path = $code->path;
  +    $string .= "\t-cd $path && \$(MAKE) clean\n";
  +    $string;
  +}
  +
  +sub MY::postamble {
  +    my $i = 0;
  +    print "you may now run:\n";
  +
  +    for (qw(SHARED STATIC)) {
  +        print qq(make $build->{"MODPERL_LIB_$_"}\n);
  +        print " - or - \n" unless $i++;
  +    }
  +
  +    '';
  +}
  
  
  
  1.10      +111 -2    modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Build.pm	2000/04/21 07:13:57	1.9
  +++ Build.pm	2000/04/21 19:43:34	1.10
  @@ -6,6 +6,8 @@
   use Config;
   use Cwd ();
   use ExtUtils::Embed ();
  +use ModPerl::Code ();
  +
   use constant is_win32 => $^O eq 'MSWin32';
   use constant IS_MOD_PERL_BUILD => grep { -e "$_/lib/mod_perl.pm" } qw(. ..);
   
  @@ -106,7 +108,6 @@
       return $Config{$key} ? $Config{$key} : '';
   }
   
  -
   sub find_in_inc {
       my $name = shift;
       for (@INC) {
  @@ -280,6 +281,7 @@
       my $self = bless {
           cwd => Cwd::fastcwd(),
           param_qr => qr([\s=]+),
  +        MP_LIBNAME => 'libmodperl',
           @_,
       }, $class;
   
  @@ -298,11 +300,12 @@
   my %default_files = (
       'build_config' => 'lib/Apache/BuildConfig.pm',
       'ldopts' => 'src/modules/perl/ldopts',
  +    'makefile' => 'src/modules/perl/Makefile',
   );
   
   sub clean_files {
       my $self = shift;
  -    map { $self->default_file($_) } keys %default_files;
  +    [map { $self->default_file($_) } keys %default_files];
   }
   
   sub default_file {
  @@ -562,6 +565,112 @@
       close $fh;
   
       $self->httpd_version_cache($dir, $version);
  +}
  +
  +#--- generate Makefile ---
  +
  +sub canon_make_attr {
  +    my($self, $name) = (shift, shift);
  +
  +    my $attr = join '_', 'MODPERL', uc $name;
  +    $self->{$attr} = "@_";
  +    "$attr = $self->{$attr}\n\n";
  +}
  +
  +my @perl_config_pm =
  +  qw(cc ld ar rm ranlib lib_ext dlext cccdlflags lddlflags optimize);
  +
  +sub write_src_makefile {
  +    my $self = shift;
  +    my $code = ModPerl::Code->new;
  +    my $path = $code->path;
  +
  +    my $mf = $self->default_file('makefile');
  +
  +    open my $fh, '>', $mf or die "open $mf: $!";
  +
  +    for (@perl_config_pm) {
  +        print $fh $self->canon_make_attr($_, $self->perl_config($_));
  +    }
  +
  +    print $fh $self->canon_make_attr('RM_F' => #XXX
  +                                     $self->{MODPERL_RM} . ' -f');
  +
  +    print $fh $self->canon_make_attr('libname', $self->{MP_LIBNAME});
  +
  +    print $fh $self->canon_make_attr('lib_shared',
  +                       "$self->{MP_LIBNAME}.$self->{MODPERL_DLEXT}");
  +
  +    print $fh $self->canon_make_attr('lib_static',
  +                       "$self->{MP_LIBNAME}$self->{MODPERL_LIB_EXT}");
  +
  +    print $fh $self->canon_make_attr('xsubpp',
  +                                     join '/', 
  +                                     $self->perl_config('privlibexp'),
  +                                    'xsubpp');
  +
  +    for my $method (qw(ccopts ldopts inc)) {
  +        print $fh $self->canon_make_attr($method, $self->$method());
  +    }
  +
  +    for my $method (qw(c_files o_files o_pic_files)) {
  +        print $fh $self->canon_make_attr($method, @{ $code->$method() });
  +    }
  +
  +    print $fh <<'EOF';
  +
  +MODPERL_LIB=$(MODPERL_LIBNAME)$(MODPERL_LIB_EXT)
  +
  +all: lib
  +
  +lib: $(MODPERL_LIB)
  +
  +MODPERL_CCFLAGS = $(MODPERL_INC) $(MODPERL_CCOPTS) $(MODPERL_OPTIMIZE)
  +
  +MODPERL_CCFLAGS_SHLIB = $(MODPERL_CCFLAGS) $(MODPERL_CCCDLFLAGS)
  +
  +$(MODPERL_LIBNAME)$(MODPERL_LIB_EXT): $(MODPERL_O_FILES)
  +	$(MODPERL_RM_F) $@
  +	$(MODPERL_AR) crv $@ $(MODPERL_O_FILES)
  +	$(MODPERL_RANLIB) $@
  +
  +$(MODPERL_LIBNAME).$(MODPERL_DLEXT): $(MODPERL_O_PIC_FILES)
  +	$(MODPERL_RM_F) $@
  +	$(MODPERL_LD) $(MODPERL_LDDLFLAGS) -o $@ \
  +	$(MODPERL_O_PIC_FILES) $(MODPERL_LDOPTS)
  +	$(MODPERL_RANLIB) $@
  +
  +.SUFFIXES: .xs .c .o .lo
  +
  +.c.lo:
  +	$(MODPERL_CC) $(MODPERL_CCFLAGS_SHLIB) \
  +	-c $< && mv $*.o $*.lo
  +
  +.c.o:
  +	$(MODPERL_CC) $(MODPERL_CCFLAGS) -c $<
  +
  +.xs.c:
  +	$(MODPERL_XSUBPP) $*.xs >$@
  +
  +.xs.o:
  +	$(MODPERL_XSUBPP) $*.xs >$*.c
  +	$(MODPERL_CC) $(MODPERL_CCFLAGS) -c $*.c
  +
  +.xs.lo:
  +	$(MODPERL_XSUBPP) $*.xs >$*.c
  +	$(MODPERL_CC) $(MP_CCFLAGS_SHLIB) -c $*.c && mv $*.o $*.lo
  +
  +clean:
  +	$(MODPERL_RM_F) *.a *.so
  +	$(MODPERL_RM_F) $(MODPERL_O_FILES)
  +	$(MODPERL_RM_F) $(MODPERL_O_FILES)
  +	$(MODPERL_RM_F) $(MODPERL_O_PIC_FILES)
  +	$(MODPERL_RM_F) $(MODPERL_CLEAN_FILES)
  +
  +$(MODPERL_O_FILES): Makefile
  +EOF
  +
  +    close $fh;
   }
   
   #--- generate MakeMaker parameter values ---
  
  
  
  1.14      +2 -1      modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Code.pm	2000/04/21 05:20:14	1.13
  +++ Code.pm	2000/04/21 19:43:36	1.14
  @@ -381,11 +381,12 @@
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names), @g_c_names);
   sub c_files { [map { "$_.c" } @c_names] }
   sub o_files { [map { "$_.o" } @c_names] }
  +sub o_pic_files { [map { "$_.lo" } @c_names] }
   
   my @g_h_names = map { "modperl_$_" } qw(hooks directives flags trace);
   
   sub clean_files {
  -    (map { "$_.c" } @g_c_names), (map { "$_.h" } @g_h_names);
  +    [(map { "$_.c" } @g_c_names), (map { "$_.h" } @g_h_names)];
   }
   
   sub noedit_warning {
  
  
  
  1.4       +5 -0      modperl-2.0/src/modules/perl/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/.cvsignore,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- .cvsignore	2000/04/17 21:30:29	1.3
  +++ .cvsignore	2000/04/21 19:43:37	1.4
  @@ -6,3 +6,8 @@
   modperl_trace.h
   modperl_xsinit.c
   ldopts
  +Makefile
  +*.lo
  +*.o
  +*.a
  +*.so
  
  
  

Mime
View raw message