-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.PL
executable file
·89 lines (79 loc) · 2.35 KB
/
Makefile.PL
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
use strict;
use warnings;
use ExtUtils::MakeMaker;
use PDL::Core::Dev;
my $libs = $ENV{TALIB_LIBS};
my $cflags = $ENV{TALIB_CFLAGS};
eval { require Alien::TALib };
if ( !$@ ) {
warn "Using ta-lib via Alien::TALib\n";
my $alien = Alien::TALib->new;
$libs = $alien->libs_static // $alien->libs if !defined $libs;
$cflags = $alien->cflags if !defined $cflags;
}
else {
warn "Alien::TALib not found, trying ta-lib-config\n";
if (!defined $libs) {
$libs = `ta-lib-config --libs`;
$libs =~ s/[\s\n\r]*$//;
#XXX-HACK fixing broken ta-lib-config output
$libs .= " -lta_lib" if $libs && $libs !~ /-lta_lib/;
}
if (!defined $cflags) {
$cflags = `ta-lib-config --cflags`;
$cflags =~ s/[\s\n\r]*$//;
}
}
unless ($libs) {
warn "\nERROR: ta-lib not found on your system!\n\n";
exit 0;
}
warn "Gonna use\n",
" cflags: '$cflags'\n",
" libs: '$libs'\n";
my $package = [qw/TA.pd TA PDL::Finance::TA/];
my %eumm_args = pdlpp_stdargs($package);
$eumm_args{INC} .= " $cflags";
unshift @{$eumm_args{LIBS}}, $libs;
WriteMakefile(
%eumm_args,
VERSION_FROM => 'TA.pd',
AUTHOR => 'KMX <[email protected]>',
ABSTRACT => 'PDL interface to ta-lib library',
LICENSE => 'perl',
PREREQ_PM => {
'PDL' => '2.006',
'Alien::TALib' => '0.12',
},
BUILD_REQUIRES => {
'PDL' => '2.006',
'Test::More' => '0',
'Test::Number::Delta' => '1.06',
'Alien::TALib' => '0.12',
},
CONFIGURE_REQUIRES => {
'PDL' => '2.006',
'Alien::TALib' => '0.12',
},
META_MERGE => {
resources => {
repository => 'https://github.com/kmx/pdl-finance-ta',
},
},
dist => {
($^O eq 'MSWin32' ? (TAR => 'ptar', TARFLAGS => '-c -C -f') : ()),
PREOP => '$(MKPATH) $(DISTVNAME)/GENERATED'
. ' && $(PERL) "-MPDL::PP qw[PDL::Finance::TA PDL::Finance::TA $(DISTVNAME)/GENERATED/TA]" TA.pd'
. ' && $(RM_F) $(DISTVNAME)/GENERATED/*.xs'
. ' && perldoc -u $(DISTVNAME)/GENERATED/TA.pm | pod2markdown > README.md'
#. ' && pod2text $(DISTVNAME)/GENERATED/TA.pm > README'
},
);
sub MY::postamble {
pdlpp_postamble($package) . <<'END'
README.md:
$(PERL) "-MPDL::PP qw/PDL::Finance::TA PDL::Finance::TA TMP/" TA.pd
perldoc -u TMP.pm | pod2markdown > README.md
$(RM_F) TMP.pm TMP.xs
END
}