3 use ExtUtils::MakeMaker;
7 euc_jp_t => ['euc-jp.ucm'],
8 sjis_t => ['shiftjis.ucm',
12 qw(jis0201.ucm jis0208.ucm jis0212.ucm)
16 unless ($ENV{AGGREGATE_TABLES}){
18 for my $k (keys %tables){
19 push @ucm, @{$tables{$k}};
23 for my $ucm (sort @ucm){
25 my $t = sprintf ("%s_%02d_t", substr($ucm, 0, 2), $seq++);
26 $tables{$t} = [ $ucm ];
34 NAME => 'Encode::'.$name,
35 VERSION_FROM => "$name.pm",
36 OBJECT => '$(O_FILES)',
38 COMPRESS => 'gzip -9f',
40 DIST_DEFAULT => 'all tardist',
43 # OS 390 winges about line numbers > 64K ???
44 XSOPT => '-nolinenumbers',
53 my $x = $self->{'OBJ_EXT'};
54 # Add the table O_FILES
55 foreach my $e (keys %tables)
60 $self->{'O_FILES'} = [sort keys %o];
61 my @files = ("$name.xs");
62 $self->{'C'} = ["$name.c"];
63 $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
65 foreach my $table (keys %tables) {
66 push (@{$self->{'C'}},"$table.c");
67 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
69 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
70 push (@files,$table.$ext);
73 $self->{'XS'} = { "$name.xs" => "$name.c" };
74 $self->{'clean'}{'FILES'} .= join(' ',@files);
75 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
83 foreach my $table (keys %tables) {
84 print XS qq[#include "${table}.h"\n];
89 Encode_XSEncoding(pTHX_ encode_t *enc)
92 HV *stash = gv_stashpv("Encode::XS", TRUE);
93 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
99 const char *name = enc->name[i++];
100 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
103 call_pv("Encode::define_encoding",G_DISCARD);
107 MODULE = Encode::$name PACKAGE = Encode::$name
112 foreach my $table (keys %tables) {
113 print XS qq[#include "${table}.exh"\n];
117 return "# Built $name.xs\n\n";
123 my $dir = $self->catdir($self->updir,'ucm');
124 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
125 $str .= "$name.c : $name.xs ";
126 foreach my $table (keys %tables)
131 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
133 my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
134 foreach my $table (keys %tables)
137 my $lengthsofar = length($str);
138 my $continuator = '';
139 $str .= "$table.c : $enc2xs Makefile.PL";
140 foreach my $file (@{$tables{$table}})
142 $str .= $continuator.' '.$self->catfile($dir,$file);
143 if ( length($str)-$lengthsofar > 128*$numlines )
145 $continuator .= " \\\n\t";
151 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
152 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
155 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
156 open (FILELIST, ">$table.fnm")
157 || die "Could not open $table.fnm: $!";
158 foreach my $file (@{$tables{$table}})
160 print FILELIST $self->catfile($dir,$file) . "\n";