2 # $Id: Makefile.PL,v 2.14 2015/06/25 00:49:23 dankogai Exp $
7 use ExtUtils::MakeMaker;
11 my %ARGV = map { my @r = split /=/,$_; defined $r[1] or $r[1]=1; @r } @ARGV;
12 $ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for sort keys %ARGV;
13 $ENV{PERL_CORE} ||= $ARGV{PERL_CORE} if $ARGV{PERL_CORE};
17 def_t => ['ascii.ucm',
24 my @exe_files = qw(bin/enc2xs
28 my @more_exe_files = qw(
31 my @pmlibdirs = qw(lib Encode);
33 $ARGV{MORE_SCRIPTS} and push @exe_files, @more_exe_files;
34 $ARGV{INSTALL_UCM} and push @pmlibdirs, "ucm";
38 EXE_FILES => \@exe_files,
39 VERSION_FROM => 'Encode.pm',
40 OBJECT => '$(O_FILES)',
42 COMPRESS => 'gzip -9f',
44 DIST_DEFAULT => 'all tardist',
46 INC => '-I' . File::Spec->catfile( '.', 'Encode' ),
49 Exporter => '5.57', # use Exporter 'import';
50 parent => '0.221', # version bundled with 5.10.1
52 PMLIBDIRS => \@pmlibdirs,
53 INSTALLDIRS => ($] < 5.011 ? 'perl' : 'site'),
56 repository => 'https://github.com/dankogai/p5-encode',
68 # Find existing O_FILES
69 foreach my $f (@{$self->{'O_FILES'}})
73 my $x = $self->{'OBJ_EXT'};
74 # Add the table O_FILES
75 foreach my $e (keys %tables)
79 # Trick case-blind filesystems.
80 delete $o{'encode'.$x};
83 $self->{'O_FILES'} = [sort keys %o];
85 foreach my $table (sort keys %tables)
87 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm))
89 push (@files,$table.$ext);
91 $self->{SOURCE} .= " $table.c"
92 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
94 $self->{'clean'}{'FILES'} .= join(' ',@files);
101 my $dir = $self->catdir($self->curdir,'ucm');
102 my $str = "# Encode\$(OBJ_EXT) does not depend on .c files directly\n";
103 $str .= "# (except Encode.c), but on .h and .exh files written by enc2xs\n";
104 $str .= $^O eq 'MacOS' ? 'Encode.c.{$(MACPERL_BUILD_EXT_STATIC)}.o :' : 'Encode$(OBJ_EXT) :';
106 foreach my $table (sort keys %tables)
111 foreach my $table (sort keys %tables)
114 my $lengthsofar = length($str);
115 my $continuator = '';
116 my $enc2xs = $self->catfile('bin', 'enc2xs');
117 $str .= "$table.c : $enc2xs Makefile.PL";
118 foreach my $file (@{$tables{$table}})
120 $str .= $continuator.' '.$self->catfile($dir,$file);
121 if ( length($str)-$lengthsofar > 128*$numlines )
123 $continuator .= " \\\n\t";
129 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
130 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
131 my $ucopts = '-"Q" -"O"';
133 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
134 open (FILELIST, ">$table.fnm")
135 || die "Could not open $table.fnm: $!";
136 foreach my $file (@{$tables{$table}})
138 print FILELIST $self->catfile($dir,$file) . "\n";