3 use ExtUtils::MakeMaker;
20 NAME => 'Encode::'.$name,
21 VERSION_FROM => "$name.pm",
22 OBJECT => '$(O_FILES)',
24 COMPRESS => 'gzip -9f',
26 DIST_DEFAULT => 'all tardist',
29 # OS 390 winges about line numbers > 64K ???
30 XSOPT => '-nolinenumbers',
39 my $x = $self->{'OBJ_EXT'};
40 # Add the table O_FILES
41 foreach my $e (keys %tables)
46 $self->{'O_FILES'} = [sort keys %o];
47 my @files = ("$name.xs");
48 $self->{'C'} = ["$name.c"];
49 $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
51 foreach my $table (keys %tables) {
52 push (@{$self->{'C'}},"$table.c");
53 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
55 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
56 push (@files,$table.$ext);
59 $self->{'XS'} = { "$name.xs" => "$name.c" };
60 $self->{'clean'}{'FILES'} .= join(' ',@files);
61 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
69 foreach my $table (keys %tables) {
70 print XS qq[#include "${table}.h"\n];
75 Encode_XSEncoding(pTHX_ encode_t *enc)
78 HV *stash = gv_stashpv("Encode::XS", TRUE);
79 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
85 const char *name = enc->name[i++];
86 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
89 call_pv("Encode::define_encoding",G_DISCARD);
93 MODULE = Encode::$name PACKAGE = Encode::$name
98 foreach my $table (keys %tables) {
99 print XS qq[#include "${table}.exh"\n];
103 return "# Built $name.xs\n\n";
109 my $dir = $self->catdir($self->updir,'ucm');
110 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
111 $str .= "$name.c : $name.xs ";
112 foreach my $table (keys %tables)
117 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
119 my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
120 foreach my $table (keys %tables)
123 my $lengthsofar = length($str);
124 my $continuator = '';
125 $str .= "$table.c : $enc2xs Makefile.PL";
126 foreach my $file (@{$tables{$table}})
128 $str .= $continuator.' '.$self->catfile($dir,$file);
129 if ( length($str)-$lengthsofar > 128*$numlines )
131 $continuator .= " \\\n\t";
137 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
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";