Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build alt version of GSL with dynamic support #18

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,28 @@ my %WriteMakefileArgs = (
"CONFIGURE_REQUIRES" => {
"Alien::Build" => "2.21",
"Alien::Build::MM" => "2.21",
"ExtUtils::MakeMaker" => "6.52"
"ExtUtils::MakeMaker" => "6.52",
"Path::Tiny" => 0,
"Alien::Build::Plugin::Gather::Dino" => 0,
},
"DISTNAME" => "Alien-GSL",
"LICENSE" => "perl",
"NAME" => "Alien::GSL",
"PREREQ_PM" => {
"Alien::Base" => "2.21",
"Role::Tiny" => 0,
"Alien::Role::Dino" => 0,
},
"TEST_REQUIRES" => {
"ExtUtils::MakeMaker" => "6.52",
"Test2::V0" => 0,
"Test::Alien" => 0,
"Test::Alien::Diag" => 0,
},
"BUILD_REQUIRES" => {
"Path::Tiny" => 0,
"Alien::Build::Plugin::Gather::Dino" => 0,
},
"VERSION_FROM" => "lib/Alien/GSL.pm",
"test" => {
"TESTS" => "t/*.t"
Expand Down
20 changes: 20 additions & 0 deletions alienfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
use alienfile;
use Path::Tiny qw( path );

plugin 'PkgConfig' => (pkg_name => 'gsl');

configure {
requires 'Path::Tiny';
};

share {
start_url 'https://ftp.gnu.org/gnu/gsl';
plugin Download => (
Expand All @@ -11,5 +16,20 @@ share {
);
plugin Extract => 'tar.gz';
plugin 'Build::Autoconf';

build [
'%{configure} --enable-shared --enable-static',
'%{make}',
'%{make} install',
];

plugin 'Gather::IsolateDynamic';
plugin 'Gather::Dino';

after 'gather' => sub {
my($build) = @_;
my $pc = path("lib/pkgconfig/gsl.pc")->slurp;
$pc =~ s/\/lib/\/dynamic/g;
path("lib/pkgconfig/gsl-dynamic.pc")->spew($pc);
};
};
17 changes: 17 additions & 0 deletions lib/Alien/GSL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ our $VERSION = '1.07';

use base 'Alien::Base';

sub alt
{
my($self, $name) = @_;

return $self if $self->install_type eq 'system';

my $new = $self->SUPER::alt($name);

if($name eq 'gsl-dynamic')
{
require Role::Tiny;
Role::Tiny->apply_roles_to_object($new, 'Alien::Role::Dino');
}

$new;
}

1;

=head1 NAME
Expand Down