-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalienfile
68 lines (58 loc) · 1.91 KB
/
alienfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use alienfile;
plugin 'Probe::CBuilder' => (
libs => $_->{libs},
cflags => $_->{cflags},
version => qr/version = '(.*?)'/,
program => <<'EOM'
#include <stdio.h>
#include <gmp.h>
int
main(int argc, char *argv[])
{
printf("version = '%s'\n", gmp_version);
return 0;
}
EOM
) for ({ libs => '-lgmp', cflags => '' }, { libs => '-lgmp', cflags => '-I/usr/include/gmp' });
share {
requires 'Alien::m4' => '0.08';
plugin Download => (
url => 'https://ftp.gnu.org/gnu/gmp',
filter => qr/^gmp-.*\.tar\.bz2$/,
version => qr/([0-9\.]+)/,
);
plugin Extract => 'tar.bz2',
plugin 'Build::Autoconf' => ();
build [
'%{configure} --enable-shared --enable-static --enable-cxx=detect',
'%{make}',
'%{make} check',
'%{make} install',
];
plugin 'Gather::IsolateDynamic';
gather sub {
my($build) = @_;
$build->runtime_prop->{$_} = "-I@{[ $build->runtime_prop->{prefix} ]}/include " for qw( cflags cflags_static );
$build->runtime_prop->{$_} = "-L@{[ $build->runtime_prop->{prefix} ]}/lib -lgmp " for qw( libs libs_static );
if(-e 'include/gmpxx.h')
{
$build->runtime_prop->{alt}->{gmp}->{$_} = $build->runtime_prop->{$_} for qw( cflags cflags_static libs libs_static );
$build->runtime_prop->{alt}->{gmpxx}->{$_} = "-I@{[ $build->runtime_prop->{prefix} ]}/include " for qw( cflags cflags_static );
$build->runtime_prop->{alt}->{gmpxx}->{$_} = "-L@{[ $build->runtime_prop->{prefix} ]}/lib -lgmpxx " for qw( libs libs_static );
}
};
};
sys {
requires 'Devel::CheckLib';
meta->after_hook(
gather_system => sub {
my($build) = @_;
$build->runtime_prop->{legacy}->{name} = 'gmp';
if(Devel::CheckLib::check_lib( lib => 'gmpxx'))
{
$build->runtime_prop->{alt}->{gmp}->{$_} = $build->runtime_prop->{$_} for qw( cflags libs );
$build->runtime_prop->{alt}->{gmpxx}->{$_} = "-lgmpxx " for qw( libs );
}
},
);
};