Permalink
Browse files

made share_dir which may hold libraries, and config_data('libs') prop…

…erty to tell Alien::GSL to use 'system' (`gsl-config`) or 'share_dir' to find the libs
  • Loading branch information...
1 parent 37c9d7f commit 73a6916ced7794824d4efe0f6ee90e15745d7ff5 @jberger jberger committed Oct 13, 2011
Showing with 19 additions and 6 deletions.
  1. +1 −0 Build.PL
  2. +6 −1 builder/My/Builder.pm
  3. +3 −1 builder/My/Builder/Unix.pm
  4. +8 −4 builder/My/Builder/Windows.pm
  5. +1 −0 share_dir/README
View
1 Build.PL
@@ -43,6 +43,7 @@ my $builder = $builder_class->new(
'Force' => {default => 0},
'Version' => {default => 0},
},
+ share_dir => 'share_dir',
meta_merge => {
resources => {
repository => #{
View
7 builder/My/Builder.pm
@@ -13,11 +13,16 @@ use File::Temp ();
my $CMD_GSL_CONFIG = 'gsl-config';
+sub get_download_dir {
+ my $self = shift;
+ return File::Temp->newdir();
+}
+
sub ACTION_code {
my $self = shift;
if ($self->args('Force') or !$self->have_gsl_version) {
- my $download_dir = $self->args('Dir') || File::Temp->newdir();
+ my $download_dir = $self->args('Dir') || $self->get_download_dir();
my $fetch_args = {dir => $download_dir};
if ($self->args('Version')) {
View
4 builder/My/Builder/Unix.pm
@@ -47,6 +47,8 @@ sub gsl_make_install {
return 0;
}
+ $self->config_data( libs => 'system' );
+
return 1;
}
@@ -92,7 +94,7 @@ sub fetch {
my $self = shift;
my $opt = ref $_[0] ? shift : { @_ };
- my $dir = $opt->{dir} || File::Temp->newdir();
+ my $dir = $opt->{dir};
my $version = $opt->{version} || "";
my $file;
View
12 builder/My/Builder/Windows.pm
@@ -12,16 +12,16 @@ use Archive::Extract;
my $FILE_ROOT = 'http://ultrafast.phy.uic.edu/';
my $FILE = 'gsl-1-15-win.zip';
-sub get_gsl {
+sub get_download_dir {
my $self = shift;
-
+ return $self->{share_dir};
}
sub fetch {
my $self = shift;
my $opt = ref $_[0] ? shift : { @_ };
- my $dir = $opt->{dir} || File::Temp->newdir();
+ my $dir = $opt->{dir};
my $version = $opt->{version} || "";
local $CWD = "$dir";
@@ -32,6 +32,10 @@ sub fetch {
print "Extracting $FILE\n";
my $ae = Archive::Extract->new( archive => $FILE );
$ae->extract;
+
+ print "Removing archive\n";
+ $ae = undef;
+ unlink($FILE) or carp "Could not remove archive $FILE";
return $dir;
@@ -41,7 +45,7 @@ sub gsl_make_install {
my $self = shift;
my ($dir) = @_;
- $self->share_dir($dir);
+ $self->config_data(libs => 'share_dir');
return 1;
View
1 share_dir/README
@@ -0,0 +1 @@
+This file is provided so that git holds the empty directory

0 comments on commit 73a6916

Please sign in to comment.