Front page | perl.perl5.porters |
Postings from September 1999
[patch _61] perlcc changes
Thread Next
From:
Vishal Bhatia
Date:
September 22, 1999 20:53
Subject:
[patch _61] perlcc changes
Message ID:
Pine.LNX.4.10.9909231218360.3428-100000@localhost.localdomain
Sarathy,
Here are the changes that need to be done
to perlcc to make it working
( some recent changes since _61 have broken it)
Here is the short description of the changes:
1. Added File::Spec for the null device.
2. Some modules like to print out messages during BEGIN and these would
get mixed with code if
$^X -I@INC -MO=$backend,$stash $file >>$generated_file
is used. So CC and C backend support a -o,$generated_file option
and they rewind the file before outputting code. Hence the line
has been changed back to use -o option. I suggest that other backends
also use the same option since they suffer from the same problem.
3. Some strange character exists at the end of :
if ($options->{'e'} && ($options->{'sav'} || $options->{'gen'}) && ò0
This has been removed.
4. For win32, linking with lib instead of dll is needed. That has been
added.
5. In
my $pid = open (FD, "$command 2|");
the purpose probably was to pipe the stderr but that doesnot work, passing
2 as a command line option instead. I have removed that.
regards,
vishal
--- perl/utils/perlcc.PL Thu Sep 23 11:24:04 1999 1.1
+++ perl/utils/perlcc.PL Thu Sep 23 12:15:04 1999
@@ -2,6 +2,7 @@
use Config;
use File::Basename qw(&basename &dirname);
+use File::Spec;
use Cwd;
# List explicitly here the variables you want Configure to
@@ -270,13 +271,14 @@
if (@_ == 3) # compiling a program
{
chmod $generated_file, 0777 & ~umask if $backend eq "Bytecode";
-
+ my $null=File::Spec->devnull;
_print( "$^X -I@INC -MB::Stash -c $file\n", 36);
- my $stash=`$^X -I@INC -MB::Stash -c $file 2>/dev/null|tail -1`;
+ my @stash=`$^X -I@INC -MB::Stash -c $file 2>$null`;
+ my $stash=$stash[-1];
chomp $stash;
_print( "$^X -I@INC -MO=$backend,$stash $file\n", 36);
- $return = _run("$^X -I@INC -MO=$backend,$stash $file >> $generated_file", 9);
+ $return = _run("$^X -I@INC -MO=$backend,$stash,-o$generated_file $file", 9);
$return;
}
else # compiling a shared object
@@ -284,7 +286,7 @@
_print(
"$^X -I@INC -MO=$backend,-m$final_output $file\n", 36);
$return =
- _run("$^X -I@INC -MO=$backend,-m$final_output $file >> $generated_file", 9);
+ _run("$^X -I@INC -MO=$backend,-m$final_output,-o$generated_file $file ", 9);
$return;
}
}
@@ -390,17 +392,8 @@
my ($tmpprog);
($tmpprog = $sourceprog) =~ s"(.*)[\\/](.*)"$2";
- my $tempdir;
+ my $tempdir= File::Spec->tmpdir;
- if ($Config{'osname'} eq 'MSWin32')
- {
- $tempdir = $ENV{TEMP};
- $tempdir =~ s[\\][/]g;
- }
- else
- {
- $tempdir = "/tmp";
- }
$tmpfile = "$tempdir/$tmpprog.tst";
$incfile = "$tempdir/$tmpprog.val";
@@ -474,12 +467,12 @@
my ($relabs, $relshared);
my ($prefix);
my $return;
-
+ my $sharedextension=$^O eq 'MSWin32' ? '.lib':$Config{so};
($prefix = $file) =~ s"(.*)\.pm"$1";
my ($tmp, $modname) = ($prefix =~ m"(?:(.*)[\\/]){0,1}(.*)"s);
- $relshared = "$pathsep$prefix$pathsep$modname.$Config{so}";
+ $relshared = "$pathsep$prefix$pathsep$modname$sharedextension";
$relabs = "$pathsep$prefix$pathsep$modname$Config{_a}";
# HACK . WHY DOES _a HAVE A '.'
# AND so HAVE NONE??
@@ -614,7 +607,7 @@
one file the names clash)\n");
}
- if ($options->{'e'} && ($options->{'sav'} || $options->{'gen'}) && ò0
+ if ($options->{'e'} && ($options->{'sav'} || $options->{'gen'}) &&
!$options->{'C'})
{
push(@errors,
@@ -766,7 +759,7 @@
sub _interruptrun
{
my ($command) = @_;
- my $pid = open (FD, "$command 2|");
+ my $pid = open (FD, "$command |");
local($SIG{HUP}) = sub {
# kill 9, $pid + 1;
Thread Next
-
[patch _61] perlcc changes
by Vishal Bhatia