Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 66999 invoked from network); 6 Nov 2003 08:02:31 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 Nov 2003 08:02:31 -0000 Received: (qmail 89443 invoked by uid 500); 6 Nov 2003 08:02:07 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 89434 invoked by uid 500); 6 Nov 2003 08:02:07 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 89421 invoked from network); 6 Nov 2003 08:02:06 -0000 Received: from unknown (HELO theoryx5.uwinnipeg.ca) (142.132.1.82) by daedalus.apache.org with SMTP; 6 Nov 2003 08:02:06 -0000 Received: from theoryx5.uwinnipeg.ca (localhost.localdomain [127.0.0.1]) by theoryx5.uwinnipeg.ca (8.12.8/8.12.8) with ESMTP id hA67xdch002146; Thu, 6 Nov 2003 01:59:39 -0600 Received: from localhost (randy@localhost) by theoryx5.uwinnipeg.ca (8.12.8/8.12.8/Submit) with ESMTP id hA67xdTk002142; Thu, 6 Nov 2003 01:59:39 -0600 Date: Thu, 6 Nov 2003 01:59:38 -0600 (CST) From: Randy Kobes To: Stas Bekman cc: dev@perl.apache.org Subject: Re: [mp2] including a Win32 apxs? In-Reply-To: <3FA9DE01.4060401@stason.org> Message-ID: References: <3FA9DE01.4060401@stason.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Wed, 5 Nov 2003, Stas Bekman wrote: > Randy Kobes wrote: > > Hi, > > I was wondering how it would be felt to include an offer > > in mp2 to get a Win32 version of apxs, if this was not > > detected. There's a tar.gz archive on perl.apache.org that > > contains this (plus apr-config and apu-config), so it would > > be a matter of fetching and extracting this, then running > > the included configure script to install. If this seems OK, > > it'd be nice to detect the absence of apxs early on in the > > build process so as the rest of the build can use the > > installed scripts - the following diff does this for the > > top-level Makefile.PL, but perhaps a better place is in > > Apache::Build? Thanks. > > Ideally we should stop blowing up Makefile.PL, it's > already too big. We should think of having most of the > support functions moved elsewhere. But this is not urgent > of course, just something to think of. > > What's the verdict from Bill? Does httpd go on including > it in the core? I haven't heard anything on this, but that's understandable, as he's pretty busy ... > If not, perhaps we should just bundle it > with mod_perl? Or would it be a bad idea? The fetch thing > sounds OK, but what if the there is no network available > during the install? Also some people won't like "random" > code being brought and installed without them reviewing it > first? May be Makefile.PL should die telling the user what > to do. e.g. we could include this fetch thing in a > build/fetch_win32_apxs and just tell the user to run it > first, install it and then return to the normal build? > Just throwing ideas... That's a good point about the external code being brought in, and also a potential lack of a network ... One advantage to running it from Makefile.PL (or equivalent) though is that MP_AP_PREFIX is available, which is used to install apxs. What about offering a choice: - ignore apxs (things still build) - install automatically - quit, and run a build/fetch_win32_apxs script - give the location where the sources are, for manual installation The following implements that; unfortunately, it still expands Makefile.PL - perhaps this could be moved elsewhere, or perhaps the number of options cut down, or perhaps I could be less verbose ... ======================================================== Index: Makefile.PL =================================================================== RCS file: /home/cvs/modperl-2.0/Makefile.PL,v retrieving revision 1.129 diff -u -r1.129 Makefile.PL --- Makefile.PL 5 Nov 2003 09:52:18 -0000 1.129 +++ Makefile.PL 6 Nov 2003 07:44:48 -0000 @@ -44,6 +44,8 @@ my $build = Apache::Build->new(init => 1); my $code = ModPerl::Code->new; +fetch_apxs() if WIN32; + configure(); perl_version_check($build); @@ -418,6 +420,35 @@ EOF } } +} + +sub fetch_apxs { + my $prefix = $build->{MP_AP_PREFIX}; + return if -e catfile($prefix, 'bin', 'apxs.bat1'); + 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 re-run this Makefile.PL, +- quit now, and from http://perl.apache.org/dist/win32-bin/ grab + apxs_win32.tar.gz; when unpacked, this contains a README explaining + how installation is done. Afterwards, re-run this Makefile.PL. + +END + + my $ans = $build->prompt('Install apxs now?', 'yes'); + return unless $ans =~ /^y/i; + my $script = catfile($build->{cwd}, 'build', 'fetch_win32_apxs.pl'); + my @args = ($^X, $script, "--with-apache2=$prefix"); + print "@args\n"; + system(@args) == 0 or die "fetch of apxs failed: $?"; } package MY; Index: build/fetch_win32_apxs.pl =================================================================== RCS file: build/fetch_win32_apxs.pl diff -N build/fetch_win32_apxs.pl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ build/fetch_win32_apxs.pl 6 Nov 2003 07:44:48 -0000 @@ -0,0 +1,37 @@ +#!C:/Perl/bin/perl +use strict; +use warnings; +use Getopt::Long; +require File::Spec; +use File::Basename; +use Archive::Tar; +use File::Path; +use LWP::Simple; + +my $prefix; +GetOptions( 'with-apache2=s' => \$prefix); +die "Please specify the --with-apache2 option as the path to Apache2" + unless $prefix; + +my $file = 'apxs_win32.tar.gz'; +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 $arc = Archive::Tar->new($file, 1); +$arc->extract($arc->list_files()); +my $dir = 'apxs'; +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 '..'; +rmtree($dir, 1, 1) or warn "rmtree of $dir failed: $!"; +print "unlink $file\n\n"; +unlink $file or warn "unlink of $file failed: $!"; ================================================================ -- best regards, randy --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org