From 7f8bfd819547f962df798fb0ee2712511b1ef87e Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 4 Apr 2009 19:07:32 -0700 Subject: [PATCH] support build dir other than '.' --- bindings/SigarBuild.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bindings/SigarBuild.pm b/bindings/SigarBuild.pm index 46a07959..6f3497d1 100644 --- a/bindings/SigarBuild.pm +++ b/bindings/SigarBuild.pm @@ -4,6 +4,7 @@ use strict; use Exporter; use File::Basename qw(basename); use File::Copy qw(copy); +use File::Spec (); use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @@ -106,6 +107,7 @@ sub inline_src { my $stdout = @_ ? 0 : 1; my $flags = shift || flags(); my $src = $flags->{src}; + my $dir = $flags->{build_dir} || $ARGV[0]; my(@files); #unlink symlinks incase of nfs shared dir... for my $file (grep { -l } <*.c>) { @@ -116,7 +118,10 @@ sub inline_src { #sigar.c -> libsigar.c else #sigar.o and perl Sigar.o clash on case insensitive filesystems $cf = 'libsigar.c' if $cf eq 'sigar.c'; - + if ($dir) { + $cf = join '/', $dir, $cf; + $file = File::Spec->rel2abs($file); + } push @files, $cf; if ($flags->{is_win32}) { copy($file, $cf);