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->{SOURCE} .= " $name.c"
50 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
51 $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
53 foreach my $table (keys %tables) {
54 push (@{$self->{'C'}},"$table.c");
55 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
57 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
58 push (@files,$table.$ext);
60 $self->{SOURCE} .= " $table.c"
61 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
63 $self->{'XS'} = { "$name.xs" => "$name.c" };
64 $self->{'clean'}{'FILES'} .= join(' ',@files);
65 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
73 foreach my $table (keys %tables) {
74 print XS qq[#include "${table}.h"\n];
79 Encode_XSEncoding(pTHX_ encode_t *enc)
82 HV *stash = gv_stashpv("Encode::XS", TRUE);
83 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
89 const char *name = enc->name[i++];
90 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
93 call_pv("Encode::define_encoding",G_DISCARD);
97 MODULE = Encode::$name PACKAGE = Encode::$name
102 foreach my $table (keys %tables) {
103 print XS qq[#include "${table}.exh"\n];
107 return "# Built $name.xs\n\n";
113 my $dir = $self->catdir($self->updir,'ucm');
114 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
115 $str .= "$name.c : $name.xs ";
116 foreach my $table (keys %tables)
121 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
123 my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
124 foreach my $table (keys %tables)
127 my $lengthsofar = length($str);
128 my $continuator = '';
129 $str .= "$table.c : $enc2xs Makefile.PL";
130 foreach my $file (@{$tables{$table}})
132 $str .= $continuator.' '.$self->catfile($dir,$file);
133 if ( length($str)-$lengthsofar > 128*$numlines )
135 $continuator .= " \\\n\t";
141 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
142 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
143 my $ucopts = '-"Q" -"O"';
145 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
146 open (FILELIST, ">$table.fnm")
147 || die "Could not open $table.fnm: $!";
148 foreach my $file (@{$tables{$table}})
150 print FILELIST $self->catfile($dir,$file) . "\n";