Skip to content

Commit

Permalink
Merge pull request #477 from mstovenour/add_strawberry_perl_support
Browse files Browse the repository at this point in the history
Add strawberry perl support
  • Loading branch information
hollie committed Mar 2, 2015
2 parents 06ef5c8 + c62f02e commit 166950b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 11 deletions.
25 changes: 22 additions & 3 deletions bin/mh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,25 @@ sub RRDs::error;
sub ReadMode {}; # In case Readkey is not installed
sub ReadKey {};

#Provide a BuildNumber function with output similar to the
#ActiveState Perl Win32::BuildNumber for running on other
#Windows Perl ports (e.g. Strawberry perl)
sub buildNumber {
if( defined &Win32::BuildNumber) {
return &Win32::BuildNumber;
} elsif( defined $^V) {
my ($major,$minor, $patch) = split('\.',sprintf( "%vd", $^V));
$patch = sprintf("%02d",$patch);
return ($minor.$patch)*1;
} else {
my ($major,$minor_patch) = split('\.',$]);
my ($minor, $patch) = ($minor_patch =~ /(.{1,3})/g);
$minor = sprintf("%02d",$minor);
$patch = sprintf("%02d",$patch);
return( ($minor.$patch)*1);
}
}

BEGIN {
&setup_INC;
&check_for_run_cmd;
Expand All @@ -180,7 +199,7 @@ BEGIN {
# push (@INC, './../lib', './../lib/site', '.');
# push (@INC, './../lib');
if ($^O eq 'MSWin32') {
my $build = &Win32::BuildNumber;
my $build = buildNumber();
if ($build < 600) {
push @INC, "${Pgm_Path}/../lib/site_win50";
}
Expand Down Expand Up @@ -274,7 +293,7 @@ BEGIN {
print "Pgm version: $Version \nLast updated: $Version_date\n";
$Info{Perl_version} = $];
# Use eval to avoid problems with earlier version (e.g. build 502)
$Info{Perl_version} .= " Build " . eval "&Win32::BuildNumber()" if $OS_win;
$Info{Perl_version} .= " Build " . buildNumber() if $OS_win;
print "Perl version: $Info{Perl_version}\n";
print "OS version: $^O $Info{OS_name} $Info{OS_version} $Info{OS_filesystem}\n";
print "Other : user=$Info{User} pid=$$ box=$Info{Machine} cpu=$ENV{PROCESSOR_ARCHITECTURE}-$ENV{PROCESSOR_LEVEL}\n";
Expand Down Expand Up @@ -487,7 +506,7 @@ EOF
# - For some reason, perl2exe binary abends here, so we evaled it earlier
eval "use Win32::Setupsup qw(WaitForAnyWindow SendKeys EnumChildWindows SetFocus SetWindowText GetWindowText)"
unless $Info{Perl_compiled};
print "\nError in loading module=Win32::Setupsup:\n $@\n" if $@; # and &Win32::BuildNumber < 580;
print "\nError in loading module=Win32::Setupsup:\n $@\n" if $@;

eval "use Win32::Sound";
print "\nError in loading module=Win32::Sound:\n $@\n" if $@;
Expand Down
33 changes: 28 additions & 5 deletions bin/print_socket_fork_memmap.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,44 @@
# string in via a memory map, rather than a slow external file read and write.

my ($Pgm_Path, $Pgm_Name);

#Provide a BuildNumber function with output similar to the
#ActiveState Perl Win32::BuildNumber for running on other
#Windows Perl ports (e.g. Strawberry perl)
sub buildNumber {
if( defined &Win32::BuildNumber) {
return &Win32::BuildNumber;
} elsif( defined $^V) {
my ($major,$minor, $patch) = split('\.',sprintf( "%vd", $^V));
$patch = sprintf("%02d",$patch);
return ($minor.$patch)*1;
} else {
my ($major,$minor_patch) = split('\.',$]);
my ($minor, $patch) = ($minor_patch =~ /(.{1,3})/g);
$minor = sprintf("%02d",$minor);
$patch = sprintf("%02d",$patch);
return( ($minor.$patch)*1);
}
}

BEGIN {
($Pgm_Path, $Pgm_Name) = $0 =~ /(.*)[\\\/](.*)\.?/;
$Pgm_Path = '.' unless $Pgm_Path;

# Need to set up INC so we can find the MemMap module
my $build = &Win32::BuildNumber;
my $build = buildNumber();
if ($build < 600) {
push @INC, './../lib/site_win50';
push @INC, './../lib/site_win50';
}
elsif ($build < 800) {
push @INC, './../lib/site_win56';
push @INC, './../lib/site_win56';
}
else {
push @INC, './../lib/site_win58';
elsif ($build < 900) {
push @INC, './../lib/site_win58';
}
elsif ($build < 1300 and $build > 1199) {
push @INC, "./../lib/site_win512";
}
push @INC, './../lib/site';
push @INC, './../lib';
}
Expand Down
5 changes: 2 additions & 3 deletions lib/Process_Item.pm
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ sub start_next {
my ($cmd_path, $cmd_args);

if ($type eq 'eval') {
if ($main::OS_win and ($ENV{sourceExe} or &Win32::BuildNumber() < 600)) {
my $msg = "Sorry, {Process_Item eval fork only supported with windows perl build 5.6 or later.\n cmd=$cmd";
print "$msg\n";
if ($main::OS_win ) {
my $msg = "Sorry, Process_Item eval fork only supported with linux.\n cmd=$cmd";
&main::print_log($msg);
return;
}
Expand Down

0 comments on commit 166950b

Please sign in to comment.