support build dir other than '.'

This commit is contained in:
Doug MacEachern 2009-04-04 19:07:32 -07:00
parent 9eade5d21a
commit 7f8bfd8195
1 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ use strict;
use Exporter; use Exporter;
use File::Basename qw(basename); use File::Basename qw(basename);
use File::Copy qw(copy); use File::Copy qw(copy);
use File::Spec ();
use vars qw(@ISA @EXPORT); use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter); @ISA = qw(Exporter);
@ -106,6 +107,7 @@ sub inline_src {
my $stdout = @_ ? 0 : 1; my $stdout = @_ ? 0 : 1;
my $flags = shift || flags(); my $flags = shift || flags();
my $src = $flags->{src}; my $src = $flags->{src};
my $dir = $flags->{build_dir} || $ARGV[0];
my(@files); my(@files);
#unlink symlinks incase of nfs shared dir... #unlink symlinks incase of nfs shared dir...
for my $file (grep { -l } <*.c>) { for my $file (grep { -l } <*.c>) {
@ -116,7 +118,10 @@ sub inline_src {
#sigar.c -> libsigar.c else #sigar.c -> libsigar.c else
#sigar.o and perl Sigar.o clash on case insensitive filesystems #sigar.o and perl Sigar.o clash on case insensitive filesystems
$cf = 'libsigar.c' if $cf eq 'sigar.c'; $cf = 'libsigar.c' if $cf eq 'sigar.c';
if ($dir) {
$cf = join '/', $dir, $cf;
$file = File::Spec->rel2abs($file);
}
push @files, $cf; push @files, $cf;
if ($flags->{is_win32}) { if ($flags->{is_win32}) {
copy($file, $cf); copy($file, $cf);