This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove the vestigial my_safe{calloc,malloc,free} macros from sv.c
[perl5.git] / Porting / makemeta
1 #!./perl -w
2 # this script must be run by the current perl to get perl's version right
3 #
4 # Create a META.yml file in the current directory. Must be run from the
5 # root directory of a perl source tree.
6
7 use strict;
8 use warnings;
9 use lib "Porting";
10
11 use File::Basename qw( dirname );
12
13
14 BEGIN {
15     # Get function prototypes
16     require 'regen_lib.pl';
17 }
18
19
20 my $file = "META.yml";
21 my $new_file = "META.yml-new";
22
23 use Maintainers qw(%Modules get_module_files get_module_pat);
24
25 my @CPAN  = grep { $Modules{$_}{CPAN} } keys %Modules;
26 my @files = ('lib/unicore/mktables', 'TestInit.pm',
27              'Porting/Maintainers.pm', 'Porting/perldelta_template.pod',
28              map { get_module_files($_) } @CPAN);
29 my @dirs  = ('cpan', 'win32', grep { -d $_ && $_  !~ /^cpan/ } map { get_module_pat($_) } @CPAN);
30
31 my %dirs;
32 @dirs{@dirs} = ();
33
34 my $files = join '', map { "    - $_\n" }
35   grep {
36     my $d = $_;
37     while(($d = dirname($d)) ne "."){
38       last if exists $dirs{$d};
39     }
40
41     # if $d is "." it means we tried every parent dir of the file and none
42     # of them were in the private list
43     
44     $d eq "."; 
45   }
46   sort { lc $a cmp lc $b } @files;
47
48 my $dirs  = join '', map { "    - $_\n" } sort { lc $a cmp lc $b } @dirs;
49
50 my $fh = safer_open($new_file);
51
52 print $fh <<"EOI";
53 name: perl
54 version: $]
55 abstract: Practical Extraction and Report Language
56 author: perl5-porters\@perl.org
57 license: perl
58 resources:
59   homepage: http://www.perl.org/
60   bugtracker: http://rt.perl.org/perlbug/
61   license: http://dev.perl.org/licenses/
62   repository: http://perl5.git.perl.org/
63 distribution_type: core
64 generated_by: $0
65 no_index:
66   directory:
67 $dirs
68   file:
69 $files
70 EOI
71
72 safer_close($fh);
73 rename_if_different($new_file, $file);
74