-
Notifications
You must be signed in to change notification settings - Fork 0
/
alienfile
65 lines (54 loc) · 1.76 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
use strict;
use warnings;
use alienfile;
my $on_windows = $^O eq 'MSWin32';
plugin 'Probe::CommandLine' => (
command => 'patchelf',
);
share {
Alien::Build->log ('$ENV{ALIEN_BUILD_PRELOAD} = ' . ($ENV{ALIEN_BUILD_PRELOAD} // ''));
#my $version_filter = have_cpp17() ? qr/^([0-9\.]+)$/ : qr/^(0.13.1)$/;
#Alien::Build->log("version filter: $version_filter");
meta->prop->{start_url} = 'https://github.com/NixOS/patchelf.git';
plugin 'Download::Git' =>(
filter => get_version_filter(),
version => qr/^([0-9\.]+)$/,
);
my $config_call = '%{configure}';
requires 'Alien::Autotools';
plugin 'Build::Autoconf';
if ($on_windows) {
plugin 'Build::MSYS';
}
if ($^O =~ /solaris/i) {
plugin 'Build::Make' => 'gmake';
$config_call = "MAKE=gmake $config_call";
}
build [
'sh ./bootstrap.sh', # windows needs explicit shell call
$config_call,
'%{make}',
'%{make} install',
];
};
# Does the compiler support c++17?
# If not then fall back to an older version.
sub get_version_filter {
my $default_filter = qr/^([0-9\.]+)$/;
use ExtUtils::CppGuess 0.25;
my $cppg = ExtUtils::CppGuess->new();
if (!$cppg) {
Alien::Build->log ("Unable to detect C++ compiler using ExtUtils::CppGuess");
Alien::Build->log ("Using latest release which requires C++17 compiler support");
return $default_filter;
}
my $have_cpp_17 = eval {$cppg->cpp_standard_flag('C++17'); 1};
meta->prop->{my_have_cpp17} = $have_cpp_17;
if (!$have_cpp_17) {
Alien::Build->log("The c++ compiler does not support -std=c++17, falling back to patchelf 0.13.1");
}
else {
Alien::Build->log("The c++ compiler appears to support -std=c++17, using latest patchelf version");
}
return $have_cpp_17 ? $default_filter : qr/^(0.13.1)$/
}