automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: build question


From: Eric Blake
Subject: Re: build question
Date: Wed, 13 Feb 2002 14:19:04 -0700

SUCCESS!  With your patch to XFile.pm, I was able to do:

$ cd automake
$ touch Makefile.am
$ make
cd . && \
  perllibdir=./lib /home/eblake/automake/automake --libdir=lib --gnu 
Makefile
cd . && /bin/sh ./config.status Makefile
config.status: creating Makefile
Making all in .
[...]
$ cvs up Makefile.in
$

In other words, the patch correctly solves all \r problems, and the
generated Makefile.in is a binary match to the one already in CVS.  Go
ahead and apply this patch before releasing version 1.6, and thanks for
your help.


Alexandre Duret-Lutz wrote:
> 
> You perl installation is clearly not converting new lines.  "\r"
> are present *everywhere*, and they all come from the input.
> (The "\r\r\n" occurence is also ok, those two \r come from
> different lines.)
> 
>  Eric> How would this idea work for a hack? In Automake::XFile, overload the
>  Eric> getline method (as well as the <HANDLE> operator) to strip \r before
>  Eric> passing any line of text to the rest of automake.
> 
> I don't know if there a way to overwrite <HANDLE>.  However Automake is
> using getline everywhere.  Is the following what you had in mind:
> 
> Index: lib/Automake/XFile.pm
> ===================================================================
> RCS file: /cvs/automake/automake/lib/Automake/XFile.pm,v
> retrieving revision 1.1
> diff -u -r1.1 XFile.pm
> --- lib/Automake/XFile.pm 2001/10/02 17:17:45 1.1
> +++ lib/Automake/XFile.pm 2002/02/12 21:21:25
> @@ -59,7 +59,8 @@
>  =head1 DESCRIPTION
> 
>  C<Automake::XFile> inherits from C<IO::File>.  It provides dying
> -version of the methods C<open>, C<new>, and C<close>.
> +version of the methods C<open>, C<new>, and C<close>.  It also
> +overrides the C<getline> method to translate C<\r\n> to C<\n>.
> 
>  =head1 SEE ALSO
> 
> @@ -151,6 +152,21 @@
>        my $file = ${*$fh}{'autom4te_xfile_file'};
>        croak "$me: cannot close $file: $!\n";
>      }
> +}
> +
> +################################################
> +## Getline
> +##
> +
> +# Some Win32/perl installations fail to translate \r\n to \n on input
> +# so we do that here.
> +sub getline
> +{
> +    local $_ = $_[0]->SUPER::getline;
> +    # Perform a _global_ replacement: $_ may can contains many lines
> +    # in slurp mode ($/ = undef).
> +    s/\015\012/\n/gs if defined $_;
> +    return $_;
>  }
> 
>  1;
> 
> --
> Alexandre Duret-Lutz

-- 
This signature intentionally left boring.

Eric Blake             address@hidden
  BYU student, free software programmer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]