This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
8c20d20226f05552183b93d7a9ebbf8513075595
[perl5.git] / cpan / Encode / Makefile.PL
1 #
2 # $Id: Makefile.PL,v 2.22 2017/10/06 22:21:53 dankogai Exp $
3 #
4 use 5.007003;
5 use strict;
6 use warnings;
7 use utf8;
8 use ExtUtils::MakeMaker;
9 use File::Spec;
10 use Config;
11
12 # Just for sure :)
13 my %ARGV = map { my @r = split /=/,$_; defined $r[1] or $r[1]=1; @r } @ARGV;
14 $ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for sort keys  %ARGV;
15 $ENV{PERL_CORE} ||= $ARGV{PERL_CORE} if $ARGV{PERL_CORE};
16 # similar strictness as in core
17 my $ccflags = $Config{ccflags};
18 if (!$ENV{PERL_CORE}) {
19   if (my $gccver = $Config{gccversion}) {
20     $gccver =~ s/\.//g; $gccver =~ s/ .*//;
21     $gccver .= "0" while length $gccver < 3;
22     $gccver = 0+$gccver;
23     $ccflags .= ' -Werror=declaration-after-statement' if $gccver > 412;
24     $ccflags .= ' -Wpointer-sign' if !$Config{d_cplusplus} and $gccver > 400;
25     $ccflags .= ' -fpermissive' if $Config{d_cplusplus};
26   }
27 }
28
29 my %tables = 
30     (
31      def_t => [
32            'ascii.ucm',
33            '8859-1.ucm',
34            'cp1252.ucm',
35            'null.ucm',
36            'ctrl.ucm',
37            ]
38      );
39
40 my @exe_files = qw(bin/enc2xs
41            bin/piconv
42            bin/encguess
43            );
44 my @more_exe_files = qw(
45             unidump
46             );
47 my @pmlibdirs = qw(lib Encode);
48
49 $ARGV{MORE_SCRIPTS} and push @exe_files, @more_exe_files;
50 $ARGV{INSTALL_UCM}   and push @pmlibdirs, "ucm";
51
52 WriteMakefile(
53     NAME         => "Encode",
54     EXE_FILES    => \@exe_files,
55     VERSION_FROM => 'Encode.pm',
56     ABSTRACT_FROM=> 'Encode.pm',
57     AUTHOR       => 'Dan Kogai <dankogai@dan.co.jp>',
58     OBJECT       => '$(O_FILES)',
59     'dist'       => {
60         COMPRESS     => 'gzip -9f',
61         SUFFIX       => 'gz',
62         DIST_DEFAULT => 'all tardist',
63     },
64     CCFLAGS     => $ccflags,
65     INC         => '-I' . File::Spec->catfile( '.', 'Encode' ),
66     LICENSE     => 'perl',
67     PREREQ_PM   => {
68         Exporter   => '5.57',   # use Exporter 'import';
69         parent     => '0.221',  # version bundled with 5.10.1
70         Storable   => '0',      # bundled with Perl 5.7.3
71     },
72     TEST_REQUIRES => {
73         'Test::More' => '0.81_01',
74     },
75     PMLIBDIRS   => \@pmlibdirs,
76     INSTALLDIRS => ($] < 5.011 ? 'perl' : 'site'),
77     META_MERGE        => {
78         resources => {
79             repository  =>  'https://github.com/dankogai/p5-encode',
80         },
81         x_contributors => [
82             'Alex Davies <alex.davies@talktalk.net>',
83             'Alex Kapranoff <alex@kapranoff.ru>',
84             'Alex Vandiver <alex@chmrr.net>',
85             'Andreas J. Koenig <andreas.koenig@anima.de>',
86             'Andrew Pennebaker <andrew.pennebaker@networkedinsights.com>',
87             'Andy Grundman <andyg@activestate.com>',
88             'Anton Tagunov <tagunov@motor.ru>',
89             'Autrijus Tang <autrijus@autrijus.org>',
90             'Benjamin Goldberg <goldbb2@earthlink.net>',
91             'Bjoern Hoehrmann <derhoermi@gmx.net>',
92             'Bjoern Jacke <debianbugs@j3e.de>',
93             'bulk88 <bulk88@hotmail.com>',
94             'Craig A. Berry <craigberry@mac.com>',
95             'Curtis Jewell <csjewell@cpan.org>',
96             'Dan Kogai <dankogai@dan.co.jp>',
97             'Dave Evans <dave@rudolf.org.uk>',
98             'David Golden <dagolden@cpan.org>',
99             'David Steinbrunner <dsteinbrunner@pobox.com>',
100             'Deng Liu <dengliu@ntu.edu.tw>',
101             'Dominic Dunlop <domo@computer.org>',
102             'drry',
103             'Elizabeth Mattijsen <liz@dijkmat.nl>',
104             'Flavio Poletti <flavio@polettix.it>',
105             'Gerrit P. Haase <gp@familiehaase.de>',
106             'Gisle Aas <gisle@ActiveState.com>',
107             'Graham Barr <gbarr@pobox.com>',
108             'Graham Knop <haarg@haarg.org>',
109             'Graham Ollis <perl@wdlabs.com>',
110             'Gurusamy Sarathy <gsar@activestate.com>',
111             'H.Merijn Brand <h.m.brand@xs4all.nl>',
112             'Hugo van der Sanden <hv@crypt.org>',
113             'chansen <chansen@cpan.org>',
114             'Chris Nandor <pudge@pobox.com>',
115             'Inaba Hiroto <inaba@st.rim.or.jp>',
116             'Jarkko Hietaniemi <jhi@iki.fi>',
117             'Jesse Vincent <jesse@fsck.com>',
118             'Jungshik Shin <jshin@mailaps.org>',
119             'Karen Etheridge <ether@cpan.org>',
120             'Karl Williamson <khw@cpan.org>',
121             'Kenichi Ishigaki <ishigaki@cpan.org>',
122             'KONNO Hiroharu <hiroharu.konno@bowneglobal.co.jp>',
123             'Laszlo Molnar <ml1050@freemail.hu>',
124             'Makamaka <makamaka@donzoko.net>',
125             'Mark-Jason Dominus <mjd@plover.com>',
126             'Masahiro Iuchi <masahiro.iuchi@gmail.com>',
127             'MATSUNO Tokuhiro <tokuhirom+cpan@gmail.com>',
128             'Mattia Barbon <mbarbon@dsi.unive.it>',
129             'Michael G Schwern <schwern@pobox.com>',
130             'Michael LaGrasta <michael@lagrasta.com>',
131             'Miron Cuperman <miron@hyper.to>',
132             'Moritz Lenz <moritz@faui2k3.org>',
133             'MORIYAMA Masayuki <msyk@mtg.biglobe.ne.jp>',
134             'Nick Ing-Simmons <nick@ing-simmons.net>',
135             'Nicholas Clark <nick@ccl4.org>',
136             'Olivier Mengué <dolmen@cpan.org>',
137             'otsune',
138             'Pali <pali@cpan.org>',
139             'Paul Marquess <paul_marquess@yahoo.co.uk>',
140             'Peter Prymmer <pvhp@best.com>',
141             'Peter Rabbitson <ribasushi@cpan.org>',
142             'Philip Newton <pne@cpan.org>',
143             'Piotr Fusik <pfusik@op.pl>',
144             'Rafael Garcia-Suarez <rgarciasuarez@mandriva.com>',
145             'Randy Stauner <randy@magnificent-tears.com>',
146             'Reini Urban <rurban@cpan.org>',
147             'Robin Barker <rmb1@cise.npl.co.uk>',
148             'SADAHIRO Tomoyuki <SADAHIRO@cpan.org>',
149             'Simon Cozens <simon@netthink.co.uk>',
150             'Slaven Rezic <SREZIC@cpan.org>',
151             'Spider Boardman <spider@web.zk3.dec.com>',
152             'Steve Hay <steve.m.hay@googlemail.com>',
153             'Steve Peters <steve@fisharerojo.org>',
154             'SUGAWARA Hajime <sugawara@hdt.co.jp>',
155             'SUZUKI Norio <ZAP00217@nifty.com>',
156             'szr8 <blz.marcel@gmail.com>',
157             'Tatsuhiko Miyagawa <miyagawa@bulknews.net>',
158             'Tels <perl_dummy@bloodgate.com>',
159             'Tony Cook <tony@develop-help.com>',
160             'Vadim Konovalov <vkonovalov@peterstar.ru>',
161             'Victor <victor@vsespb.ru>',
162             'Ville Skyttä <ville.skytta@iki.fi>',
163             'Vincent van Dam <vvandam@sandvine.com>',
164             'Yitzchak Scott-Thoennes <sthoenna@efn.org>',
165         ],
166     },
167 );
168
169 package MY;
170
171
172 sub post_initialize
173 {
174     my ($self) = @_;
175     my %o;
176     # Find existing O_FILES
177     foreach my $f (@{$self->{'O_FILES'}})
178     {
179     $o{$f} = 1;
180     }
181     my $x = $self->{'OBJ_EXT'};
182     # Add the table O_FILES
183     foreach my $e (keys %tables)
184     {
185     $o{$e.$x} = 1;
186     }
187     # Trick case-blind filesystems.
188     delete $o{'encode'.$x};
189     $o{'Encode'.$x} = 1;
190     # Reset the variable
191     $self->{'O_FILES'} = [sort keys %o];
192     my @files;
193     foreach my $table (sort keys %tables)
194     {
195     foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm))
196     {
197     push (@files,$table.$ext);
198     }
199     $self->{SOURCE} .= " $table.c"
200     if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
201 }
202 $self->{'clean'}{'FILES'} .= join(' ',@files);
203 return '';
204 }
205
206 sub postamble
207 {
208     my $self = shift;
209     my $dir  = $self->catdir($self->curdir,'ucm');
210     my $str  = "# Encode\$(OBJ_EXT) does not depend on .c files directly\n";
211     $str  .= "# (except Encode.c), but on .h and .exh files written by enc2xs\n";
212     $str  .= $^O eq 'MacOS' ? 'Encode.c.{$(MACPERL_BUILD_EXT_STATIC)}.o :' : 'Encode$(OBJ_EXT) :';
213     $str  .= ' Encode.c';
214     foreach my $table (sort keys %tables)
215     {
216     $str .= " $table.c";
217     }
218     $str .= "\n\n";
219     foreach my $table (sort keys %tables)
220     {
221     my $numlines = 1;
222     my $lengthsofar = length($str);
223     my $continuator = '';
224     my $enc2xs = $self->catfile('bin', 'enc2xs');
225     $str .= "$table.c : $enc2xs Makefile.PL";
226     foreach my $file (@{$tables{$table}})
227     {
228         $str .= $continuator.' '.$self->catfile($dir,$file);
229         if ( length($str)-$lengthsofar > 128*$numlines )
230         {
231         $continuator .= " \\\n\t";
232         $numlines++;
233         } else {
234         $continuator = '';
235         }
236     }
237     my $plib   = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
238     $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
239     my $ucopts = '-"Q" -"O"';
240     $str .=
241         qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
242     open (FILELIST, ">$table.fnm")
243         || die "Could not open $table.fnm: $!";
244     foreach my $file (@{$tables{$table}})
245     {
246         print FILELIST $self->catfile($dir,$file) . "\n";
247     }
248     close(FILELIST);
249     }
250     return $str;
251 }