Debian Codegraph @

Makefile.PL

raw
1 use strict;
2 use warnings;
3 use Config;
4 use Devel::CheckLib;
5 use ExtUtils::MakeMaker;
6
7 # buffering will ruin your day!
8 select STDERR; $|=1;
9 select STDOUT; $|=1;
10
11 # prereqs
12 my $CONF_version = 0; # Config
13 my $DL_version = 0; # DynaLoader
14 my $EX_version = 0; # Exporter
15 my $FS_version = 0; # File::Spec
16 my $HRT_version = 0; # Time::HiRes
17 my $DC_version = '1.14'; # Devel::CheckLib
18 my $EUMM_version = '7.06'; # ExtUtils::MakeMaker
19 my $FT_version = '0.10'; # File::Temp
20 my $V_version = '0.77'; # version
21
22 my $UUID_version = get_uuidpm_version();
23
24 my $no_mymeta = -e '.no-mymeta';
25
26 my ($libs, $defines) = check_flags();
27 my $has_threads = check_threads();
28
29 WriteMakefile1(
30 'NAME' => 'UUID',
31 'AUTHOR' => 'Rick Myers <[email protected]>',
32 'VERSION_FROM' => 'lib/UUID.pm',
33 'ABSTRACT_FROM' => 'lib/UUID.pm',
34 'LICENSE' => 'artistic_2',
35
36 # It's currently unknown how far back the code will run (at least
37 # 5.8.9), but needs perl-5.8.1 or better to test due to Unicode
38 # regexps used in Term::Table, which is included via Test::More.
39 # Devel::CheckLib also uses Test::More so not much point avoiding the
40 # inevitable.
41 #
42 # Otherwise, this code needs at least perl-5.5.63 to get the required
43 # data types.
44 #
45 #'MIN_PERL_VERSION' => '5.005063', # for U64
46 'MIN_PERL_VERSION' => '5.008001', # for Term::Table, which uses Unicode regexps
47
48 'LIBS' => $libs,
49 'NO_MYMETA' => $no_mymeta,
50 'INC' => '-I.',
51 'CCFLAGS' => $Config{ccflags},
52 'DEFINE' => $defines,
53 'OBJECT' => '$(O_FILES)',
54 'LDFROM' => join( ' ', qw{
55 lib/UUID.o
56 ulib/atomic.o ulib/chacha.o ulib/clock.o ulib/compare.o
57 ulib/gen.o ulib/gettime.o ulib/hash.o ulib/node.o ulib/pack.o
58 ulib/parse.o ulib/splitmix.o ulib/sysrand.o ulib/util.o
59 ulib/xoshiro.o
60 }),
61 'C' => [qw{
62 lib/UUID.c
63 ulib/atomic.c ulib/chacha.c ulib/clock.c ulib/compare.c
64 ulib/gen.c ulib/gettime.c ulib/hash.c ulib/node.c ulib/pack.c
65 ulib/parse.c ulib/splitmix.c ulib/sysrand.c ulib/util.c
66 ulib/xoshiro.c
67 }],
68 'H' => [qw{
69 ulib/EUMM.h ulib/FUTX.h ulib/PORT.h ulib/TYPE.h ulib/UMTX.h ulib/UUID.h
70 ulib/atomic.h ulib/chacha.h ulib/clock.h ulib/compare.h
71 ulib/gen.h ulib/gettime.h ulib/hash.h ulib/node.h ulib/pack.h
72 ulib/parse.h ulib/splitmix.h ulib/sysrand.h ulib/util.h
73 ulib/xoshiro.h
74 ulib/arch/arm/atomic.h ulib/arch/x86/atomic.h
75 }],
76 'PREREQ_PM' => {
77 'Carp' => 0,
78 'DynaLoader' => $DL_version,
79 'Exporter' => $EX_version,
80 'Time::HiRes' => $HRT_version,
81 'blib' => 0,
82 'strict' => 0,
83 'vars' => 0,
84 'warnings' => 0,
85 },
86 'CONFIGURE_REQUIRES' => {
87 'Config' => $CONF_version,
88 'Devel::CheckLib' => $DC_version,
89 'ExtUtils::MakeMaker' => $EUMM_version,
90 'File::Spec' => $FS_version,
91 'File::Temp' => $FT_version,
92 'strict' => 0,
93 'warnings' => 0,
94 },
95 'BUILD_REQUIRES' => {
96 'Config' => $CONF_version,
97 'Devel::CheckLib' => $DC_version,
98 'ExtUtils::MakeMaker' => $EUMM_version,
99 'File::Spec' => $FS_version,
100 'File::Temp' => $FT_version,
101 'blib' => 0,
102 'strict' => 0,
103 'warnings' => 0,
104 },
105 'TEST_REQUIRES' => {
106 'Benchmark' => 0,
107 'Config' => $CONF_version,
108 'CPAN::Meta' => 0,
109 'DynaLoader' => $DL_version,
110 'Exporter' => $EX_version,
111 'Fcntl' => 0,
112 'ExtUtils::Manifest' => 0,
113 'File::Spec' => $FS_version,
114 'File::Temp' => $FT_version,
115 'Time::HiRes' => $HRT_version,
116 'Try::Tiny' => 0,
117 'blib' => 0,
118 'strict' => 0,
119 'vars' => 0,
120 'version' => $V_version,
121 'warnings' => 0,
122 ( $has_threads
123 ? (
124 'threads' => 0,
125 'threads::shared' => 0,
126 'Thread::Semaphore' => 0,
127 )
128 : ()
129 ),
130 },
131 'META_MERGE' => {
132 'dynamic_config' => 0,
133 'provides' => {
134 'UUID' => {
135 'file' => 'lib/UUID.pm',
136 'version' => $UUID_version,
137 },
138 },
139 },
140 'realclean' => {
141 'FILES' => join( ' ', sort qw{
142 LICENSE_new
143 META_new.json
144 META_new.yml
145 README_new
146 README_new.bak
147 lib/UUID.c
148 lib/UUID.def
149 lib/UUID_def.old
150 lib/UUID.o
151 lib/UUID.obj
152 lib/UUID.pdb
153 lib/UUID.xsc
154 assertconf*.h
155 assertconf*.txt
156 assertlib*.c
157 assertlib*.exe
158 assertlib*.obj
159 perl.core
160 perl.exe.stackdump
161 ulib/*.obj
162 ulib/*.pdb
163 ulib/EUMM.h
164 ulib/EUMM.h.tmp
165 uu_to_blib
166 }),
167 },
168 );
169
170 unlink($_) for <assertlib*.obj>;
171
172 exit 0;
173
174 sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
175 my %params=@_;
176 my $eumm_version=$ExtUtils::MakeMaker::VERSION;
177 $eumm_version=eval $eumm_version;
178 die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
179 die "LICENSE not specified" if not exists $params{LICENSE};
180 if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
181 #EUMM 6.5502 has problems with BUILD_REQUIRES
182 $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
183 delete $params{BUILD_REQUIRES};
184 }
185 delete $params{TEST_REQUIRES} if $eumm_version < 6.64;
186 delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
187 delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
188 delete $params{META_MERGE} if $eumm_version < 6.46;
189 delete $params{META_ADD} if $eumm_version < 6.46;
190 delete $params{LICENSE} if $eumm_version < 6.31;
191 delete $params{NO_MYMETA} if $eumm_version < 6.58;
192 delete $params{AUTHOR} if $] < 5.005;
193 delete $params{ABSTRACT_FROM} if $] < 5.005;
194 delete $params{BINARY_LOCATION} if $] < 5.005;
195
196 WriteMakefile(%params);
197 }
198
199 sub get_uuidpm_version {
200 my $fn = 'lib/UUID.pm';
201 open my $fh, '<', $fn or die "open: $fn: $!";
202 while (<$fh>) {
203 # $VERSION = '0.30_02';
204 return $1
205 if /^\$VERSION = '([\d\.\_]+)';/;
206 }
207 return undef;
208 }
209
210 sub check_flags {
211 my $defs = [];
212 my $libs = [];
213 my $long = 0;
214
215 for my $check ( 1, 0 ) {
216
217 # this is to turn off the copious amount of spewage seen compiling
218 # xs code on freebsd.
219 # WISHLIST: would be nice if we could inspect the compiler output
220 # from building the test file. would like to see if there was a
221 # "unsupported command line option" warning. looks like it would
222 # be a good bit of work though.
223 try_compound($check, \$long, $defs, '-Wno-compound-token-split-by-macro');
224
225 # -ladvapi is needed for win32 random numbers.
226 #try_advapi($check, \$long, $libs, '-ladvapi');
227
228 # -lbcrypt is needed for win32 random numbers.
229 try_bcrypt($check, \$long, $libs, '-lbcrypt');
230
231 # -liphlpapi is needed for win32 real node discovery.
232 try_iphlpapi($check, \$long, $libs, '-liphlpapi');
233
234 # -lkernel32 needed for win32 CriticalSection / SRWLocks.
235 try_kernel32($check, \$long, $libs, '-lkernel32');
236
237 # -lsynchronization needed to WaitOnAddress().
238 #try_synchronization($check, \$long, $libs, '-lsynchronization');
239
240 # -lpthread is needed for sem ops. older perls dont link it unless -Dthreads.
241 try_pthread($check, \$long, $libs, '-lpthread');
242 #... more ?
243 }
244
245 return join(' ', @$libs), join(' ', @$defs);
246 }
247
248 sub check_threads {
249 # return true/false
250 $Config{useithreads} ? 1 : 0;
251 }
252
253 sub try_compound {
254 my ($check, $long, $flags, $try) = @_;
255 my $msg = join ' ', 'Checking compound token switch';
256 my $len = length $msg;
257 if ($check) { $$long = $len if $len > $$long; return; }
258 my $more = $$long - $len;
259 print $msg, ' ..', '.'x$more, ' ';
260 if ( check_lib(
261 lib => 'c', # always do at least this
262 ccflags => $try,
263 debug => 0,
264 )) {
265 push @$flags, $try;
266 print "found\n";
267 }
268 else {
269 print "none\n";
270 }
271 }
272
273 sub try_advapi {
274 my ($check, $long, $libs, $try) = @_;
275 my $msg = join ' ', 'Checking for lib advapi';
276 my $len = length $msg;
277 if ($check) { $$long = $len if $len > $$long; return; }
278 my $more = $$long - $len;
279 print $msg, ' ..', '.'x$more, ' ';
280
281 # dont link unless its a native build.
282 #my $is_win32 = $^O eq 'MSWin32' ? 1 : 0;
283 #my $is_nmake = $Config{make} eq 'nmake' ? 1 : 0;
284 #my $is_native = $is_win32 && $is_nmake ? 1 : 0;
285
286 #if ( $is_native && check_lib(
287 if ( check_lib(
288 lib => 'c',
289 debug => 0,
290 )) {
291 push @$libs, $try;
292 print "found\n";
293 }
294 else {
295 print "none\n";
296 }
297 }
298
299 sub try_bcrypt {
300 my ($check, $long, $libs, $try) = @_;
301 my $msg = join ' ', 'Checking for lib bcrypt';
302 my $len = length $msg;
303 if ($check) { $$long = $len if $len > $$long; return; }
304 my $more = $$long - $len;
305 print $msg, ' ..', '.'x$more, ' ';
306
307 # dont link unless its a native build.
308 #my $is_win32 = $^O eq 'MSWin32' ? 1 : 0;
309 #my $is_nmake = $Config{make} eq 'nmake' ? 1 : 0;
310 #my $is_native = $is_win32 && $is_nmake ? 1 : 0;
311
312 #if ( $is_native && check_lib(
313 if ( check_lib(
314 lib => 'bcrypt',
315 debug => 0,
316 )) {
317 push @$libs, $try;
318 print "found\n";
319 }
320 else {
321 print "none\n";
322 }
323 }
324
325 sub try_iphlpapi {
326 my ($check, $long, $libs, $try) = @_;
327 my $msg = join ' ', 'Checking for lib iphlpapi';
328 my $len = length $msg;
329 if ($check) { $$long = $len if $len > $$long; return; }
330 my $more = $$long - $len;
331 print $msg, ' ..', '.'x$more, ' ';
332
333 # dont link unless its a native build.
334 my $is_win32 = $^O eq 'MSWin32' ? 1 : 0;
335 my $is_nmake = $Config{make} eq 'nmake' ? 1 : 0;
336 my $is_native = $is_win32 && $is_nmake ? 1 : 0;
337
338 if ( $is_native && check_lib(
339 lib => 'iphlpapi',
340 debug => 0,
341 )) {
342 push @$libs, $try;
343 print "found\n";
344 }
345 else {
346 print "none\n";
347 }
348 }
349
350 sub try_kernel32 {
351 my ($check, $long, $libs, $try) = @_;
352 my $msg = join ' ', 'Checking for lib kernel32';
353 my $len = length $msg;
354 if ($check) { $$long = $len if $len > $$long; return; }
355 my $more = $$long - $len;
356 print $msg, ' ..', '.'x$more, ' ';
357
358 # dont link unless its a native build.
359 #my $is_win32 = $^O eq 'MSWin32' ? 1 : 0;
360 #my $is_nmake = $Config{make} eq 'nmake' ? 1 : 0;
361 #my $is_native = $is_win32 && $is_nmake ? 1 : 0;
362
363 if ( check_lib(
364 lib => 'kernel32',
365 debug => 0,
366 )) {
367 push @$libs, $try;
368 print "found\n";
369 }
370 else {
371 print "none\n";
372 }
373 }
374
375 sub try_synchronization {
376 my ($check, $long, $libs, $try) = @_;
377 my $msg = join ' ', 'Checking for lib synchronization';
378 my $len = length $msg;
379 if ($check) { $$long = $len if $len > $$long; return; }
380 my $more = $$long - $len;
381 print $msg, ' ..', '.'x$more, ' ';
382
383 # dont link unless its a native build.
384 #my $is_win32 = $^O eq 'MSWin32' ? 1 : 0;
385 #my $is_nmake = $Config{make} eq 'nmake' ? 1 : 0;
386 #my $is_native = $is_win32 && $is_nmake ? 1 : 0;
387
388 if ( check_lib(
389 lib => 'synchronization',
390 debug => 0,
391 )) {
392 push @$libs, $try;
393 print "found\n";
394 }
395 else {
396 print "none\n";
397 }
398 }
399
400 sub try_pthread {
401 my ($check, $long, $libs, $try) = @_;
402 my $msg = join ' ', 'Checking for lib pthread';
403 my $len = length $msg;
404 if ($check) { $$long = $len if $len > $$long; return; }
405 my $more = $$long - $len;
406 print $msg, ' ..', '.'x$more, ' ';
407
408 # dont link unless its a native build.
409 #my $is_win32 = $^O eq 'MSWin32' ? 1 : 0;
410 #my $is_nmake = $Config{make} eq 'nmake' ? 1 : 0;
411 #my $is_native = $is_win32 && $is_nmake ? 1 : 0;
412
413 if ( check_lib(
414 lib => 'pthread',
415 debug => 0,
416 )) {
417 push @$libs, $try;
418 print "found\n";
419 }
420 else {
421 print "none\n";
422 }
423 }
424
425
426
427 package MY;
428 use Config;
429
430
431 #
432 # add 'compare' target.
433 #
434 sub top_targets {
435 my $t = shift->SUPER::top_targets(@_);
436 # add 'compare' targets.
437 $t .= "\npersist : dynamic pure_all\n";
438 $t .= "\t\$(NOECHO) \$(ABSPERLRUN) ubin\$(DFSEP)cmp_persist.pl 2\n";
439 $t .= "\n";
440 $t .= "\nspeeds : dynamic pure_all\n";
441 $t .= "\t\$(NOECHO) \$(ABSPERLRUN) ubin\$(DFSEP)cmp_speeds.pl 2\n";
442 $t .= "\n";
443 $t .= "\nstyles : dynamic pure_all\n";
444 $t .= "\t\$(NOECHO) \$(ABSPERLRUN) ubin\$(DFSEP)cmp_styles.pl 2\n";
445 $t .= "\n";
446 $t .= "\ncompare : speeds styles persist\n";
447 $t .= "\t\$(NOECHO) \$(NOOP)";
448 # remove blibdirs from config prereq.
449 $t =~ s{^(config\s*::.*)\s+blibdirs} {$1}m;
450 # change pure_all prereqs
451 $t =~ s{^(pure_all\s*::\s*).*$} {$1 config blibdirs dynamic bootstrap uu_to_blib}m;
452 $t;
453 }
454
455
456 #
457 # add distlicense and distreadme prereqs.
458 ## silence manicopy step during config.
459 #
460 sub distdir {
461 my $t = shift->SUPER::distdir(@_);
462 $t =~ s{^(distdir :).*$}{$1 create_distdir license metafile readme distlicense distmeta distreadme}m;
463 #$t =~ s{PERLRUN}{NOECHO) \$(PERLRUN};
464 $t;
465 }
466
467
468 #
469 # remove metafile comments in manifest.
470 # make metafiles authoritative to cpan.
471 #
472 sub distmeta {
473 my $t = <<'EOS';
474 distmeta : create_distdir license metafile readme
475 $(NOECHO) $(ECHO) Adding META.json to MANIFEST
476 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd \
477 -e "die 'No META.json' unless -f 'META.json';" \
478 -e "die 'No MANIFEST' unless -f 'MANIFEST';" \
479 -e "eval { maniadd({ 'META.json' => '' }) }" \
480 -e " or die \"Could not add META.json to MANIFEST: $$ @\"" --
481 $(NOECHO) $(ECHO) Adding META.yml to MANIFEST
482 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd \
483 -e "die 'No META.yml' unless -f 'META.yml';" \
484 -e "die 'No MANIFEST' unless -f 'MANIFEST';" \
485 -e "eval { maniadd({ 'META.yml' => '' }) }" \
486 -e " or die \"Could not add META.yml to MANIFEST: $$ @\"" --
487 EOS
488 $t;
489 }
490
491
492 #
493 # re-order meta generation
494 #
495 sub metafile {
496 my $t = shift->SUPER::metafile_target(@_);
497 $t =~ s{^(metafile :.*)$} {$1 meta_json meta_yml}m;
498 $t =~ s{^(\s+.+Generating META.yml.*)$} {\nmeta_yml :\n$1}m;
499 $t =~ s{^(\s+.+Generating META.json.*)$} {\nmeta_json :\n$1}m;
500 $t;
501 }
502
503
504 #
505 # add UUID_DISTTEST flag to 'make disttest'
506 #
507 sub dist_test {
508 my $t = shift->SUPER::dist_test(@_);
509 $t =~ s{ test }{ test UUID_DISTTEST=1 };
510 $t;
511 }
512
513
514 #
515 # make TEST_VERBOSE=1 when AUTOMATED_TESTING=1 and dev release.
516 # add t/*/*.t to tests.
517 # add TEST_LIB variable, set to t/lib.
518 # insert TEST_LIB before other libs.
519 # add USE_ITHREADS to test environment.
520 #
521 sub test {
522 my $t = shift->SUPER::test(@_);
523 #
524 # make TEST_VERBOSE=1 when AUTOMATED_TESTING=1 and dev release.
525 if ( $ENV{AUTOMATED_TESTING}
526 || $ENV{NONINTERACTIVE_TESTING}
527 || $ENV{PERL_CPAN_REPORTER_CONFIG}
528 and $UUID_version =~ /_/
529 ) {
530 # turn this off for now.. its stable enough to not need
531 $t =~ s{__XXX__TEST_VERBOSE\s*=\s*0}{TEST_VERBOSE = 1}msg;
532 }
533 #
534 # add t/*/*.t to tests.
535 $t =~ s{^(TEST_FILES\s*=\s*).+$} {${1}t\$(DFSEP)*.t t\$(DFSEP)*\$(DFSEP)*.t}m;
536 #
537 # add TEST_LIB variable, set to t/0LIB.
538 $t =~ s{^} {TEST_LIB = t\$(DFSEP)0LIB\n}s;
539 #
540 # insert TEST_LIB before other libs.
541 $t =~ s{(\S+)(INST_LIB)(\S+)} {${1}TEST_LIB$3 $1$2$3}g;
542 # add USE_ITHREADS to test env.
543 my $use_ithreads = $Config{useithreads} ? 'USE_ITHREADS=1' : 'USE_ITHREADS=0';
544 my $is_nmake = $Config{make} eq 'nmake';
545 my $is_gmake = $Config{make} eq 'gmake';
546 my $is_dmake = $Config{make} eq 'dmake';
547 if ($is_nmake) {
548 $t =~ s{^(test_dynamic\s*:.+)$} {$1\n\t\@set $use_ithreads}m;
549 }
550 elsif ($is_gmake or $is_dmake) {
551 $t =~ s{^(\s+)(\$\(FULLPERLRUN)} {${1}set $use_ithreads && $2}mg;
552 }
553 else {
554 $t =~ s{^} {TEST_ENV = $use_ithreads\n}s;
555 $t =~ s{^(.*PERL_DL_NONLAZY=\S+\s+)} {$1\$(TEST_ENV) }mg;
556 }
557 $t;
558 }
559
560
561 #
562 # silence "cp_nonempty" bootstrap.
563 # silence chmod bootstrap.
564 # remove implicit rules and make our own!
565 # (some seem to use the implicits first?)
566 # move initial .bs file into lib
567 #
568 sub xs_c { '' }
569 sub xs_o { '' }
570 sub dynamic_bs {
571 my $t = shift->SUPER::dynamic_bs(@_);
572 # add bootstrap target after first newline
573 $t =~ s{$} {\n\nbootstrap : \$(lib_UUID).bs\n\t\$(NOECHO) \$(NOOP)}m;
574 # delay Mkbootstrap() until after c files
575 $t =~ s{^(\S+BASEEXT\S+\s*:\s+.+$)} {$1 \$(O_FILES)}m;
576 # silence chmod
577 $t =~ s{CHMOD} {NOECHO) \$(CHMOD}sg;
578 # move initial to lib (5 changes)
579 $t =~ s{ \$\(BASEEXT\)\.bs } { \$(lib_UUID).bs }g; # 2 changes
580 $t =~ s{"\$\(BASEEXT\)\.bs"} {"\$(lib_UUID).bs"}g; # 2 changes
581 $t =~ s{^\$\(BASEEXT\)\.bs} {\$(lib_UUID).bs}m; # 1 change
582 # change BOOTSTRAP var
583 $t =~ s{^BOOTSTRAP\s*=\s*\S+} {BOOTSTRAP = \$(lib_UUID).bs};
584 $t;
585 }
586 sub perldepend {
587 my $t = shift->SUPER::perldepend(@_);
588 # add target to run xsubpp
589 $t .= "\n";
590 $t .= '$(lib_UUID).c : $(XSUBPPDEPS) $(lib_UUID).xs $(ulib_EUMM).h'. "\n";
591 $t .= "\t". '$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $(lib_UUID).xs > $(lib_UUID).xsc'. "\n";
592 $t .= "\t". '$(MV) $(lib_UUID).xsc $(lib_UUID).c';
593 $t;
594 }
595 sub blibdirs {
596 my $t = shift->SUPER::blibdirs_target();
597 # add EUMM.h as prereq to blibdirs.
598 $t =~ s{^(blibdirs\s*:\s*)(\S.*)$} {$1\$(ulib_EUMM).h $2}m;
599 $t;
600 }
601
602
603 #
604 # remove targets in dynamic_lib section. we do them manually later.
605 #
606 sub dynamic_lib {
607 my $t = shift->SUPER::dynamic_lib(@_);
608 $t =~ s{\n\n.+$} {\n}ms;
609 $t;
610 }
611
612
613 #
614 # remove most prereqs from dynamic.
615 #
616 sub dynamic {
617 my $t = shift->SUPER::dynamic(@_);
618 # remove most prereqs from dynamic.
619 $t =~ s{^(dynamic\s*::)\s+\S+\s+\S+\s+\S+\s+(\S+)\s*$} {$1 $2}m;
620 $t;
621 }
622
623
624 #
625 # adjust dlsyms (only on win32)
626 #
627 sub dlsyms {
628 my $t = shift->SUPER::dlsyms(@_);
629 $t =~ s{^UUID.def} {\$(lib_UUID).def}m;
630 $t =~ s{,} {, 'FILE' => 'lib/\$(BASEEXT)',};
631 $t;
632 }
633
634
635 #
636 # our variables.
637 # also add ulib/EUMM.h as prereq for pm_to_blib.
638 # change EXPORT_LIST.
639 #
640 sub constants {
641 my $t = shift->SUPER::constants(@_);
642 my $v = <<'EOPC';
643 lib_UUID = lib$(DFSEP)UUID
644 ubin_configure = ubin$(DFSEP)configure.pl
645 ulib_EUMM = ulib$(DFSEP)EUMM
646 ulib_FUTX = ulib$(FDSEP)FUTX
647 ulib_TYPE = ulib$(DFSEP)TYPE
648 ulib_UMTX = ulib$(DFSEP)UMTX
649 ulib_UUID = ulib$(DFSEP)UUID
650 ulib_atomic = ulib$(DFSEP)atomic
651 ulib_chacha = ulib$(DFSEP)chacha
652 ulib_clock = ulib$(DFSEP)clock
653 ulib_compare = ulib$(DFSEP)compare
654 ulib_gen = ulib$(DFSEP)gen
655 ulib_gettime = ulib$(DFSEP)gettime
656 ulib_hash = ulib$(DFSEP)hash
657 ulib_node = ulib$(DFSEP)node
658 ulib_pack = ulib$(DFSEP)pack
659 ulib_parse = ulib$(DFSEP)parse
660 ulib_splitmix = ulib$(DFSEP)splitmix
661 ulib_sysrand = ulib$(DFSEP)sysrand
662 ulib_util = ulib$(DFSEP)util
663 ulib_xoshiro = ulib$(DFSEP)xoshiro
664 EOPC
665 # also add ulib/EUMM.h as prereq for pm_to_blib.
666 # terrible hack due to MY::pm_to_blib() never called.
667 $t =~ s{^(TO_INST_PM.+)$} {$v\n$1}m;
668 #$t =~ s{^(TO_INST_PM.+)$} {$v\n$1 \$(ulib_EUMM).h}m;
669 # change EXPORT_LIST. if empty, leave it alone.
670 # otherwise change to lib/UUID.
671 $t =~ s{^(EXPORT_LIST\s*= *)\S+([\r\n]+)} {$1\$(lib_UUID).def$2}m;
672 $t;
673 }
674
675
676 #
677 # add distlicense and distreadme targets.
678 # add autoconf generated targets.
679 # add explicit object rules.
680 #
681 sub postamble {
682 my $pa = <<'EOP';
683 # Software::License requires perl-5.12.0
684 license: create_distdir
685 $(NOECHO) $(ECHO) Generating LICENSE
686 $(NOECHO) $(RM_F) LICENSE_new
687 $(NOECHO) $(ABSPERLRUN) -M5.12.0 -MSoftware::License::Artistic_2_0 \
688 -e 'print Software::License::Artistic_2_0->new({holder => "Rick Myers", year => sprintf("2014-%04d", 1900+(localtime(time))[5])})->fulltext' \
689 > LICENSE_new
690 $(NOECHO) $(MV) LICENSE_new $(DISTVNAME)$(DFSEP)LICENSE
691
692 distlicense: create_distdir license
693 $(NOECHO) $(ECHO) Adding LICENSE to MANIFEST
694 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd \
695 -e "die 'No LICENSE' unless -f 'LICENSE';" \
696 -e "die 'No MANIFEST' unless -f 'MANIFEST';" \
697 -e "eval { maniadd({ 'LICENSE' => '' }) }" \
698 -e " or die \"Could not add LICENSE to MANIFEST: $$ @\"" --
699 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -e "print sort <>" MANIFEST > MANIFEST_new
700 $(NOECHO) $(MV) $(DISTVNAME)$(DFSEP)MANIFEST_new $(DISTVNAME)$(DFSEP)MANIFEST
701
702 readme: create_distdir
703 $(NOECHO) $(ECHO) Generating README
704 $(NOECHO) $(RM_F) README_new
705 $(NOECHO) pod2text $(lib_UUID).pm README_new
706 $(NOECHO) $(ABSPERLRUN) -i -pe's{\*(\S+)\*}{\1}g' README_new
707 $(NOECHO) $(MV) README_new $(DISTVNAME)$(DFSEP)README
708
709 distreadme: create_distdir readme
710 $(NOECHO) $(ECHO) Adding README to MANIFEST
711 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd \
712 -e "die 'No README' unless -f 'README';" \
713 -e "die 'No MANIFEST' unless -f 'MANIFEST';" \
714 -e "eval { maniadd({ 'README' => '' }) }" \
715 -e " or die \"Could not add README to MANIFEST: $$ @\"" --
716 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -e "print sort <>" MANIFEST > MANIFEST_new
717 $(NOECHO) $(MV) $(DISTVNAME)$(DFSEP)MANIFEST_new $(DISTVNAME)$(DFSEP)MANIFEST
718
719 config :: $(ubin_configure) $(ulib_EUMM).h
720 $(NOECHO) $(NOOP)
721
722 uu_to_blib : $(lib_UUID).pm $(lib_UUID).bs
723 $(CP) $(lib_UUID).pm $(INST_LIB)$(DFSEP)UUID.pm
724 $(NOECHO) $(CHMOD) $(PERM_RW) $(INST_LIB)$(DFSEP)UUID.pm
725 $(NOECHO) $(TOUCH) uu_to_blib
726
727 deps = $(XSUBPPDEPS) $(ulib_EUMM).h
728 cccmd = $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)
729
730 $(ulib_EUMM).h : $(FIRST_MAKEFILE) $(ubin_configure)
731 $(NOECHO) $(ECHO) Generating EUMM.h
732 $(NOECHO) $(RM_F) $(ulib_EUMM).h $(ulib_EUMM).h.tmp
733 $(NOECHO) $(PERL) $(ubin_configure) $(ulib_EUMM).h.tmp
734 $(NOECHO) $(MV) $(ulib_EUMM).h.tmp $(ulib_EUMM).h
735
736 atomic_deps = \
737 ulib/arch/arm/atomic.c \
738 ulib/arch/x86/atomic.c
739
740 $(lib_UUID).obj : $(deps) $(lib_UUID).c
741 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
742
743 $(ulib_atomic).obj : $(deps) $(ulib_atomic).c $(ulib_atomic).h $(atomic_deps)
744 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
745
746 $(ulib_chacha).obj : $(deps) $(ulib_chacha).c $(ulib_chacha).h
747 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
748
749 $(ulib_clock).obj : $(deps) $(ulib_clock).c $(ulib_clock).h
750 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
751
752 $(ulib_compare).obj : $(deps) $(ulib_compare).c $(ulib_compare).h
753 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
754
755 $(ulib_gen).obj : $(deps) $(ulib_gen).c $(ulib_gen).h
756 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
757
758 $(ulib_gettime).obj : $(deps) $(ulib_gettime).c $(ulib_gettime).h
759 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
760
761 $(ulib_hash).obj : $(deps) $(ulib_hash).c $(ulib_hash).h
762 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
763
764 $(ulib_node).obj : $(deps) $(ulib_node).c $(ulib_node).h
765 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
766
767 $(ulib_pack).obj : $(deps) $(ulib_pack).c $(ulib_pack).h
768 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
769
770 $(ulib_parse).obj : $(deps) $(ulib_parse).c $(ulib_parse).h
771 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
772
773 $(ulib_splitmix).obj : $(deps) $(ulib_splitmix).c $(ulib_splitmix).h
774 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
775
776 $(ulib_sysrand).obj : $(deps) $(ulib_sysrand).c $(ulib_sysrand).h
777 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
778
779 $(ulib_util).obj : $(deps) $(ulib_util).c $(ulib_util).h
780 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
781
782 $(ulib_xoshiro).obj : $(deps) $(ulib_xoshiro).c $(ulib_xoshiro).h
783 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -Fd$(*).pdb -Fo$(*).obj $*.c
784
785
786 $(lib_UUID).o : $(deps) $(lib_UUID).c
787 $(cccmd) $(lib_UUID).c -o $(lib_UUID).o
788
789 $(ulib_atomic).o : $(deps) $(ulib_atomic).c $(ulib_atomic).h $(atomic_deps)
790 $(cccmd) $(ulib_atomic).c -o $(ulib_atomic).o
791
792 $(ulib_chacha).o : $(deps) $(ulib_chacha).c $(ulib_chacha).h
793 $(cccmd) $(ulib_chacha).c -o $(ulib_chacha).o
794
795 $(ulib_clock).o : $(deps) $(ulib_clock).c $(ulib_clock).h
796 $(cccmd) $(ulib_clock).c -o $(ulib_clock).o
797
798 $(ulib_compare).o : $(deps) $(ulib_compare).c $(ulib_compare).h
799 $(cccmd) $(ulib_compare).c -o $(ulib_compare).o
800
801 $(ulib_gen).o : $(deps) $(ulib_gen).c $(ulib_gen).h
802 $(cccmd) $(ulib_gen).c -o $(ulib_gen).o
803
804 $(ulib_gettime).o : $(deps) $(ulib_gettime).c $(ulib_gettime).h
805 $(cccmd) $(ulib_gettime).c -o $(ulib_gettime).o
806
807 $(ulib_hash).o : $(deps) $(ulib_hash).c $(ulib_hash).h
808 $(cccmd) $(ulib_hash).c -o $(ulib_hash).o
809
810 $(ulib_node).o : $(deps) $(ulib_node).c $(ulib_node).h
811 $(cccmd) $(ulib_node).c -o $(ulib_node).o
812
813 $(ulib_pack).o : $(deps) $(ulib_pack).c $(ulib_pack).h
814 $(cccmd) $(ulib_pack).c -o $(ulib_pack).o
815
816 $(ulib_parse).o : $(deps) $(ulib_parse).c $(ulib_parse).h
817 $(cccmd) $(ulib_parse).c -o $(ulib_parse).o
818
819 $(ulib_splitmix).o : $(deps) $(ulib_splitmix).c $(ulib_splitmix).h
820 $(cccmd) $(ulib_splitmix).c -o $(ulib_splitmix).o
821
822 $(ulib_sysrand).o : $(deps) $(ulib_sysrand).c $(ulib_sysrand).h
823 $(cccmd) $(ulib_sysrand).c -o $(ulib_sysrand).o
824
825 $(ulib_util).o : $(deps) $(ulib_util).c $(ulib_util).h
826 $(cccmd) $(ulib_util).c -o $(ulib_util).o
827
828 $(ulib_xoshiro).o : $(deps) $(ulib_xoshiro).c $(ulib_xoshiro).h
829 $(cccmd) $(ulib_xoshiro).c -o $(ulib_xoshiro).o
830
831
832 EOP
833
834 if ($Config{make} eq 'nmake') {
835 $pa .= <<'EOP';
836 $(INST_DYNAMIC) : \
837 lib/UUID.obj \
838 ulib/atomic.obj \
839 ulib/chacha.obj \
840 ulib/clock.obj \
841 ulib/compare.obj \
842 ulib/gen.obj \
843 ulib/gettime.obj \
844 ulib/hash.obj \
845 ulib/node.obj \
846 ulib/pack.obj \
847 ulib/parse.obj \
848 ulib/splitmix.obj \
849 ulib/sysrand.obj \
850 ulib/util.obj \
851 ulib/xoshiro.obj \
852 $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) \
853 $(PERL_ARCHIVEDEP) $(INST_DYNAMIC_DEP)
854 $(LD) -out:$@ $(LDDLFLAGS) \
855 lib/UUID.obj \
856 ulib/atomic.obj \
857 ulib/chacha.obj \
858 ulib/clock.obj \
859 ulib/compare.obj \
860 ulib/gen.obj \
861 ulib/gettime.obj \
862 ulib/hash.obj \
863 ulib/node.obj \
864 ulib/pack.obj \
865 ulib/parse.obj \
866 ulib/splitmix.obj \
867 ulib/sysrand.obj \
868 ulib/util.obj \
869 ulib/xoshiro.obj \
870 $(OTHERLDFLAGS) $(MYEXTLIB) "$(PERL_ARCHIVE)" $(LDLOADLIBS) \
871 -def:$(EXPORT_LIST)
872 if exist [email protected] mt -nologo -manifest [email protected] -outputresource:$@;2
873 if exist [email protected] del [email protected]
874 $(CHMOD) $(PERM_RWX) $@
875 EOP
876 }
877 else {
878 $pa .= <<'EOP';
879 $(INST_DYNAMIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists \
880 $(EXPORT_LIST) $(PERL_ARCHIVEDEP) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
881 $(RM_F) $@
882 $(LD) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $(INST_DYNAMIC_FIX)
883 $(NOECHO) $(CHMOD) $(PERM_RWX) $@
884 EOP
885 }
886
887 return $pa;
888 }