use SigarBuild.pm
This commit is contained in:
parent
b2a1f5cbd5
commit
349b7caaf6
|
@ -1,31 +1,43 @@
|
|||
use ExtUtils::MakeMaker;
|
||||
|
||||
use strict;
|
||||
use Config;
|
||||
use File::Basename qw(basename);
|
||||
use File::Copy qw(copy);
|
||||
use lib qw(.. lib);
|
||||
use SigarWrapper ();
|
||||
use SigarBuild ();
|
||||
|
||||
my $gen_xs = 'Sigar_generated.xs';
|
||||
my(@mm_args);
|
||||
my(@clean_files) = ($gen_xs);
|
||||
|
||||
my $installdir;
|
||||
if ($ARGV[0]) {
|
||||
$installdir = $ARGV[0];
|
||||
#link against installed libsigar
|
||||
my $installdir = $ARGV[0];
|
||||
@mm_args = (
|
||||
LIBS => ["-L$installdir/lib -lsigar"],
|
||||
INC => "-I$installdir/include",
|
||||
);
|
||||
}
|
||||
else {
|
||||
#check binary-dist location and svn source location
|
||||
for (qw(../../sigar-bin ../java/sigar-bin)) {
|
||||
if (-e $_) {
|
||||
$installdir = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
#all sources in Sigar.so
|
||||
my $flags = SigarBuild::flags();
|
||||
my(@inline_src) = SigarBuild::inline_src($flags);
|
||||
push @clean_files, @inline_src;
|
||||
my(@object) = ('Sigar.o', map { s/c$/o/; $_ } @inline_src);
|
||||
my(@libs) = map { "-l$_" } @{$flags->{libs}};
|
||||
|
||||
@mm_args = (
|
||||
OBJECT => "@object",
|
||||
LIBS => ["@libs"],
|
||||
INC => "@{$flags->{cppflags}}",
|
||||
dynamic_lib => { OTHERLDFLAGS => "@{$flags->{ldflags}}" },
|
||||
);
|
||||
}
|
||||
|
||||
SigarWrapper::generate(Perl => '.');
|
||||
|
||||
my $archname = SigarWrapper::archname();
|
||||
my $libname = 'sigar';
|
||||
if ($archname) {
|
||||
$libname .= '-' . $archname;
|
||||
}
|
||||
|
||||
my $ccname = $Config{ccname};
|
||||
|
||||
my $define = {
|
||||
|
@ -36,8 +48,8 @@ my $define = {
|
|||
WriteMakefile(
|
||||
'NAME' => 'Sigar',
|
||||
'VERSION_FROM' => 'Sigar.pm',
|
||||
'LIBS' => ["-L$installdir/lib -l$libname"],
|
||||
'INC' => "-I$installdir/include",
|
||||
'DEFINE' => $define,
|
||||
'depend' => { 'Sigar.c' => 'Sigar_generated.xs' },
|
||||
'depend' => { 'Sigar.c' => $gen_xs },
|
||||
'realclean' => { FILES => "@clean_files" },
|
||||
@mm_args,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue