2 use ExtUtils::MakeMaker;
5 my %ARGV = map { split /=/; defined $_[1] or $_[1]=1; @_ } @ARGV;
6 $ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for keys %ARGV;
7 $ENV{PERL_CORE} ||= $ARGV{PERL_CORE};
11 def_t => ['ascii.ucm',
18 my @exe_files = qw(bin/enc2xs
21 my @more_exe_files = qw(
24 my @pmlibdirs = qw(lib Encode);
26 $ARGV{MORE_SCRIOPTS} and push @exe_files, @more_exe_files;
27 $ARGV{INSTALL_UCM} and push @pmlibdirs, "ucm";
31 EXE_FILES => \@exe_files,
32 VERSION_FROM => 'Encode.pm',
33 OBJECT => '$(O_FILES)',
35 COMPRESS => 'gzip -9f',
37 DIST_DEFAULT => 'all tardist',
41 PMLIBDIRS => \@pmlibdirs,
42 INSTALLDIRS => 'perl',
52 # Find existing O_FILES
53 foreach my $f (@{$self->{'O_FILES'}})
57 my $x = $self->{'OBJ_EXT'};
58 # Add the table O_FILES
59 foreach my $e (keys %tables)
63 # Trick case-blind filesystems.
64 delete $o{'encode'.$x};
67 $self->{'O_FILES'} = [sort keys %o];
69 foreach my $table (keys %tables)
71 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm))
73 push (@files,$table.$ext);
75 $self->{SOURCE} .= " $table.c"
76 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
78 $self->{'clean'}{'FILES'} .= join(' ',@files);
85 my $dir = $self->catdir($self->curdir,'ucm');
86 my $str = "# Encode\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
87 $str .= $^O eq 'MacOS' ? 'Encode.c.{$(MACPERL_BUILD_EXT_STATIC)}.o :' : 'Encode$(OBJ_EXT) :';
88 foreach my $table (keys %tables)
93 foreach my $table (keys %tables)
96 my $lengthsofar = length($str);
98 my $enc2xs = $self->catfile('bin', 'enc2xs');
99 $str .= "$table.c : $enc2xs Makefile.PL";
100 foreach my $file (@{$tables{$table}})
102 $str .= $continuator.' '.$self->catfile($dir,$file);
103 if ( length($str)-$lengthsofar > 128*$numlines )
105 $continuator .= " \\\n\t";
111 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
112 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
113 my $ucopts = '-"Q" -"O"';
115 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
116 open (FILELIST, ">$table.fnm")
117 || die "Could not open $table.fnm: $!";
118 foreach my $file (@{$tables{$table}})
120 print FILELIST $self->catfile($dir,$file) . "\n";