Script written to assist testing. If these procedures are not correct, please let me know. This is designed for a fresh linux install, i.e., I use a clean machine image each time. If there is any potential with this I imagine posting it to CPAN would be appropriate, please let me know. Cheers, -Ryan

#!/bin/bash

# mp2test - Helper script for testing mod_perl-2.0 compiles
#
# Red Hat specific.
#
# This script will prompt (y/n) to execute each command.  When the exit status
# is unsuccessful, this script will stop.
#
# Privided as-is, no warranty. -Ryan Gies<ryang...@cpan.org>


info_filename="$HOME/mp2test_results.txt"
path_to_httpd="/usr/sbin/httpd"

function ask_yn () {
  local yn=false;
  prompt="$1 [n] "
  while true; do
    read -p "$prompt" chr
    case $chr in
      [Yy]* ) yn=true; break;;
      * ) yn=false; break;;
    esac
  done
  if ($yn); then
    return 0
  else
    return 1
  fi
}

function write_platform_info () {
  cat /etc/redhat-release>  $info_filename
  echo "">>  $info_filename
  uname -a>>  $info_filename
  echo "">>  $info_filename
  $path_to_httpd -V>>  $info_filename
  echo "Wrote: $info_filename"
}

commands=(
  "su root -c 'yum install -y subversion httpd httpd-devel'"
  "svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ 
mod_perl-2.0"
  "svn update mod_perl-2.0"
  "cd mod_perl-2.0"
  "perl Makefile.PL"
  "make"
  "make test"
  "write_platform_info"
)

IFS_BAK=$IFS
IFS='$'
for cmd in ${comman...@]}; do
  if (ask_yn "$cmd"); then
    IFS=$IFS_BAK
    $cmd
    rc=$?
    if [ $rc -gt 0 ]; then
      echo "Command failed [$rc]: $cmd"
      break
    fi
  fi
done


On 10/17/2010 02:50 PM, Fred Moyer wrote:
Please take a look at the last 4 commits I did; any feedback welcome.
These commits are meant to clear up build issues with mod_perl and
friends.  The build system is very flexible and powerful - and at the
same time encounters random problems as a result of that flexibility.
I've attempting to eliminate those issues, so that clean builds will
result when you have a clean toolchain (which almost everyone seems to
have when building mod_perl, those with 10 different perl binaries
installed are rare and capable of figuring things out themselves.

If you could take a few minutes to svn update mod_perl trunk and run
the tests, that would be extremely helpful.  I've tested on 2
different platforms so far, OS X and Linux, and all tests are passing.


---------- Forwarded message ----------
From:<ph...@apache.org>
Date: Sun, Oct 17, 2010 at 11:45 AM
Subject: svn commit: r1023553 - in /perl/modperl/trunk: Changes
Makefile.PL lib/Apache2/Build.pm lib/ModPerl/BuildOptions.pm
To: modperl-...@perl.apache.org


Author: phred
Date: Sun Oct 17 18:45:16 2010
New Revision: 1023553

URL: http://svn.apache.org/viewvc?rev=1023553&view=rev
Log:
Look for a usable apxs in $ENV{PATH} if all other options fail, then
prompt the user for one.

Work around bootstrap warnings when Apache2::BuildConfig has not been
created yet.

Remove Apache::test compatibility (part of mod_perl 1.2.7), that code
causes build issues and is 4 versions out of date.

Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/Makefile.PL
    perl/modperl/trunk/lib/Apache2/Build.pm
    perl/modperl/trunk/lib/ModPerl/BuildOptions.pm

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/Changes?rev=1023553&r1=1023552&r2=1023553&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Sun Oct 17 18:45:16 2010
@@ -12,6 +12,15 @@ Also refer to the Apache::Test changes l

  =item 2.0.5-dev

+Look for a usable apxs in $ENV{PATH} if all other options fail, then
prompt the user for one.
+[Phred]
+
+Work around bootstrap warnings when Apache2::BuildConfig has not been
created yet.
+[Phred]
+
+Remove Apache::test compatibility (part of mod_perl 1.2.7), that code
causes build issues and is 4 versions out of date.
+[Phred]
+
  Make sure perl is built either with multiplicity and ithreads or without
  both [Theory, Torsten]


Modified: perl/modperl/trunk/Makefile.PL
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/Makefile.PL?rev=1023553&r1=1023552&r2=1023553&view=diff
==============================================================================
--- perl/modperl/trunk/Makefile.PL (original)
+++ perl/modperl/trunk/Makefile.PL Sun Oct 17 18:45:16 2010
@@ -21,6 +21,7 @@ BEGIN {
             $old_Apache2_pm = delete $INC{'Apache2.pm'};
         }
     };
