Permalink
Browse files

vms: port update almost finished

The remaining vms build failure is auto:snprintf.
vms does not provide this API.
  • Loading branch information...
1 parent aea60ba commit b8a7a7df6467ebcdd9286b96c29d4574cf9d78ef @mvorl mvorl committed with Reini Urban Sep 1, 2012
Showing with 83 additions and 15 deletions.
  1. +4 −0 config/auto/arch.pm
  2. +3 −1 config/auto/sizes.pm
  3. +6 −6 config/gen/core_pmcs.pm
  4. +58 −7 config/init/hints/vms.pm
  5. +12 −1 lib/Parrot/Configure/Utils.pm
View
@@ -95,6 +95,10 @@ sub runstep {
chomp($archname = `uname -p`);
$cpuarch = $archname;
}
+ elsif ( $osname =~ /^VMS/ ) {
+ ($cpuarch = $osname) =~ s/^VMS_//;
+ $osname = 'VMS';
+ }
if ( $archname =~ m/powerpc/ ) {
$cpuarch = 'ppc';
View
@@ -99,7 +99,9 @@ sub test_size {
sub _get_sizes {
my $conf = shift;
my %sizes = map { $_ => 0 } @_;
- $sizes{$_} = test_size($conf, $_) for keys %sizes;
+ for my $size (keys %sizes) {
+ $sizes{$size} = test_size($conf, $size);
+ }
return \%sizes;
}
View
@@ -43,7 +43,7 @@ sub generate_h {
my $file = 'include/parrot/core_pmcs.h';
$conf->append_configure_log($file);
- open( my $OUT, '>', "$file.tmp" );
+ open( my $OUT, '>', "${file}_tmp" );
print {$OUT} <<'END_H';
/*
@@ -77,7 +77,7 @@ END_H
close $OUT or die "Can't close file: $!";
- move_if_diff( "$file.tmp", $file );
+ move_if_diff( "${file}_tmp", $file );
return;
}
@@ -89,7 +89,7 @@ sub generate_c {
my @pmcs = split( qr/ /, $conf->data->get('pmc_names') );
$conf->append_configure_log($file);
- open( my $OUT, '>', "$file.tmp" );
+ open( my $OUT, '>', "${file}_tmp" );
print {$OUT} <<'END_C';
/*
@@ -144,7 +144,7 @@ END_C
close $OUT or die "Can't close file: $!";
- move_if_diff( "$file.tmp", $file );
+ move_if_diff( "${file}_tmp", $file );
return;
}
@@ -156,7 +156,7 @@ sub generate_pm {
my @pmcs = split( qr/ /, $conf->data->get('pmc_names') );
$conf->append_configure_log($file);
- open( my $OUT, '>', "$file.tmp" );
+ open( my $OUT, '>', "${file}_tmp" );
print $OUT <<'END_PM';
# DO NOT EDIT THIS FILE
@@ -189,7 +189,7 @@ END_PM
close $OUT or die "Can't close file: $!";
- move_if_diff( "$file.tmp", $file );
+ move_if_diff( "${file}_tmp", $file );
return;
}
View
@@ -5,28 +5,79 @@ package init::hints::vms;
use strict;
use warnings;
+use Carp;
+use lib ('lib');
+use Parrot::Configure::Utils qw(
+ _slurp
+ _run_command _build_compile_command
+);
+
sub runstep {
my ( $self, $conf ) = @_;
$conf->data->set(
ccflags => qq{/Prefix=All/Obj=.obj/NoList/include="./include"/nowarn},
+ link => 'LINK',
+ cc_exe_out => '/exec=',
perl => "MCR $^X",
- exe => ".exe"
+ exe => ".exe",
+ noinline => '',
+ make_set_make => '#',
);
{
local $^W; # no warnings on redefinition
*Parrot::Configure::Compiler::cc_build = sub {
- my $conf = shift;
- my ( $cc, $ccflags ) = $conf->data->get(qw(cc ccflags));
- system("$cc $ccflags test_$$.c") and die "C compiler died!";
- system("link test_$$") and die "Link failed!";
+ my $conf = shift;
+ my ( $cc_args, $link_args ) = @_;
+
+ $cc_args = '' unless defined $cc_args;
+ $link_args = '' unless defined $link_args;
+
+ my $verbose = $conf->options->get('verbose');
+
+ my ( $cc, $ccflags, $ldout, $o, $link, $linkflags, $cc_exe_out, $exe, $libs ) =
+ $conf->data->get(qw(cc ccflags ld_out o link linkflags cc_exe_out exe libs));
+
+ # unique test file name for parallel builds
+ my $test = 'test_' . $$;
+ my $compile_command = _build_compile_command( $cc, $ccflags, $cc_args );
+ my $compile_result = _run_command( $compile_command, "$test.cco", "$test.cco", $verbose );
+
+ if ($compile_result) {
+ confess "C compiler failed (see $test.cco)";
+ return $compile_result;
+ }
+
+ my $link_result =
+ _run_command( "$link $linkflags $test$o $link_args ${cc_exe_out}${test}${exe}",
+ "$test.ldo", "$test.ldo", $verbose )
+ and confess "Linker failed (see $test.ldo)";
+ if ($link_result) {
+ return $link_result;
+ }
};
*Parrot::Configure::Compiler::cc_run = sub {
- my $conf = shift;
- `mcr []test_$$`;
+ my $conf = shift;
+ my $exe = $conf->data->get('exe');
+ my $verbose = $conf->options->get('verbose');
+ my $test = 'test_' . $$;
+ my $test_exe = "MCR []${test}${exe}";
+
+ my $run_error;
+ if ( defined( $_[0] ) && length( $_[0] ) ) {
+ local $" = ' ';
+ $run_error = _run_command( "$test_exe @_", "./$test.out", undef, $verbose );
+ }
+ else {
+ $run_error = _run_command( $test_exe, "./$test.out", undef, $verbose );
+ }
+
+ my $output = _slurp("./$test.out");
+
+ return $output;
};
}
}
@@ -120,7 +120,18 @@ sub _build_compile_command {
$_ ||= '' for ( $cc, $ccflags, $cc_args );
if ($^O eq 'VMS') {
- $cc_args =~ s/-D/\/Define=/;
+ # Gather all -D and -I into two lists, and feed them
+ # into /Define and /Include qualifiers
+ my ( @defs, @incs );
+ $ccflags .= " $cc_args"; $cc_args = '';
+ push @defs, $1 while $ccflags =~ /-D(\S+)/g;
+ $ccflags =~ s/-D\S+//g;
+ push @incs, $1 while $ccflags =~ /-I(\S+)/g;
+ $ccflags =~ s/-I\S+//g;
+ $cc_args .= '/Define=("'.join('","', map {s/"/""/g; $_} @defs).'")'
+ if @defs;
+ $cc_args .= '/Include=("'.join('","',map {s/"/""/g; $_} @incs).'")'
+ if @incs;
}
else {
$cc_args .= "-I./include -c";

0 comments on commit b8a7a7d

Please sign in to comment.