You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by ra...@apache.org on 2003/06/12 07:55:32 UTC
cvs commit: httpd-apreq-2/build xsbuilder.pl
randyk 2003/06/11 22:55:32
Modified: build xsbuilder.pl
Log:
Reviewed by: joes
For Win32,
- ensure cwd is a long path name, in order to get the base directory
- obtain the Apache include and lib directories without relying on
a config.status
- adjust the library locations and names for WriteMakefile
Revision Changes Path
1.6 +26 -9 httpd-apreq-2/build/xsbuilder.pl
Index: xsbuilder.pl
===================================================================
RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xsbuilder.pl 10 Jun 2003 14:43:10 -0000 1.5
+++ xsbuilder.pl 12 Jun 2003 05:55:32 -0000 1.6
@@ -8,9 +8,12 @@
use warnings FATAL => 'all';
use Apache2;
use Apache::Build;
+require Win32 if Apache::Build::WIN32;
use Cwd;
-cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
+my $cwd = Apache::Build::WIN32 ?
+ Win32::GetLongPathName(cwd) : cwd;
+$cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
my $base_dir = $1;
my $src_dir = "$base_dir/src";
my $xs_dir = "$base_dir/glue/perl/xsbuilder";
@@ -20,13 +23,27 @@
read $file, $_[0], -s $file;
}
-slurp my $config => "$base_dir/config.status";
-$config =~ /^s,\@APACHE2_INCLUDES\@,([^,]+)/m && -d $1 or
- die "Can't find apache include directory";
-my $apache_includes = $1;
-$config =~ m/^s,\@APACHE2_LIBS\@,([^,]+)/m && -d $1 or
- die "Can't find apr lib directory";
-my $apr_libs = $1;
+my ($apache_includes, $apr_libs);
+if (Apache::Build::WIN32) {
+ my $apache_dir = Apache::Build->build_config()->dir;
+ ($apache_includes = $apache_dir . '/include') =~ s!\\!/!g;
+ ($apr_libs = $apache_dir . '/lib') =~ s!\\!/!g;
+}
+else {
+ slurp my $config => "$base_dir/config.status";
+ $config =~ /^s,\@APACHE2_INCLUDES\@,([^,]+)/m && -d $1 or
+ die "Can't find apache include directory";
+ $apache_includes = $1;
+ $config =~ m/^s,\@APACHE2_LIBS\@,([^,]+)/m && -d $1 or
+ die "Can't find apr lib directory";
+ $apr_libs = $1;
+}
+my $apr_lib_flags = Apache::Build::WIN32 ?
+ qq{-L$apr_libs -llibapr -llibaprutil} :
+ qq{-L$apr_libs -lapr-0 -laprutil-0};
+my $apreq_lib_flags = Apache::Build::WIN32 ?
+ qq{-L$base_dir/win32/libs -llibapreq -lmod_apreq} :
+ qq{-L$src_dir/.libs -lapreq};
my $mp2_typemaps = Apache::Build->new->typemaps;
read DATA, my $grammar, -s DATA;
@@ -178,7 +195,7 @@
'VERSION' => '0.01',
'TYPEMAPS' => [qw(@$mp2_typemaps $typemap)],
'INC' => "-I.. -I../.. -I../../.. -I$src_dir -I$xs_dir -I$apache_includes",
- 'LIBS' => "-L$src_dir/.libs -L$apr_libs -lapreq -lapr-0 -laprutil-0",
+ 'LIBS' => "$apreq_lib_flags $apr_lib_flags",
} ;
$txt .= "'depend' => $deps,\n" if ($deps) ;
$txt .= qq{
Re: cvs commit: httpd-apreq-2/build xsbuilder.pl
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Thu, 12 Jun 2003, Stas Bekman wrote:
>
> [ .. ]
>
>>Understood. But using FindBin is better than Cwd in general, I
>>believe, because it allows you to invoke the same script as
>>foo/bar.pl ./bar.pl or even /full/path/to/bar.pl and using
>>FindBin it'll always do the right thing, whereas it won't with
>>Cwd.
>>
>>so perhaps doing Win32::GetLongPathName($FindBin::Bin) works?
>
> Yes, it does, and that's a good point - thanks. How about
> (for both build/xsbuilder.pl and glue/perl/t/TEST.PL):
+1, but I'd also suggest to rename $cwd with something more intuitive, since
this isn't really a cwd. e.g. we can easily get the root dir, since that's
what we really want, instead of doing the regex hack.
Perhaps something like this for build/xsbuilder.pl
use FindBin;
use File::Spec::Functions qw(updir)
my $base_dir = updir(Apache::Build::WIN32 ?
Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin);
die "Can't find base cvs directory" unless $base_dir =~ /httpd-apreq-2/;
this is however untested.
in the case of glue/perl/t/TEST.PL we need to go 3 dirs up.
> ===============================================================
> Index: build/xsbuilder.pl
> ===================================================================
> RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
> retrieving revision 1.6
> diff -u -r1.6 xsbuilder.pl
> --- build/xsbuilder.pl 12 Jun 2003 05:55:32 -0000 1.6
> +++ build/xsbuilder.pl 12 Jun 2003 14:23:01 -0000
> @@ -10,9 +10,9 @@
> use Apache::Build;
> require Win32 if Apache::Build::WIN32;
>
> -use Cwd;
> +use FindBin;
> my $cwd = Apache::Build::WIN32 ?
> - Win32::GetLongPathName(cwd) : cwd;
> + Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin;
> $cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
> my $base_dir = $1;
> my $src_dir = "$base_dir/src";
> Index: glue/perl/t/TEST.PL
> ===================================================================
> RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/TEST.PL,v
> retrieving revision 1.2
> diff -u -r1.2 TEST.PL
> --- glue/perl/t/TEST.PL 12 Jun 2003 05:42:13 -0000 1.2
> +++ glue/perl/t/TEST.PL 12 Jun 2003 14:23:01 -0000
> @@ -7,9 +7,9 @@
> use Apache::Build;
> require Win32 if Apache::Build::WIN32;
>
> -use Cwd;
> +use FindBin;
> my $cwd = Apache::Build::WIN32 ?
> - Win32::GetLongPathName(cwd) : cwd;
> + Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin;
> $cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
> my $base_dir = $1;
> my $env_dir = "$base_dir/env";
> ===================================================================
>
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: cvs commit: httpd-apreq-2/build xsbuilder.pl
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 12 Jun 2003, Stas Bekman wrote:
[ .. ]
> Understood. But using FindBin is better than Cwd in general, I
> believe, because it allows you to invoke the same script as
> foo/bar.pl ./bar.pl or even /full/path/to/bar.pl and using
> FindBin it'll always do the right thing, whereas it won't with
> Cwd.
>
> so perhaps doing Win32::GetLongPathName($FindBin::Bin) works?
Yes, it does, and that's a good point - thanks. How about
(for both build/xsbuilder.pl and glue/perl/t/TEST.PL):
===============================================================
Index: build/xsbuilder.pl
===================================================================
RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
retrieving revision 1.6
diff -u -r1.6 xsbuilder.pl
--- build/xsbuilder.pl 12 Jun 2003 05:55:32 -0000 1.6
+++ build/xsbuilder.pl 12 Jun 2003 14:23:01 -0000
@@ -10,9 +10,9 @@
use Apache::Build;
require Win32 if Apache::Build::WIN32;
-use Cwd;
+use FindBin;
my $cwd = Apache::Build::WIN32 ?
- Win32::GetLongPathName(cwd) : cwd;
+ Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin;
$cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
my $base_dir = $1;
my $src_dir = "$base_dir/src";
Index: glue/perl/t/TEST.PL
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/TEST.PL,v
retrieving revision 1.2
diff -u -r1.2 TEST.PL
--- glue/perl/t/TEST.PL 12 Jun 2003 05:42:13 -0000 1.2
+++ glue/perl/t/TEST.PL 12 Jun 2003 14:23:01 -0000
@@ -7,9 +7,9 @@
use Apache::Build;
require Win32 if Apache::Build::WIN32;
-use Cwd;
+use FindBin;
my $cwd = Apache::Build::WIN32 ?
- Win32::GetLongPathName(cwd) : cwd;
+ Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin;
$cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
my $base_dir = $1;
my $env_dir = "$base_dir/env";
===================================================================
--
best regards,
randy
Re: cvs commit: httpd-apreq-2/build xsbuilder.pl
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Thu, 12 Jun 2003, Stas Bekman wrote:
>
>
>>randyk@apache.org wrote:
>>
>>
>>> Modified: build xsbuilder.pl
>>> Log:
>>> Reviewed by: joes
>>> For Win32,
>>> - ensure cwd is a long path name, in order to get the base directory
>>> - obtain the Apache include and lib directories without relying on
>>> a config.status
>>> - adjust the library locations and names for WriteMakefile
>>>
>>> Revision Changes Path
>>> 1.6 +26 -9 httpd-apreq-2/build/xsbuilder.pl
>>>
>>> Index: xsbuilder.pl
>>> ===================================================================
>>> RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
>>> retrieving revision 1.5
>>> retrieving revision 1.6
>>> diff -u -r1.5 -r1.6
>>> --- xsbuilder.pl 10 Jun 2003 14:43:10 -0000 1.5
>>> +++ xsbuilder.pl 12 Jun 2003 05:55:32 -0000 1.6
>>> @@ -8,9 +8,12 @@
>>> use warnings FATAL => 'all';
>>> use Apache2;
>>> use Apache::Build;
>>> +require Win32 if Apache::Build::WIN32;
>>>
>>> use Cwd;
>>> -cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
>>> +my $cwd = Apache::Build::WIN32 ?
>>> + Win32::GetLongPathName(cwd) : cwd;
>>> +$cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
>>
> [ .. ]
>
>>May I suggest using FindBin here? You don't need special WIN32
>>case if you do that, I think.
>>use FindBin;
>>$FindBin::Bin =~ /httpd-apreq-2/ or die "Can't find base cvs directory";
>
>
> Unfortunately, that runs into the same problem ... What's
> happening is that the source directory (httpd-apreq-2) is longer
> than 6 characters, so $FindBin::Bin (or cwd) reports something
> like C:/MyFiles/HTTPD-~3/build, which is the dos short path name.
> The "3" in the name is due to the fact that, at the same level, I
> have a httpd-apreq and a httpd-apreq-2-dev directory. So I think
> converting it to the long path name is the simplest way to go ...
Understood. But using FindBin is better than Cwd in general, I believe,
because it allows you to invoke the same script as foo/bar.pl ./bar.pl or even
/full/path/to/bar.pl and using FindBin it'll always do the right thing,
whereas it won't with Cwd.
so perhaps doing Win32::GetLongPathName($FindBin::Bin) works?
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: cvs commit: httpd-apreq-2/build xsbuilder.pl
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 12 Jun 2003, Stas Bekman wrote:
> randyk@apache.org wrote:
>
> > Modified: build xsbuilder.pl
> > Log:
> > Reviewed by: joes
> > For Win32,
> > - ensure cwd is a long path name, in order to get the base directory
> > - obtain the Apache include and lib directories without relying on
> > a config.status
> > - adjust the library locations and names for WriteMakefile
> >
> > Revision Changes Path
> > 1.6 +26 -9 httpd-apreq-2/build/xsbuilder.pl
> >
> > Index: xsbuilder.pl
> > ===================================================================
> > RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
> > retrieving revision 1.5
> > retrieving revision 1.6
> > diff -u -r1.5 -r1.6
> > --- xsbuilder.pl 10 Jun 2003 14:43:10 -0000 1.5
> > +++ xsbuilder.pl 12 Jun 2003 05:55:32 -0000 1.6
> > @@ -8,9 +8,12 @@
> > use warnings FATAL => 'all';
> > use Apache2;
> > use Apache::Build;
> > +require Win32 if Apache::Build::WIN32;
> >
> > use Cwd;
> > -cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
> > +my $cwd = Apache::Build::WIN32 ?
> > + Win32::GetLongPathName(cwd) : cwd;
> > +$cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
[ .. ]
> May I suggest using FindBin here? You don't need special WIN32
> case if you do that, I think.
> use FindBin;
> $FindBin::Bin =~ /httpd-apreq-2/ or die "Can't find base cvs directory";
Unfortunately, that runs into the same problem ... What's
happening is that the source directory (httpd-apreq-2) is longer
than 6 characters, so $FindBin::Bin (or cwd) reports something
like C:/MyFiles/HTTPD-~3/build, which is the dos short path name.
The "3" in the name is due to the fact that, at the same level, I
have a httpd-apreq and a httpd-apreq-2-dev directory. So I think
converting it to the long path name is the simplest way to go ...
--
best regards,
randy
Re: cvs commit: httpd-apreq-2/build xsbuilder.pl
Posted by Stas Bekman <st...@stason.org>.
randyk@apache.org wrote:
> randyk 2003/06/11 22:55:32
>
> Modified: build xsbuilder.pl
> Log:
> Reviewed by: joes
> For Win32,
> - ensure cwd is a long path name, in order to get the base directory
> - obtain the Apache include and lib directories without relying on
> a config.status
> - adjust the library locations and names for WriteMakefile
>
> Revision Changes Path
> 1.6 +26 -9 httpd-apreq-2/build/xsbuilder.pl
>
> Index: xsbuilder.pl
> ===================================================================
> RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- xsbuilder.pl 10 Jun 2003 14:43:10 -0000 1.5
> +++ xsbuilder.pl 12 Jun 2003 05:55:32 -0000 1.6
> @@ -8,9 +8,12 @@
> use warnings FATAL => 'all';
> use Apache2;
> use Apache::Build;
> +require Win32 if Apache::Build::WIN32;
>
> use Cwd;
> -cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
> +my $cwd = Apache::Build::WIN32 ?
> + Win32::GetLongPathName(cwd) : cwd;
> +$cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
> my $base_dir = $1;
> my $src_dir = "$base_dir/src";
> my $xs_dir = "$base_dir/glue/perl/xsbuilder";
> @@ -20,13 +23,27 @@
> read $file, $_[0], -s $file;
> }
May I suggest using FindBin here? You don't need special WIN32 case if you do
that, I think.
use FindBin;
$FindBin::Bin =~ /httpd-apreq-2/ or die "Can't find base cvs directory";
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: cvs commit: httpd-apreq-2/build xsbuilder.pl
Posted by Stas Bekman <st...@stason.org>.
randyk@apache.org wrote:
> randyk 2003/06/11 22:55:32
>
> Modified: build xsbuilder.pl
> Log:
> Reviewed by: joes
> For Win32,
> - ensure cwd is a long path name, in order to get the base directory
> - obtain the Apache include and lib directories without relying on
> a config.status
> - adjust the library locations and names for WriteMakefile
>
> Revision Changes Path
> 1.6 +26 -9 httpd-apreq-2/build/xsbuilder.pl
>
> Index: xsbuilder.pl
> ===================================================================
> RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- xsbuilder.pl 10 Jun 2003 14:43:10 -0000 1.5
> +++ xsbuilder.pl 12 Jun 2003 05:55:32 -0000 1.6
> @@ -8,9 +8,12 @@
> use warnings FATAL => 'all';
> use Apache2;
> use Apache::Build;
> +require Win32 if Apache::Build::WIN32;
>
> use Cwd;
> -cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
> +my $cwd = Apache::Build::WIN32 ?
> + Win32::GetLongPathName(cwd) : cwd;
> +$cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
> my $base_dir = $1;
> my $src_dir = "$base_dir/src";
> my $xs_dir = "$base_dir/glue/perl/xsbuilder";
> @@ -20,13 +23,27 @@
> read $file, $_[0], -s $file;
> }
May I suggest using FindBin here? You don't need special WIN32 case if you do
that, I think.
use FindBin;
$FindBin::Bin =~ /httpd-apreq-2/ or die "Can't find base cvs directory";
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com