+
  }

  use lib qw(lib Apache-Test/lib);
@@ -629,13 +630,6 @@ use Config;
  use constant WIN32 =>  $^O eq 'MSWin32';
  use constant BUILD_APREXT =>  Apache2::Build::BUILD_APREXT;

-my $apache_test_install;
-BEGIN {
-    $apache_test_install = -e 'Apache-Test';
-    use lib './Apache-Test';
-    require 'install-pl' if $apache_test_install;
-}
-
  sub MY::top_targets {
     my $self = shift;
     my $string = $self->ModPerl::BuildMM::MY::top_targets;
@@ -729,9 +723,6 @@ modperl_banner:

  EOF

-    $string .= Apache::Test::install::nuke_Apache__test_target()
-        if $apache_test_install;
-
     $string;
  }

@@ -747,9 +738,6 @@ sub MY::install {
        # ModPerl::MM::add_dep(\$string, "pure${kind}_install" =>
'aprext_install')
        #    if BUILD_APREXT;

-       ModPerl::MM::add_dep(\$string, "pure${kind}_install" =>
'nuke_Apache__test')
-           if $apache_test_install;
-
        ModPerl::MM::add_dep_after(\$string, "install$kind",
"doc${kind}_install", 'modperl_banner');

        # glue_pods target must come first

Modified: perl/modperl/trunk/lib/Apache2/Build.pm
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/lib/Apache2/Build.pm?rev=1023553&r1=1023552&r2=1023553&view=diff
==============================================================================
--- perl/modperl/trunk/lib/Apache2/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Build.pm Sun Oct 17 18:45:16 2010
@@ -897,6 +897,10 @@ sub default_file {

  sub file_path {
     my $self = shift;
+
+    # work around when Apache2::BuildConfig has not been created yet
+    return unless $self&&  $self->{cwd};
+
     my @files = map { m:^/: ? $_ : join('/', $self->{cwd}, $_) } @_;
     return wantarray ? @files : $files[0];
  }

Modified: perl/modperl/trunk/lib/ModPerl/BuildOptions.pm
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/lib/ModPerl/BuildOptions.pm?rev=1023553&r1=1023552&r2=1023553&view=diff
==============================================================================
--- perl/modperl/trunk/lib/ModPerl/BuildOptions.pm (original)
+++ perl/modperl/trunk/lib/ModPerl/BuildOptions.pm Sun Oct 17 18:45:16 2010
@@ -66,6 +66,24 @@ sub init {
     $build->{MP_COMPAT_1X} = 1
         unless exists $build->{MP_COMPAT_1X}&&  !$build->{MP_COMPAT_1X};

+    # make a last ditch effort to find apxs in $ENV{PATH}
+    if (!$build->{MP_AP_PREFIX}&&  !$build->{MP_APXS}) {
+
+        my @paths = split(/:/, $ENV{PATH});
+        my $potential_apxs;
+        while (!$potential_apxs) {
+
+            last if scalar(@paths) == 0; # don't loop endlessly
+            $potential_apxs = File::Spec->catfile(shift @paths, 'apxs');
+            if (-e $potential_apxs&&  -x $potential_apxs) {
+
+                $build->{MP_APXS} = $potential_apxs;
+                print "MP_APXS unspecified, using $potential_apxs\n\n";
+            } else {
+                undef $potential_apxs;
+            }
+        }
+    }
  }

  sub parse {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org

Reply via email to