move sub archname to SigarBuild.pm

This commit is contained in:
Doug MacEachern 2009-04-15 18:49:10 -07:00
parent 6f9a8423fb
commit dc2d72f66b
2 changed files with 52 additions and 52 deletions

View File

@ -1,6 +1,7 @@
package SigarBuild; package SigarBuild;
use strict; use strict;
use Config;
use Exporter; use Exporter;
use File::Basename qw(basename); use File::Basename qw(basename);
use File::Copy qw(copy); use File::Copy qw(copy);
@ -11,6 +12,57 @@ use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter); @ISA = qw(Exporter);
@EXPORT = qw(cppflags ldflags libs os src inline_src); @EXPORT = qw(cppflags ldflags libs os src inline_src);
sub archname {
my $os = lc $^O;
my $vers = $Config{osvers};
my $arch = $Config{archname};
if ($os =~ /win32/) {
return 'x86-winnt';
}
elsif ($os =~ /linux/) {
if ($arch =~ /_64/) {
return 'amd64-linux';
}
else {
return 'x86-linux';
}
}
elsif ($os =~ /hpux/) {
if ($vers =~ /11\./) {
return 'pa-hpux-11';
}
}
elsif ($os =~ /aix/) {
return 'ppc-aix-5';
}
elsif ($os =~ /solaris/) {
if ($arch =~ /sun4/) {
return 'sparc-solaris';
}
elsif ($arch =~ /.86/) {
return 'x86-solaris';
}
}
elsif ($os =~ /darwin/) {
return 'universal-macosx';
}
elsif ($os =~ /freebsd/) {
if ($arch =~ /.86/) {
if($vers =~ /6\../ ) {
return 'x86-freebsd-6';
}
}
elsif ($arch =~ /amd64/) {
if ($vers =~ /6\../ ) {
return 'amd64-freebsd-6';
}
}
}
return '';
}
sub flags { sub flags {
my $os = lc $^O; my $os = lc $^O;
my $is_win32 = 0; my $is_win32 = 0;

View File

@ -2,7 +2,6 @@
package SigarWrapper; package SigarWrapper;
use strict; use strict;
use Config;
use Cwd; use Cwd;
use Exporter; use Exporter;
use File::Path; use File::Path;
@ -12,57 +11,6 @@ use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter); @ISA = qw(Exporter);
@EXPORT = qw(generate); @EXPORT = qw(generate);
sub archname {
my $os = lc $^O;
my $vers = $Config{osvers};
my $arch = $Config{archname};
if ($os =~ /win32/) {
return 'x86-winnt';
}
elsif ($os =~ /linux/) {
if ($arch =~ /_64/) {
return 'amd64-linux';
}
else {
return 'x86-linux';
}
}
elsif ($os =~ /hpux/) {
if ($vers =~ /11\./) {
return 'pa-hpux-11';
}
}
elsif ($os =~ /aix/) {
return 'ppc-aix-5';
}
elsif ($os =~ /solaris/) {
if ($arch =~ /sun4/) {
return 'sparc-solaris';
}
elsif ($arch =~ /.86/) {
return 'x86-solaris';
}
}
elsif ($os =~ /darwin/) {
return 'universal-macosx';
}
elsif ($os =~ /freebsd/) {
if($arch =~ /.86/) {
if($vers =~ /6\../ ) {
return 'x86-freebsd-6';
}
}
elsif( $arch =~ /amd64/) {
if($vers =~ /6\../ ) {
return 'amd64-freebsd-6';
}
}
}
return '';
}
my %platforms = ( my %platforms = (
A => "AIX", A => "AIX",
D => "Darwin", D => "Darwin",