-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.PL
More file actions
221 lines (195 loc) · 8.04 KB
/
Copy pathMakefile.PL
File metadata and controls
221 lines (195 loc) · 8.04 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
# ---------------------------------------------------------------------------
# Install-time C build support.
#
# When Inline::C is usable at configure time (and IF_NO_C isn't set), the
# generated Makefile gains a rule that compiles the Inline::C backend once
# during `make` and installs the shared object with the distribution, so
# users never pay the first-load compile and need neither a C compiler nor
# the Inline modules at run time.
#
# The IF_* environment variables (IF_OPT, IF_ARCH, IF_NATIVE, IF_NO_OPENMP)
# are captured *now* -- set them when running `perl Makefile.PL`, not
# `make` -- and recorded in the generated
# Algorithm::Classifier::IsolationForest::BuildFlags module. At run time
# those recorded values are the defaults: a process requesting the same
# flags loads the prebuilt object via XSLoader; one requesting different
# flags (or setting IF_RUNTIME_BUILD=1) falls back to the classic runtime
# Inline::C build under _Inline/. Validation mirrors the module's own,
# since these values reach a compiler command line.
# ---------------------------------------------------------------------------
my $if_opt = '-O3';
if ( defined $ENV{IF_OPT} ) {
if ( $ENV{IF_OPT} =~ /\A-O[0123sgz]\z/ ) {
$if_opt = $ENV{IF_OPT};
} else {
warn "Makefile.PL: ignoring invalid IF_OPT value '$ENV{IF_OPT}' "
. "(expected one of -O0 -O1 -O2 -O3 -Os -Og -Oz); using $if_opt\n";
}
}
my $if_arch = '';
if ( defined $ENV{IF_ARCH} ) {
if ( $ENV{IF_ARCH} eq '' or $ENV{IF_ARCH} eq 'none' ) {
$if_arch = ''; # explicit opt-out, same as the module's handling
} elsif ( $ENV{IF_ARCH} =~ /\A[A-Za-z0-9_.+=-]+\z/ ) {
$if_arch = $ENV{IF_ARCH};
} else {
warn "Makefile.PL: ignoring invalid IF_ARCH value '$ENV{IF_ARCH}'\n";
}
} elsif ( $ENV{IF_NATIVE} ) {
$if_arch = 'native';
}
my $if_no_openmp = $ENV{IF_NO_OPENMP} ? 1 : 0;
# The install-time build needs Inline::C at make time and a Makefile rule
# syntax (env assignment prefixing the command) that nmake doesn't grok;
# without it the module simply keeps its historic behaviour of compiling
# at first load when Inline::C is present then.
my $prebuilt
= ( !$ENV{IF_NO_C} && $^O ne 'MSWin32' && eval { require Inline; Inline->VERSION('0.44'); require Inline::C; 1 } )
? 1
: 0;
# Record the captured configuration where the module can read it at load
# time. Generated before WriteMakefile so ExtUtils::MakeMaker's lib/ scan
# picks it up for blib and install. Not in MANIFEST: it is per-install
# state, never shipped.
my $bf_path = 'lib/Algorithm/Classifier/IsolationForest/BuildFlags.pm';
open my $bf_fh, '>', $bf_path
or die "Makefile.PL: can't write $bf_path: $!";
print $bf_fh <<"BUILDFLAGS";
package Algorithm::Classifier::IsolationForest::BuildFlags;
# AUTOGENERATED by Makefile.PL -- do not edit and do not add to MANIFEST.
# Records per-install C build configuration; regenerate by re-running
# `perl Makefile.PL` (with IF_* environment variables as desired).
use strict;
use warnings;
=head1 NAME
Algorithm::Classifier::IsolationForest::BuildFlags - C build flags captured at configure time
=head1 DESCRIPTION
Autogenerated by Makefile.PL. Records the IF_* environment values that
were active when the distribution was configured, and whether a prebuilt
Inline::C object was scheduled for installation. Read once by
Algorithm::Classifier::IsolationForest at load time; see "NATIVE
ACCELERATION" in that module's documentation.
=head1 FUNCTIONS
=head2 flags
Returns a hashref with the keys C<opt>, C<arch>, C<no_openmp>, and
C<prebuilt>.
=cut
sub flags {
return {
opt => '$if_opt',
arch => '$if_arch',
no_openmp => $if_no_openmp,
prebuilt => $prebuilt,
};
}
1;
BUILDFLAGS
close $bf_fh or die "Makefile.PL: closing $bf_path failed: $!";
# Appended to the Makefile when the install-time build is on. Modelled on
# what Inline::MakeMaker generates, with two differences: only the one
# module that actually embeds C gets a rule (Inline::MakeMaker emits one
# per .pm in lib/), and install mode is signalled to the module via
# IF_INSTALL_BUILD=1 in the rule's environment instead of a global
# -MInline=_INSTALL_ import, so the module can pass Inline's _INSTALL_
# config itself alongside NAME/VERSION. Inline's install mode reads the
# version and blib/arch destination from @ARGV. The trailing -e writes a
# stub .inl file satisfying the make dependency (also what
# Inline::MakeMaker does); the compiled object itself lands under
# blib/arch/auto/ and is picked up by `make install`.
sub MY::postamble {
return '' unless $prebuilt;
return <<'POSTAMBLE';
# --- Inline::C install-time build (generated by Makefile.PL):
Algorithm-Classifier-IsolationForest.inl : pm_to_blib
IF_INSTALL_BUILD=1 $(PERL) "-Mblib" "-MAlgorithm::Classifier::IsolationForest" -e"require Inline; my %A = (modinlname => 'Algorithm-Classifier-IsolationForest.inl', module => 'Algorithm::Classifier::IsolationForest'); my %S = (API => \%A); Inline::satisfy_makefile_dep(\%S);" $(VERSION) $(INST_ARCHLIB)
dynamic :: Algorithm-Classifier-IsolationForest.inl
POSTAMBLE
} ## end sub MY::postamble
my %WriteMakefileArgs = (
NAME => 'Algorithm::Classifier::IsolationForest',
AUTHOR => q{Zane C. Bowers-Hadley <vvelox@vvelox.net>},
VERSION_FROM => 'lib/Algorithm/Classifier/IsolationForest.pm',
ABSTRACT_FROM => 'lib/Algorithm/Classifier/IsolationForest.pm',
LICENSE => 'lgpl_2_1',
MIN_PERL_VERSION => '5.006',
INST_SCRIPT => 'bin',
EXE_FILES => ['src_bin/iforest'],
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => '0',
},
TEST_REQUIRES => {
'Test::More' => '0',
'File::Temp' => '0',
'JSON::PP' => '0',
'List::Util' => '0',
},
PREREQ_PM => {
'App::Cmd' => '0',
'Carp' => '0',
'Config' => '0',
'File::Slurp' => '0',
'File::Spec' => '0',
'File::Temp' => '0',
'JSON::PP' => '0',
# iforest streamd's wire protocol; XS-backed JSON when available,
# pure-Perl JSON::PP fallback otherwise, so it is safe as a hard
# prereq (streamd itself also degrades to a clear error without it).
'JSON::MaybeXS' => '0',
'List::Util' => '0',
'POSIX' => '0',
'Scalar::Util' => '0',
'Storable' => '0',
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => {
FILES => 'Algorithm-Classifier-IsolationForest-* *.inl '
. 'lib/Algorithm/Classifier/IsolationForest/BuildFlags.pm'
},
META_MERGE => {
"meta-spec" => { version => 2 },
prereqs => {
runtime => {
# Inline / Inline::C unlock the native scoring backend
# (and OpenMP parallel tree-walk if libgomp is available
# at build time). The pure-Perl fallback works without
# them, just slower, so they are recommends rather than
# hard requires.
recommends => {
'Inline' => '0',
'Inline::C' => '0',
# Unlocks the mungers knob: declarative raw-value ->
# number munging for tagged data, with the spec saved
# in the model. Everything else works without it.
'Algorithm::ToNumberMunger' => '0.0.1',
},
},
},
resources => {
repository => {
type => 'git',
url => 'git@github.com:LilithSec/Algorithm-Classifier-IsolationForest.git',
web => 'https://github.com/LilithSec/Algorithm-Classifier-IsolationForest',
},
},
}
);
# Compatibility with old versions of ExtUtils::MakeMaker
unless ( eval { ExtUtils::MakeMaker->VERSION('6.64'); 1 } ) {
my $test_requires = delete $WriteMakefileArgs{TEST_REQUIRES} || {};
@{ $WriteMakefileArgs{PREREQ_PM} }{ keys %$test_requires } = values %$test_requires;
}
unless ( eval { ExtUtils::MakeMaker->VERSION('6.55_03'); 1 } ) {
my $build_requires = delete $WriteMakefileArgs{BUILD_REQUIRES} || {};
@{ $WriteMakefileArgs{PREREQ_PM} }{ keys %$build_requires } = values %$build_requires;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION('6.52'); 1 };
delete $WriteMakefileArgs{MIN_PERL_VERSION}
unless eval { ExtUtils::MakeMaker->VERSION('6.48'); 1 };
delete $WriteMakefileArgs{LICENSE}
unless eval { ExtUtils::MakeMaker->VERSION('6.31'); 1 };
WriteMakefile(%WriteMakefileArgs);