Re: Fwd: [Module::Build] Does ./Build work on Windows?
Status: Beta
Brought to you by:
kwilliams
|
From: demerphq <dem...@gm...> - 2006-02-02 08:52:11
|
On 2/2/06, Randy W. Sims <ml...@th...> wrote:
> demerphq wrote:
> >
> > The change required to MB to handle this is minimal and is implemented
> > in a provisional form in the attached patch.
> >
> > When the Build script is created it needs to add the line
> >
> > close *DATA unless eof(*DATA);
> >
> > when being used on win32.
>
> I think we can simplify, and apply this to all platforms.
I think that this can be avoided for anything but clean like targets,
and for those targets it occured to me that it probably should happen
as late as possibe. I'm not sure if i read your patch correctly, maybe
it already does that but it thought it would be worth mentioning.
> > Then the exception line in pl2script needs
> > to be removed.
>
> > Additionally when scripts are pl2bat'ed their bat names need to be
> > added to the cleanup list. This currently doesnt happen at all so MB
> > cant/doesnt clean up pl2batted files properly. (It may do so
> > indirectly as a directory cleanup but this doesnt help the build
> > script itself.)
>
> Yeah. They were cleaned up as part of blib, but you're right, it should
> be mentioned explicitly here.
Ok. Im glad i didnt miss it happening somewhere/somehow else. :-)
> > Also, my preference (and i think the preference of many in the windows
> > world) is to avoid ".bat" files on NT and latter Win32 OS'es. It
> > should use the .cmd extension when on NT, W2K and XP or later. I
> > hazzily recall there is a good reason for this, but i have to admit I
> > dont remember what it is. Maybe its just cargo cultism and doesnt
> > matter at all. Anyway, the point is the attached patch includes such
> > logic. :-) I based it the behaviour change on the presence of .CMD in
> > the PATHEXT enviornment var so on machines without either it will
> > default to .bat
>
> Ok.
Sigh. I'm now wondering about the wisdom of this. Other tools may be
expecting '.bat' extensions and fail because of the change. I think
actually despite my other feelings on it that a more conservative
approach is called for and this change should be reversed until we can
find proof that there is a good reason for it (my hazy recollections
dont count). Maybe it could be made optional somehow. But ill leave
that decision to you.
Sorry to waste your time with it.
> > Im sorry i havent gotten further on this, i was distracted by other thi=
ngs.
>
> No problem. You're work on this and on fixing the "Cwd won't install"
> problem in EU::Install is very very much appreciated.
>
> > BTW, there is one annoying thing about self deletion of the .cmd/.bat
> > Build file. When control returns to the shell it raises a warning
> > about the batch file unexpected ending. Its not an issue, but it is
> > inelegant so figuring out how to make it go away would be nice.
>
> This is the only issue holding me up. I'm going to do some experimenting
> and research to see if that annoying message can be eliminated somehow.
Yeah. Its an interesting question. Ill look into it too.
> Attached is a manually applied version of your patch against current
> cvs. The only changes are applying the close(*DATA) on all OS, removing
> the extraneous Build_FollowUp logic, and some line wraps.
Ill have a go applying it later. Thanks.
yves
> Index: lib/Module/Build/Base.pm
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v
> retrieving revision 1.544
> diff -u -r1.544 Base.pm
> --- lib/Module/Build/Base.pm 23 Jan 2006 13:27:43 -0000 1.544
> +++ lib/Module/Build/Base.pm 2 Feb 2006 00:54:22 -0000
> @@ -1188,6 +1188,9 @@
> use File::Basename;
> use File::Spec;
>
> +close(*DATA) unless eof(*DATA); # must close before unlinking ourself
> + # necessary on MSWin32 for realclean a=
ction
> +
> sub magic_number_matches {
> return 0 unless -e '$q{magic_numfile}';
> local *FH;
> @@ -1257,6 +1260,7 @@
> $self->print_build_script($fh);
> close $fh;
>
> + local $self->{properties}{quiet} =3D 1;
> $self->make_executable($build_script);
>
> return 1;
> Index: lib/Module/Build/Platform/Windows.pm
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Platform/Wi=
ndows.pm,v
> retrieving revision 1.26
> diff -u -r1.26 Windows.pm
> --- lib/Module/Build/Platform/Windows.pm 21 Jan 2006 18:05:01 -000=
0 1.26
> +++ lib/Module/Build/Platform/Windows.pm 2 Feb 2006 00:54:22 -0000
> @@ -56,16 +56,20 @@
> my $pl2bat =3D $self->{config}{pl2bat};
>
> if ( defined($pl2bat) && length($pl2bat) ) {
> - foreach my $script (@_) {
> - # Don't run 'pl2bat.bat' for the 'Build' script;
> - # there is no easy way to get the resulting 'Build.bat'
> - # to delete itself when doing a 'Build realclean'.
> - next if ( $script eq $self->{properties}{build_script} );
> + my $ext =3D ( $ENV{PATHEXT}=3D~/\.CMD(\W|$)/i )
> + ? '.cmd' : '.bat';
>
> + foreach my $script (@_) {
> (my $script_bat =3D $script) =3D~ s/\.plx?//i;
> - $script_bat .=3D '.bat' unless $script_bat =3D~ /\.bat$/i;
>
> - my $status =3D $self->do_system("$self->{properties}{perl} $pl2bat=
< $script > $script_bat");
> + # already has executable extension
> + next if ($script_bat =3D~ /\.(bat|cmd)$/i);
> +
> + $script_bat .=3D $ext;
> + $self->add_to_cleanup($script_bat);
> +
> + my $status =3D $self->do_system(
> + "$self->{properties}{perl} $pl2bat < $script > $script_bat" );
> if ( $status && -f $script_bat ) {
> $self->SUPER::make_executable($script_bat);
> } else {
>
>
>
--
perl -Mre=3Ddebug -e "/just|another|perl|hacker/"
|