3 use ExtUtils::MakeMaker;
9 qw(cp037.ucm cp1026.ucm cp1047.ucm cp500.ucm cp875.ucm),
15 NAME => 'Encode::'.$name,
16 VERSION_FROM => "$name.pm",
17 OBJECT => '$(O_FILES)',
19 COMPRESS => 'gzip -9f',
21 DIST_DEFAULT => 'all tardist',
24 # OS 390 winges about line numbers > 64K ???
25 XSOPT => '-nolinenumbers',
34 my $x = $self->{'OBJ_EXT'};
35 # Add the table O_FILES
36 foreach my $e (keys %tables)
41 $self->{'O_FILES'} = [sort keys %o];
42 my @files = ("$name.xs");
43 $self->{'C'} = ["$name.c"];
44 $self->{SOURCE} .= " $name.c"
45 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
46 $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
48 foreach my $table (keys %tables) {
49 push (@{$self->{'C'}},"$table.c");
50 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
52 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
53 push (@files,$table.$ext);
55 $self->{SOURCE} .= " $table.c"
56 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
58 $self->{'XS'} = { "$name.xs" => "$name.c" };
59 $self->{'clean'}{'FILES'} .= join(' ',@files);
60 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
68 foreach my $table (keys %tables) {
69 print XS qq[#include "${table}.h"\n];
74 Encode_XSEncoding(pTHX_ encode_t *enc)
77 HV *stash = gv_stashpv("Encode::XS", TRUE);
78 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
84 const char *name = enc->name[i++];
85 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
88 call_pv("Encode::define_encoding",G_DISCARD);
92 MODULE = Encode::$name PACKAGE = Encode::$name
97 foreach my $table (keys %tables) {
98 print XS qq[#include "${table}.exh"\n];
102 return "# Built $name.xs\n\n";
108 my $dir = $self->catdir($self->updir,'ucm');
109 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
110 $str .= "$name.c : $name.xs ";
111 foreach my $table (keys %tables)
116 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
118 my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
119 foreach my $table (keys %tables)
122 my $lengthsofar = length($str);
123 my $continuator = '';
124 $str .= "$table.c : $enc2xs Makefile.PL";
125 foreach my $file (@{$tables{$table}})
127 $str .= $continuator.' '.$self->catfile($dir,$file);
128 if ( length($str)-$lengthsofar > 128*$numlines )
130 $continuator .= " \\\n\t";
136 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
137 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
138 my $ucopts = '-"Q" -"O"';
140 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
141 open (FILELIST, ">$table.fnm")
142 || die "Could not open $table.fnm: $!";
143 foreach my $file (@{$tables{$table}})
145 print FILELIST $self->catfile($dir,$file) . "\n";