randyk 2003/11/07 00:38:24
Modified: . Changes Makefile.PL
Added: build win32_fetch_apxs
Log:
Reviewed by: stas
add a build/win32_fetch_apxs script (called within the top-level Makefile.PL) to
offer to fetch and install Win32 development versions of apxs and (apr|apu)-config.
Revision Changes Path
1.247 +4 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -r1.246 -r1.247
--- Changes 6 Nov 2003 11:22:02 -0000 1.246
+++ Changes 7 Nov 2003 08:38:23 -0000 1.247
@@ -12,6 +12,10 @@
=item 1.99_11-dev -
+add a build/win32_fetch_apxs script (called within the top-level
+Makefile.PL) to offer to fetch and install a Win32 development
+version of apxs and (apr|apu)-config [Randy Kobes]
+
rewrite $r->read() and perlio read functions to use the same function,
which completely satisfies the read request if possible, on the way
getting rid of get_client_block and its supporting functions which
1.131 +9 -0 modperl-2.0/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -r1.130 -r1.131
--- Makefile.PL 7 Nov 2003 00:56:31 -0000 1.130
+++ Makefile.PL 7 Nov 2003 08:38:23 -0000 1.131
@@ -44,6 +44,8 @@
my $build = Apache::Build->new(init => 1);
my $code = ModPerl::Code->new;
+win32_fetch_apxs() if WIN32;
+
configure();
perl_version_check($build);
@@ -418,6 +420,13 @@
EOF
}
}
+}
+
+sub win32_fetch_apxs {
+ return unless (my $prefix = $build->{MP_AP_PREFIX});
+ my $script = catfile($build->{cwd}, 'build', 'win32_fetch_apxs');
+ my @args = ($^X, $script, "--with-apache2=$prefix");
+ system(@args) == 0 or die "system @args failed: $?";
}
package MY;
1.1 modperl-2.0/build/win32_fetch_apxs
Index: win32_fetch_apxs
===================================================================
#!C:/Perl/bin/perl
###################################################################
# apxs, apr-config, and apu-config are Apache utilities used #
# to both get certain configuration information and also to #
# assist in building Apache modules. These utilities have not #
# yet been officially ported to Win32. The following will fetch #
# and install a development version of these scripts which can #
# be used in both mod_perl 2 and Apache C modules. #
# #
# Please report problems in installing or using these utilties to #
# Randy Kobes <[EMAIL PROTECTED]> #
###################################################################
use strict;
use warnings;
use Getopt::Long;
use File::Spec::Functions;
use Archive::Tar;
use File::Path;
use LWP::Simple;
use ExtUtils::MakeMaker qw(prompt);
use Cwd;
die "This is intended for Win32" unless ($^O =~ /Win32/i);
my $prefix;
GetOptions( 'with-apache2=s' => \$prefix);
unless ($prefix and -d $prefix) {
die << 'END';
I could not determine a valid Apache2 directory. Please
run this script specifying the option
--with-apache2=/Path/to/Apache2
where /Path/to/Apache2 is the location of your installed
Apache2 top-level directory.
END
}
exit 0 if (-e catfile($prefix, 'bin', 'apxs.bat'));
print << 'END';
----------------------------------------------------------------------
I could not find an apxs utility, which will be used in certain parts
of the build, if present. This utility (and the apr-config and
apu-config utilities) have not yet been ported to Apache2 on Win32,
but a development port is available. You can either
- ignore installing apxs by answering "no" at the prompt below
(mod_perl will still build),
- install apxs by answering "yes" at the prompt below,
- quit now, run the "fetch_win32_apxs.pl" script in the build/ directory
to fetch and install the utilities, and then rebuild mod_perl,
- quit now, and from http://perl.apache.org/dist/win32-bin/ grab
apxs_win32.tar.gz; when unpacked, this contains a README explaining
how to install the utilities. Afterwards, rebuild mod_perl.
----------------------------------------------------------------------
END
my $ans = prompt('Install apxs now?', 'yes');
exit 0 unless $ans =~ /^y/i;
my $file = 'apxs_win32.tar.gz';
unless (-e $file) {
my $remote = 'http://perl.apache.org/dist/win32-bin/' . $file;
print "Fetching $remote ... ";
die "Download of $remote failed"
unless (is_success(getstore($remote, $file)));
print " done!\n";
}
my $cwd = getcwd;
my $dir = 'apxs';
my $arc = Archive::Tar->new($file, 1);
$arc->extract($arc->list_files());
die "Unpacking $file failed" unless (-d $dir);
print "chdir $dir\n";
chdir $dir or die "chdir to $dir failed: $!";
my @args = ($^X, 'Configure.pl', "--with-apache2=$prefix");
print "@args\n";
system(@args) == 0 or die "system @args failed: $?";
chdir $cwd;
#rmtree($dir, 1, 1) or warn "rmtree of $dir failed: $!";
#print "unlink $file\n\n";
#unlink $file or warn "unlink of $file failed: $!";