stas        2003/03/23 19:00:20

  Modified:    lib/Apache Build.pm
               lib/ModPerl WrapXS.pm
               .        Changes
  Log:
  adjust the generated Makefile's to properly build on aix (tested on
  powerpc-ibm-aix5.1.0.0)
  
  Revision  Changes    Path
  1.114     +71 -10    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.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- Build.pm  18 Mar 2003 05:48:04 -0000      1.113
  +++ Build.pm  24 Mar 2003 03:00:19 -0000      1.114
  @@ -20,9 +20,12 @@
   use constant HAS_ITHREADS =>
       $Config{useithreads} && ($Config{useithreads} eq 'define');
   
  +use constant AIX    => $^O eq 'aix';
   use constant DARWIN => $^O eq 'darwin';
  -use constant WIN32 => $^O eq 'MSWin32';
  -use constant MSVC  => WIN32() && ($Config{cc} eq 'cl');
  +use constant HPUX   => $^O eq 'hpux';
  +use constant WIN32  => $^O eq 'MSWin32';
  +
  +use constant MSVC => WIN32() && ($Config{cc} eq 'cl');
   
   use constant IS_MOD_PERL_BUILD => grep { -e "$_/lib/mod_perl.pm" } qw(. ..);
   
  @@ -104,6 +107,7 @@
           #if we are building mod_perl via apxs, apxs should already be known
           #these extra tries are for things built outside of mod_perl
           #e.g. libapreq
  +        # XXX: this may pick a wrong apxs version!
           push @trys,
           Apache::TestConfig::which('apxs'),
           '/usr/local/apache/bin/apxs';
  @@ -187,7 +191,7 @@
   
       my $ld = $self->perl_config('ld');
   
  -    if ($^O eq 'hpux' and $ld eq 'ld') {
  +    if (HPUX && $ld eq 'ld') {
           while ($ldopts =~ s/-Wl,(\S+)/$1/) {
               my $cp = $1;
               (my $repl = $cp) =~ s/,/ /g;
  @@ -281,6 +285,11 @@
       $cflags;
   }
   
  +sub ldopts_prefix {
  +    my $self = shift;
  +    $self->perl_config('ld') eq 'ld' ? '' : "-Wl,";
  +}
  +
   sub perl_config_optimize {
       my($self, $val) = @_;
   
  @@ -310,6 +319,33 @@
           }
       }
   
  +    if (AIX) {
  +        my $Wl = $self->ldopts_prefix;
  +
  +        # it's useless to import symbols from libperl.so this way,
  +        # because perl.exp is incomplete. a better way is to link
  +        # against -lperl which has all the symbols
  +        $val =~ s|${Wl}-bI:\$\(PERL_INC\)/perl\.exp||;
  +        # also in the case of Makefile.modperl PERL_INC is defined
  +
  +        # this works with at least ld(1) on powerpc-ibm-aix5.1.0.0:
  +        # -berok ignores symbols resolution problems (they will be
  +        #        resolved at run-time
  +        # -brtl prepares the object for run-time loading
  +        # LDFLAGS already inserts -brtl
  +        $val .= " ${Wl}-berok";
  +        # XXX: instead of -berok, could make sure that we have:
  +        #   -Lpath/to/CORE -lperl
  +        #   -bI:$path/apr.exp -bI:$path/aprutil.exp -bI:$path/httpd.exp
  +        #   -bI:$path/modperl_*.exp 
  +        # - don't import modperl_*.exp in Makefile.modperl which
  +        #   exports -bE:$path/modperl_*.exp
  +        # - can't rely on -bI:$path/perl.exp, because it's incomplete,
  +        #   use -lperl instead
  +        # - the issue with using apr/aprutil/httpd.exp is to pick the
  +        #   right path if httpd wasn't yet installed
  +    }
  +
       $val;
   }
   
  @@ -913,7 +949,18 @@
   
   sub export_files_MSWin32 {
       my $self = shift;
  -    "-def:$self->{cwd}/xs/modperl.def";
  +    my $xs_dir = $self->file_path("xs");
  +    "-def:$xs_dir/modperl.def";
  +}
  +
  +sub export_files_aix {
  +    my $self = shift;
  +
  +    my $Wl = $self->ldopts_prefix;
  +    # there are several modperl_*.exp, not just $(BASEEXT).exp
  +    # $(BASEEXT).exp resolves to modperl_global.exp
  +    my $xs_dir = $self->file_path("xs");
  +    join " ", map "${Wl}-bE:$xs_dir/modperl_$_.exp", qw(inline ithreads);
   }
   
   sub dynamic_link_header_default {
  @@ -945,6 +992,14 @@
              "\t$defs" . ' -out:$@';
   }
   
  +sub dynamic_link_aix {
  +    my $self = shift;
  +    my $link = $self->dynamic_link_header_default .
  +        "\t" . $self->export_files_aix . " \\\n" .
  +        "\t" . '-o $@' . " \n" .
  +        "\t" . '$(MODPERL_RANLIB) $@';
  +}
  +
   sub dynamic_link {
       my $self = shift;
       my $link = \&{"dynamic_link_$^O"};
  @@ -999,6 +1054,11 @@
       print $fh $self->canon_make_attr('libname', $self->{MP_LIBNAME});
       print $fh $self->canon_make_attr('dlext', 'so'); #always use .so
   
  +    if (AIX) {
  +        my $xs_dir = $self->file_path("xs");
  +        print $fh "BASEEXT = $xs_dir/modperl_global\n\n";
  +    }
  +
       my %libs = (
           dso    => "$self->{MP_LIBNAME}.$self->{MODPERL_DLEXT}",
           static => "$self->{MP_LIBNAME}$self->{MODPERL_LIB_EXT}",
  @@ -1121,16 +1181,17 @@
   
   #--- generate MakeMaker parameter values ---
   
  +sub otherldflags_default {
  +    my $self = shift;
  +    # e.g. aix's V:ldflags feeds -brtl and other flags
  +    $self->perl_config('ldflags');
  +}
  +
   sub otherldflags {
       my $self = shift;
       my $flags = \&{"otherldflags_$^O"};
  -    return "" unless defined &$flags;
  +    return $self->otherldflags_default unless defined &$flags;
       $flags->($self);
  -}
  -
  -#XXX: install *.exp / search @INC
  -sub otherldflags_aix {
  -    ""; #XXX: -bI:*.exp files
   }
   
   sub typemaps {
  
  
  
  1.51      +12 -2     modperl-2.0/lib/ModPerl/WrapXS.pm
  
  Index: WrapXS.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- WrapXS.pm 22 Mar 2003 07:21:36 -0000      1.50
  +++ WrapXS.pm 24 Mar 2003 03:00:19 -0000      1.51
  @@ -19,6 +19,8 @@
   my(@xs_includes) = ('mod_perl.h',
                       map "modperl_xs_$_.h", qw(sv_convert util typedefs));
   
  +my @global_structs = qw(perl_module MP_debug_level);
  +
   sub new {
       my $class = shift;
   
  @@ -812,13 +814,21 @@
       my $header = \&{"export_file_header_$ext"};
       my $format = \&{"export_file_format_$ext"};
   
  -    while (my($name, $table) = each %files) {
  -        my $handles = $self->open_export_files($name, $ext);
  +    while (my($key, $table) = each %files) {
  +        my $handles = $self->open_export_files($key, $ext);
   
        my %seen; #only write header once if this is a single file
           for my $fh (values %$handles) {
               next if $seen{$fh}++;
               print $fh $self->$header();
  +        }
  +
  +        # add the symbols which aren't the function table
  +        if ($key eq 'modperl') {
  +            my $fh = $handles->{global};
  +            for my $name (@global_structs) {
  +                print $fh $self->$format($name);
  +            }
           }
   
           for my $entry (@$table) {
  
  
  
  1.156     +3 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.155
  retrieving revision 1.156
  diff -u -r1.155 -r1.156
  --- Changes   22 Mar 2003 07:36:57 -0000      1.155
  +++ Changes   24 Mar 2003 03:00:19 -0000      1.156
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +adjust the generated Makefile's to properly build on aix (tested on
  +powerpc-ibm-aix5.1.0.0) [Stas]
  +
   the build now automatically glues the .pod files to the respective .pm
   files, so one can use perldoc on .pm files to read the
   documentation. [Stas]
  
  
  

Reply via email to