move archname to SigarWrapper

This commit is contained in:
Doug MacEachern committed 2007-09-03 19:36:03 +00:00
1 parent 51cd482ece
commit 4a504e6cf4
3 files changed
+53 -57

No files matched your search

+6 -4
View File
@@ -1,9 +1,7 @@
use ExtUtils::MakeMaker;
use Config;
use File::Copy 'cp';
use lib qw(.. lib);
use Sigar::ArchName ();
use SigarWrapper ();
my $installdir;
@@ -22,7 +20,11 @@ else {
SigarWrapper::generate(Perl => '.');
my $archname = Sigar::ArchName->get_name();
my $archname = SigarWrapper::archname();
my $libname = 'sigar';
if ($archname) {
$libname .= '-' . $archname;
}
my $ccname = $Config{ccname};
@@ -34,7 +36,7 @@ my $define = {
WriteMakefile(
'NAME' => 'Sigar',
'VERSION_FROM' => 'Sigar.pm',
'LIBS' => ["-L$installdir/lib -lsigar-$archname"],
'LIBS' => ["-L$installdir/lib -l$libname"],
'INC' => "-I$installdir/include",
'DEFINE' => $define,
'depend' => { 'Sigar.c' => 'Sigar_generated.xs' },
-53
View File
@@ -1,53 +0,0 @@
package Sigar::ArchName;
use strict;
use Config;
sub get_name {
my $os = lc $^O;
my $vers = $Config{osvers};
my $arch = $Config{archname};
if ($os =~ /win32/) {
return 'x86-winnt';
}
elsif ($os =~ /linux/) {
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';
}
}
}
die "Unsupported platform";
}
1;
__END__